skbio.alignment.Alignment.omit_gap_positions

Alignment.omit_gap_positions(maximum_gap_frequency)[source]

Returns Alignment with positions filtered based on gap frequency

Parameters:

maximum_gap_frequency : float

The maximum fraction of the sequences that can contain a gap at a given position for that position to be retained in the resulting Alignment.

Returns:

Alignment

The subalignment containing only the positions with gaps in fewer than maximum_gap_frequency fraction of the sequences.

Examples

>>> from skbio.alignment import Alignment
>>> from skbio.sequence import DNA
>>> sequences = [DNA('AC--', id="seq1"),
...              DNA('AT-C', id="seq2"),
...              DNA('TT-C', id="seq3")]
>>> a1 = Alignment(sequences)
>>> a2 = a1.omit_gap_positions(0.50)
>>> a2
<Alignment: n=3; mean +/- std length=3.00 +/- 0.00>
>>> print(a2[0])
AC-
>>> print(a2[1])
ATC
>>> print(a2[2])
TTC