Substituents¶
Represents non-saccharide units that are found attached to saccharide residues. They also posses graph node-like properties.
- class glypy.structure.substituent.Substituent(name, links=None, composition=None, id=None, can_nh_derivatize=None, is_nh_derivatizable=None, derivatize=False, attachment_composition=None)[source]¶
Represents a non-saccharide molecule commonly found bound to saccharide units.
- Variables:
name (
str) – The name of the substituent, used to uniquely identify it.links (
OrderedMultiMap) – All links to all molecules connected to this one.composition (
Composition) – The chemical makeup of this molecule.attachment_composition (
Composition) – The default cost of attaching this substituent to aMonosaccharideid (
int) – A unique identifier number for this molecule.can_nh_derivatize (
bool) – Whether this substituent will derivatize at an amine group.is_nh_derivatizable (
bool) – Whether this substituent contains a derivatizable amine group._derivatize (
bool) – Whether this substituent was added by a derivatization process._degree (
int) – The number of connections to this molecule. Mutated internally byLinkobjects, not for external use. Seeorder().
- add_substituent(substitent, position=2, max_occupancy=1, child_position=1, parent_loss=None, child_loss=None)[source]¶
Adds a
Substituentand associatedLinktolinksat the site given byposition. This new substituent is included when calculating mass with substituents included- Parameters:
substituent (str or Substituent) – The substituent to add. If passed a
str, it will be translated into an instance ofSubstituentposition (int or 'x') – The location to add the
Substituentlink tolinks. Defaults to 2child_position (int) – The location to add the link to in
substituent’slinks. Defaults to 1. Substituent indices are currently not checked.max_occupancy (int, optional) – The maximum number of items acceptable at
position. Defaults to1parent_loss (Composition or str) – The elemental composition removed from
self. Defaults toH1.child_loss (Composition or str) – The elemental composition removed from
substituent. Defaults toH1.
- Raises:
ValueError: –
positionis occupied by more thanmax_occupancyelements
- children(links=False, bridging=False)[source]¶
Returns an iterator over the
Monosaccharide`s which are considered the descendants of ``self`.
- clone(prop_id=True)[source]¶
Duplicates this
Substituentobject, recursively copying all children as well.- Parameters:
prop_id (bool) – Whether or not to propagate
idto the clone.- Return type:
See also
structure.Monosaccharide.clone()
- is_occupied(position)[source]¶
Check to see if
positionis occupied. UnlikeMonosaccharide,Substituentobjects can only have two attachment sites at this time.
- mass(average=False, charge=0, mass_data=None)[source]¶
Calculates the total mass of
selfand all nodes returned bychildren().- Parameters:
average (bool, optional, defaults to False) – Whether or not to use the average isotopic composition when calculating masses. When
average == False, masses are calculated using monoisotopic mass.charge (int, optional, defaults to 0) – If charge is non-zero, m/z is calculated, where m is the theoretical mass, and z is
chargemass_data (dict, optional, defaults to
None) – If mass_data is None, standard NIST mass and isotopic abundance data are used. Otherwise the contents of mass_data are assumed to contain elemental mass and isotopic abundance information.
- Return type:
- parents(links=False)[source]¶
Returns an iterator over the objects which are considered the ancestors of
self.
- static register(name, composition, can_nh_derivatize=None, is_nh_derivatizable=None, attachment_composition=None)¶
Register common information about a
Substituentgroup to be used during initialization of instances ofSubstituentwhich share that name.- Parameters:
name (str) – The name to be registered
composition (
Composition) – The shared base composition that will be initialized for each instancecan_nh_derivatize (None, optional) – Passed to
DerivatizePathway.registeris_nh_derivatizable (None, optional) – Passed to
DerivatizePathway.registerattachment_composition (None, optional) – The shared composition that will be lost from the parent molecule when forming a bond with substituents of this type.
- total_composition()[source]¶
Computes the sum of the composition of
selfand each of its linked :class:`~.substituent.Substituent`s- Return type:
Composition
- static unregister(name)¶
Removes all information about the
Substituentgroup denoted bynamefrom the shared indices.- Parameters:
name (str) – The name to un-register
- glypy.structure.substituent.register(name, composition, can_nh_derivatize=None, is_nh_derivatizable=None, attachment_composition=None)[source]¶
Register common information about a
Substituentgroup to be used during initialization of instances ofSubstituentwhich share that name.- Parameters:
name (str) – The name to be registered
composition (
Composition) – The shared base composition that will be initialized for each instancecan_nh_derivatize (None, optional) – Passed to
DerivatizePathway.registeris_nh_derivatizable (None, optional) – Passed to
DerivatizePathway.registerattachment_composition (None, optional) – The shared composition that will be lost from the parent molecule when forming a bond with substituents of this type.
- glypy.structure.substituent.unregister(name)[source]¶
Removes all information about the
Substituentgroup denoted bynamefrom the shared indices.- Parameters:
name (str) – The name to un-register