def test_autoname_substituent(self): h = monosaccharides.Hex h.add_substituent("phosphate") iupac.substituents_map_to.pop("phosphate") t = iupac.to_iupac(h) r = iupac.from_iupac(t) self.assertEqual(h, r)
def draw(monosaccharide, x, y, ax, tree_node=None, scale=0.1, **kwargs): try: text = iupac.to_iupac(monosaccharide) except: text = monosaccharide if text[0] == 'a': pass elif text[0] == 'b': pass node = draw_text(ax, x, y, text) return MonosaccharidePatch(saccharide_label=(node,))
def test_glycan_to_iupac(self): reference = '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' structure = common.load("complex_glycan") self.assertEqual(iupac.to_iupac(structure), reference)
def test_special_cases(self): for text, mass in [('?-D-Neup', 267.095), ('?-D-Neup5Ac', 309.105), ('a-D-Neup5NGc', 325.100)]: self.assertAlmostEqual(iupac.from_iupac( iupac.to_iupac(iupac.from_iupac(text))).mass(), mass, 2)
def test_monosaccharide_to_iupac(self): iupac_residue = iupac.to_iupac(monosaccharides.Fucose) reference = "a-L-Fucp" self.assertEqual(iupac_residue, reference)