/usr/share/pyshared/cogent/struct/annotation.py is in python-cogent 1.5.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """Contains functions to annotate macromolecular entities."""
from cogent.core.entity import HIERARCHY
__author__ = "Marcin Cieslik"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Marcin Cieslik"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Marcin Cieslik"
__email__ = "mpc4p@virginia.edu"
__status__ = "Development"
def xtradata(data, entity):
"""Annotates an entity with data from a ``{full_id:data}`` dictionary. The
``data`` should also be a dictionary.
Arguments:
- data: a dictionary, which is a mapping of full_id's (keys) and data
dictionaries.
- entity: top-level entity, which contains the entities which will hold
the data."""
for full_id, data in data.iteritems():
sub_entity = entity
strip_full_id = [i for i in full_id if i is not None]
for short_id in strip_full_id:
sub_entity = sub_entity[(short_id,)]
sub_entity.xtra.update(data)
|