R: Delete Alignment Gaps in DNA Sequences

del.gaps {ape} | R Documentation

## Delete Alignment Gaps in DNA Sequences

### Description

These functions remove gaps (`"-"`) in a sample of DNA sequences.

### Usage

    del.gaps(x)
    del.colgapsonly(x, threshold = 1, freq.only = FALSE)
    del.rowgapsonly(x, threshold = 1, freq.only = FALSE)

### Arguments

`x` | a matrix, a list, or a vector containing the DNA sequences; only matrices for `del.colgapsonly` and for `del.rowgapsonly`.
`threshold` | the largest gap proportion to delete the column or row.
`freq.only` | if `TRUE`, returns only the numbers of gaps for each column or row.

### Details

`del.gaps` remove all gaps, so the returned sequences may not have all the same lengths and are therefore returned in a list.

`del.colgapsonly` removes the columns with a proportion at least `threshold` of gaps. Thus by default, only the columns with gaps only are removed (useful when a small matrix is extracted from a large alignment). `del.rowgapsonly` does the same for the rows.

The sequences can be either in `"DNAbin"` or in another format, but the returned object is always of class `"DNAbin"`.

### Value

`del.gaps` returns a vector (if there is only one input sequence) or a list of class `"DNAbin"`; `del.colgapsonly` and `del.rowgapsonly` return a matrix of class `"DNAbin"` or a numeric vector (with names for the second function) if `freq.only = TRUE`.

### Author(s)

Emmanuel Paradis

### See Also

`base.freq`, `seg.sites`, `image.DNAbin`, `checkAlignment`

[Package ape version 5.6-2 Index]