skbio.sequence.NucleotideMixin.reverse_complement#

NucleotideMixin.reverse_complement()[source]#

Return the reverse complement of the nucleotide sequence.

Returns:
NucleotideMixin

The reverse complement of the nucleotide sequence. The type and metadata of the result will be the same as the nucleotide sequence. If positional metadata is present, it will be reversed.

Notes

This method is equivalent to self.complement(reverse=True).

Examples

>>> from skbio import DNA
>>> seq = DNA('TTCATT',
...           positional_metadata={'quality':range(6)})
>>> seq = seq.reverse_complement()
>>> seq
DNA
-----------------------------
Positional metadata:
    'quality': <dtype: int64>
Stats:
    length: 6
    has gaps: False
    has degenerates: False
    has definites: True
    GC-content: 16.67%
-----------------------------
0 AATGAA
>>> seq.positional_metadata['quality'].values 
array([5, 4, 3, 2, 1, 0]...