skbio.sequence.GrammaredSequence.lowercase#

GrammaredSequence.lowercase(lowercase)[source]#

Return a case-sensitive string representation of the sequence.

Parameters:
lowercase: str or boolean vector

If lowercase is a boolean vector, it is used to set sequence characters to lowercase in the output string. True values in the boolean vector correspond to lowercase characters. If lowercase is a str, it is treated like a key into the positional metadata, pointing to a column which must be a boolean vector. That boolean vector is then used as described previously.

Returns:
str

String representation of sequence with specified characters set to lowercase.

Examples

>>> from skbio import Sequence
>>> s = Sequence('ACGT')
>>> s.lowercase([True, True, False, False])
'acGT'
>>> s = Sequence('ACGT',
...              positional_metadata={
...                 'exons': [True, False, False, True]})
>>> s.lowercase('exons')
'aCGt'

Constructor automatically populates a column in positional metadata when the lowercase keyword argument is provided with a column name:

>>> s = Sequence('ACgt', lowercase='introns')
>>> s.lowercase('introns')
'ACgt'
>>> s = Sequence('ACGT', lowercase='introns')
>>> s.lowercase('introns')
'ACGT'