# skbio.sequence.Sequence.metadata

`Sequence.``metadata`

  `dict` containing metadata which applies to the entire object.

  State: Stable as of 0.4.0.

  Notes

  This property can be set and deleted. When setting new metadata a shallow copy of the dictionary is made.

  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.

  Create a sequence with metadata:

      >>> from pprint import pprint
      >>> from skbio import Sequence
      >>> seq = Sequence('ACGT', metadata={'id': 'seq-id',
      ...                                  'description': 'seq description'})

  Retrieve metadata:

      >>> pprint(seq.metadata) # using pprint to display dict in sorted order
      {'description': 'seq description', 'id': 'seq-id'}

  Update metadata:

      >>> seq.metadata['id'] = 'new-id'
      >>> seq.metadata['pubmed'] = 12345
      >>> pprint(seq.metadata)
      {'description': 'seq description', 'id': 'new-id', 'pubmed': 12345}

  Set metadata:

      >>> seq.metadata = {'abc': 123}
      >>> seq.metadata
      {'abc': 123}

  Delete metadata:

      >>> seq.has_metadata()
      True
      >>> del seq.metadata
      >>> seq.metadata
      {}
      >>> seq.has_metadata()
      False