skbio.sequence.RNA.complement#

RNA.complement(reverse=False)[source]#

Return the complement of the nucleotide sequence.

Parameters:
reversebool, optional

If True, return the reverse complement. If positional and/or interval metadata are present, they will be reversed.

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 reverse is True, positional or interval metadata will be reversed if it is present.

See also

reverse_complement
complement_map

Examples

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