StaggerAlignment {DECIPHER} | R Documentation

## Produce a Staggered Alignment

### Description

Staggers overlapping characters in a multiple sequence alignment that are better explained by multiple insertions than multiple deletions.

### Usage

    StaggerAlignment(myXStringSet,
                     tree = NULL,
                     threshold = 3,
                     fullLength = FALSE,
                     processors = 1,
                     verbose = TRUE)

### Arguments

`myXStringSet` | An `AAStringSet`, `DNAStringSet`, or `RNAStringSet` object of aligned sequences.
`tree` | A bifurcating `dendrogram` representing the evolutionary relationships between sequences, such as that created by `IdClusters`. The root should be the topmost node of the `tree`.
`threshold` | Numeric giving the ratio of insertions to deletions that must be met to stagger a region of the alignment. Specifically, the number of insertions divided by deletions must be less than threshold to stagger.
`fullLength` | Logical specifying whether the sequences are full-length (`TRUE`), or terminal gaps should be treated as missing data (`FALSE`, the default). Either a single logical, a vector with one logical per sequence, or a list with `right` and `left` components containing logicals for the right and left sides of the alignment.
`processors` | The number of processors to use, or `NULL` to automatically detect and use all available processors.
`verbose` | Logical indicating whether to display progress.

### Details

Multiple sequence aligners typically maximize true homologies at the expense of increased false homologies. `StaggerAlignment` creates a “staggered alignment” which separates regions of the alignment that are likely not homologous into separate regions. This re-balances the trade-off between true positives and false positives by decreasing the number of false homologies at the loss of some true homologies. The resulting alignment is less aesthetically pleasing because it is widened by the introduction of many gaps. However, in an evolutionary sense a staggered alignment is more correct because each aligned position represents a hypothesis about evolutionary events: overlapping characters between any two sequences represent positions common to their ancestor sequence that may have evolved through substitution.

The single parameter `threshold` controls the degree of staggering. Its value represents the ratio of insertions to deletions that must be crossed in order to stagger a region. A `threshold` of `1` would mean any region that could be better explained by separate insertions than deletions should be staggered. A higher value for `threshold` makes it more likely to stagger, and vise-versa. A very high value would conservatively stagger most regions with gaps, resulting in few false homologies but also fewer true homologies. The default value (`3`) is intended to remove more false homologies than it eliminates in true homologies. It may be preferable to tailor the `threshold` depending on the purpose of the alignment, as some downstream procedures (such as tree building) may be more or less sensitive to false homologies.

### Value

An `XStringSet` of aligned sequences.

### Author(s)

Erik Wright eswright@pitt.edu

### References

Coming soon!

### See Also

`AdjustAlignment`, `AlignSeqs`, `IdClusters`

### Examples

    db <- system.file("extdata", "Bacteria_175seqs.sqlite", package="DECIPHER")
    dna <- SearchDB(db, remove="all")
    alignedDNA <- AlignSeqs(dna)
    staggerDNA <- StaggerAlignment(alignedDNA)
    BrowseSeqs(staggerDNA, highlight=1)

[Package DECIPHER version 2.8.1 Index]