skbio.alignment.Alignment.omit_gap_sequences

Alignment.omit_gap_sequences(maximum_gap_frequency)[source]

Returns Alignment with sequences filtered based on gap frequency

Parameters:

maximum_gap_frequency : float

The maximum fraction of the positions that can contain a gap in a given sequence for that sequence to be retained in the resulting Alignment.

Returns:

Alignment

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

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_sequences(0.49)
>>> a2
<Alignment: n=2; mean +/- std length=4.00 +/- 0.00>
>>> print(a2[0])
AT-C
>>> print(a2[1])
TT-C