skbio.sequence.DNA.has_metadata

DNA.has_metadata()[source]

Determine if the object has metadata.

State: Stable as of 0.4.0.

An object has metadata if its metadata dictionary is not empty (i.e., has at least one key-value pair).

Returns:

bool

Indicates whether the object has metadata.

Examples

Note

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

>>> from skbio import Sequence
>>> seq = Sequence('ACGT')
>>> seq.has_metadata()
False
>>> seq = Sequence('ACGT', metadata={})
>>> seq.has_metadata()
False
>>> seq = Sequence('ACGT', metadata={'id': 'seq-id'})
>>> seq.has_metadata()
True