skbio.sequence.DNA.has_positional_metadata#

DNA.has_positional_metadata()[source]#

Determine if the object has positional metadata.

An object has positional metadata if its positional_metadata pd.DataFrame has at least one column.

Returns:
bool

Indicates whether the object has positional metadata.

Examples

Note

scikit-bio objects with positional metadata share a common interface for accessing and manipulating their positional metadata. The following examples use scikit-bio’s DNA class to demonstrate positional metadata behavior. These examples apply to all other scikit-bio objects storing positional metadata.

>>> import pandas as pd
>>> from skbio import DNA
>>> seq = DNA('ACGT')
>>> seq.has_positional_metadata()
False
>>> seq = DNA('ACGT', positional_metadata=pd.DataFrame(index=range(4)))
>>> seq.has_positional_metadata()
False
>>> seq = DNA('ACGT', positional_metadata={'quality': range(4)})
>>> seq.has_positional_metadata()
True