skbio.sequence.Protein.degap#

Protein.degap()[source]#

Return a new sequence with gap characters removed.

Returns:
GrammaredSequence

A new sequence with all gap characters removed.

See also

gap_chars

Notes

The type and metadata of the result will be the same as the biological sequence. If positional metadata is present, it will be filtered in the same manner as the sequence characters and included in the resulting degapped sequence.

Examples

>>> from skbio import DNA
>>> s = DNA('GGTC-C--ATT-C.',
...         positional_metadata={'quality':range(14)})
>>> s.degap()
DNA
-----------------------------
Positional metadata:
    'quality': <dtype: int64>
Stats:
    length: 9
    has gaps: False
    has degenerates: False
    has definites: True
    GC-content: 55.56%
-----------------------------
0 GGTCCATTC