IUPAC Three Letter Code¶
A reader and writer for the ubiquitious trivial IUPAC notation for glycan structures. This notation will be familiar to biologists and biochemists, and the parser attempts to recognize common shorthand and special cases that may be inconsistent with the grammmar used to describe the format.
High Level Functions¶
- glypy.io.iupac.dumps(structure, dialect=None)¶
Translate
structure
into its textual representation using IUPAC Three Letter Code- Parameters
structure (
Glycan
orMonosaccharide
) – The structure to be translateddialect (
str
) – One of “extended” or “simple”, controlling whether the long-form linkage and monosaccharide notation is used, or the more compact simplified form is used. Defaults to “extended”.
- Return type
See also
- glypy.io.iupac.loads(text, structure_class=<class 'glypy.structure.glycan.Glycan'>, resolve_default_positions=True, dialect=None, **kwargs)¶
Parse the given text into an instance of
Glycan
. If there is only a single monosaccharide in the output, just the Monosaccharide instance is returned.- Parameters
text (
str
) – The text to parserresolve_default_positions (
bool
) – Whether to assume default positions for common monosaccharide modifiers that are omitted for brevity, such as the postion of n-acetyl on HexNAc.dialect (
str
) – One of “extended” or “simple”, controlling whether the long-form linkage and monosaccharide notation is used, or the more compact simplified form is used. Defaults to “extended”.**kwargs – Forwarded to
glycan_from_iupac()
- Returns
If the resulting structure is just a single monosaccharide, the returned value is a Monosaccharide.
- Return type
There are multiple dialects of IUPAC, affecting how monosaccharides are written and how linkages are
denoted. The dialect
parameter in these functions control which dialect is expected or generated.
The simple
dialect: Neu5Gc(a2-3)Gal(b1-4)[Fuc(a1-3)]Glc2NAc
The extended
dialect: a-D-Neup5Gc-(2-3)-b-D-Galp-(1-4)-[a-L-Fucp-(1-3)]b-D-Glcp2NAc
Example¶
>>> from glypy.io import iupac
>>> iupac.loads('a-L-Fucp-(1-6)-[a-D-Neup5Ac-(2-3)-b-D-Galp-(1-4)-[a-L-Fucp-(1-3)]b-D-Glcp2NAc-(1-6)-[a-D-Neup5Gc-(2-3)-b-D-Galp-(1-4)-[a-L-Fucp-(1-3)]b-D-Glcp2NAc-(1-2)]a-D-Manp-(1-6)-[b-D-Glcp2NAc-(1-4)][b-D-Galp2NAc-(1-4)-b-D-Glcp2NAc-(1-4)-[a-D-Neup5Gc-(2-3)-b-D-Galp-(1-4)-[a-L-Fucp-(1-3)]b-D-Glcp2NAc-(1-2)]a-D-Manp-(1-3)]b-D-Manp-(1-4)-b-D-Glcp2NAc-(1-4)]?-D-Glcp2NAc')
>>>
(Source code, svg, png, hires.png, pdf)
Object-Oriented Interface¶
The high-level API is implemented using a set of cooperating types for converting between
glypy
’s objects and IUPAC text formats. All of these objects provide these behaviors by calling them on the appropriate argument
Serialization¶
- class glypy.io.iupac.SubstituentSerializer(monosaccharides=None, substitution_rules=None, substituent_map=None)[source]¶
Build the textual encoding for the relevant substituents for a provided monosaccharide.
- Variables
monosaccharide_reference (
dict
) – Map base type toMonosaccharide
- class glypy.io.iupac.ModificationSerializer[source]¶
Build the textual encoding for the relevant modifications for a provided monosaccharide base type.
- class glypy.io.iupac.MonosaccharideSerializer(monosaccharides=None, substituent_resolver=None, modification_extractor=None)[source]¶
Serialize a
Monosaccharide
object to IUPAC text- Variables
modification_extractor (
ModificationSerializer
) – Convert modifications to a text listmonosaccharide_reference (
dict
) – Map base type toMonosaccharide
substituent_resolver (
SubstituentSerializer
) – Convert substituents to a text list
- class glypy.io.iupac.LinkageSerializer(open_edge='-(', close_edge=')-', open_branch='[', close_branch=']')[source]¶
- class glypy.io.iupac.GlycanSerializer(monosaccharide_serializer=None, linkage_serializer=None)[source]¶
Converts a
Glycan
structure to IUPAC format.Also works on individual
Monosaccharide
objects, but will traverse any links they have to other nodes.- Variables
linkage_serializer (
LinkageSerializer
) – An object that converts aLink
object into textmonosaccharide_serializer (
MonosaccharideSerializer
) – An object that converts aMonosaccharide
object into text
Deserialization¶
- class glypy.io.iupac.ModificationDeserializer(modification_map=None)[source]¶
Parses modification signifiers from text into position,
Modification
pairs- Variables
modification_map (
dict
) – Mapping from text representation toModification
to provide additional names for the existing modification name mapping.
Derivatization¶
- class glypy.io.iupac.DerivatizationAwareMonosaccharideSerializer(monosaccharides=None, substituent_resolver=None, modification_extractor=None)[source]¶
A derivatization aware version of
MonosaccharideSerializer
which deviates from the standard IUPAC code to encode derivatization.If a
Monosaccharide
object has a derivatizing substituent attached to it, as detected byhas_derivatization()
, those substituent groups will normally be ignored. With this subclass, a single entry will be appended to the monosaccharide encoding joined by an “^” character. For example a permethylated hexose would be written “Hex^Me”.
Simplified Format¶
- class glypy.io.iupac.SimpleMonosaccharideSerializer(monosaccharides=None, substituent_resolver=None, modification_extractor=None)[source]¶
- class glypy.io.iupac.SimpleLinkageSerializer(open_edge='(', close_edge=')', open_branch='[', close_branch=']')[source]¶