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]¶ Bases:
glypy.structure.base.SubstituentBaseRepresents a non-saccharide molecule commonly found bound to saccharide units.
Attributes
name: strThe name of the substituent, used to uniquely identify it. links: OrderedMultiMapAll links to all molecules connected to this one. composition: CompositionThe chemical makeup of this molecule. attachment_composition: CompositionThe default cost of attaching this substituent to a Monosaccharideid: intA unique identifier number for this molecule. can_nh_derivatize: boolWhether this substituent will derivatize at an amine group. is_nh_derivatizable: boolWhether this substituent contains a derivatizable amine group. _derivatize: boolWhether this substituent was added by a derivatization process. _order: intThe number of connections to this molecule. Mutated internally by Linkobjects, 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 includedParameters: 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()[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.Returns: Substituent
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.Parameters: position: int
Returns: int:
Number of links at
positionRaises: IndexError:
If
position> 2 or < 1
-
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.
Returns:
-
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 :
CompositionThe shared base composition that will be initialized for each instance
can_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`sReturns: 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 :
CompositionThe shared base composition that will be initialized for each instance
can_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