skbio.sequence.DNASequence.degap

DNASequence.degap()[source]

Returns a new BiologicalSequence with gap characters removed.

Returns:

BiologicalSequence

A new BiologicalSequence with all characters from self.gap_alphabet filtered from the sequence.

Notes

The type, id, and description of the result will be the same as self. If quality scores are present, they will be filtered in the same manner as the sequence and included in the resulting degapped biological sequence.

Examples

>>> from skbio.sequence import BiologicalSequence
>>> s = BiologicalSequence('GGUC-C--ACGTT-C.', quality=range(16))
>>> t = s.degap()
>>> t
<BiologicalSequence: GGUCCACGTT... (length: 11)>
>>> print(t)
GGUCCACGTTC
>>> t.quality
array([ 0,  1,  2,  3,  5,  8,  9, 10, 11, 12, 14])