# Sliding window analyses

### Description

Wraps a number of measures used in sliding window analyses into one easy-to-use function.

### Usage

1 2 | ```
slideAnalyses(DNAbin, sppVector, width, interval = 1,
distMeasures = TRUE, treeMeasures = FALSE)
``` |

### Arguments

`DNAbin` |
A DNA alignment of class ‘DNAbin’. |

`sppVector` |
Species vector (see |

`width` |
Desired width of windows in number of nucleotides. |

`interval` |
Distance between each window in number of nucleotides. Default of 1. Giving the option of 'codons' sets the size to 3. |

`distMeasures` |
Logical. Should distance measures be calculated? Default of TRUE. |

`treeMeasures` |
Logical. Should tree-based measures be calculated? Default of FALSE. |

### Details

Distance measures include the following: proportion of zero non-conspecific distances, number of diagnostic nucleotides, number of zero-length distances, and overall mean distance.

Tree-based measures include the following:
proportion of species that are monophyletic,
proportion of clades that are identical between the neighbour joining tree calculated for the window and the tree calculated for the full dataset,
and the latter with `method="shallow"`

.

Tree-based measures are a lot more time-intensive than distance measures. When dealing with lots of taxa and short windows, this part of the function can take hours.

Both distance and tree measures are calculated from a K2P distance matrix created from the data with the option `pairwise.deletion = TRUE`

. When sequences with missing data are compared with other sequences, a `NA`

distance results. These are ignored in the calculation of `slideAnalyses`

distance metrics. However, the tree measures cannot cope with this missing data, and so no result is returned for windows where some sequences solely contain missing data.

### Value

An object of class 'slidWin' which is a list containing the following elements:

`win_mono_out` |
Proportion of species that are monophyletic. |

`comp_out` |
Proportion of clades that are identical between the NJ tree calculated for the window and the tree calculated for the full dataset. |

`comp_depth_out` |
Proportion of shallow clades that are identical. |

`pos_tr_out` |
Index of window position for tree-based analyses. |

`noncon_out` |
Proportion of zero non-conspecific distances. |

`nd_out` |
The sum of diagnostic nucleotides for each species. |

`zero_out` |
The number of zero-length distances. |

`dist_mean_out` |
Overall mean K2P distance of each window. |

`pos_out` |
Index of window position. |

`dat_zero_out` |
Number of zero inter-specific distances in the full dataset. |

`boxplot_out` |
Always FALSE. Required for |

`distMeasures` |
Value of argument. Required for |

`treeMeasures` |
Value of argument. Required for |

### Author(s)

Samuel Brown <s_d_j_brown@hotmail.com>

### See Also

`dist.dna`

, `plot.slidWin`

, `rankSlidWin`

, `slideNucDiag`

.

### Examples

1 2 3 4 5 6 7 8 |