Skip to content

Parsing glycan with UND structure #17

@bobaoai

Description

@bobaoai

Hey Joshua,

I encountered a problem when dealing with the glycan with ambiguity structure as shown below.
image
The glycoct string I generated from GlycanBuilder is attached.
As I read through the code, it looks like the writer can generate the glycoct string that contains 'SubtreeLinkageID1' but we cannot load the string, am I correct? If so, what change should I make on the string or how can I load/build a Glycan object that has the ambiguity structure? Is it possible for me to do the Glycan.fragments on this kind of structure?

glycoct.loads(
"""RES
1b:b-dglc-HEX-1:5
2s:n-acetyl
3b:b-dglc-HEX-1:5
4s:n-acetyl
5b:b-dman-HEX-1:5
6b:a-dman-HEX-1:5
7b:a-dman-HEX-1:5
8b:a-lgal-HEX-1:5|6:d
LIN
1:1d(2+1)2n
2:1o(4+1)3d
3:3d(2+1)4n
4:3o(4+1)5d
5:5o(3+1)6d
6:5o(6+1)7d
7:1o(6+1)8d
UND
UND1:100.0:100.0
ParentIDs:1|3|5|6|7|8
SubtreeLinkageID1:u(2+1)u
RES
9b:b-dglc-HEX-1:5
10s:n-acetyl
11b:b-dgal-HEX-1:5
LIN
8:9d(2+1)10n
9:9o(3+1)11d
""")
---------------------------------------------------------------------------
GlycoCTError                              Traceback (most recent call last)
<ipython-input-10-b5e3c0a66dfc> in <module>
     38 10:12d(2+1)13n
     39 11:12o(3+1)14d
---> 40 """)

/anaconda3/lib/python3.7/site-packages/glypy/io/glycoct.py in loads(text, structure_class, allow_repeats, allow_multiple)
   1330 
   1331     text_buffer = StringIO(text)
-> 1332     return load(text_buffer, structure_class, allow_repeats, allow_multiple)
   1333 
   1334 

/anaconda3/lib/python3.7/site-packages/glypy/io/glycoct.py in load(stream, structure_class, allow_repeats, allow_multiple)
   1299     """
   1300     g = GlycoCTReader(stream, structure_class=structure_class, allow_repeats=allow_repeats)
-> 1301     first = next(g)
   1302     if not allow_multiple:
   1303         return first

/anaconda3/lib/python3.7/site-packages/glypy/io/glycoct.py in next(self)
    888         if self._iter is None:
    889             iter(self)
--> 890         return next(self._iter)
    891 
    892     #: Alias for next. Supports Py3 Iterator interface

/anaconda3/lib/python3.7/site-packages/glypy/io/glycoct.py in parse(self)
   1251                 self.handle_repeat_inner(line)
   1252             elif line.strip()[:3] == UND:
-> 1253                 self.handle_und_inner(line)
   1254             elif ALT == line.strip():
   1255                 raise GlycoCTSectionUnsupported(ALT)

/anaconda3/lib/python3.7/site-packages/glypy/io/glycoct.py in handle_und_inner(self, line)
   1151         if match is None:
   1152             raise GlycoCTError("Could not interpret UND SubtreeLinkage %r at line %d" % (
-> 1153                 subtree_linkage_line, self._source_line))
   1154         else:
   1155             link_dict = match.groupdict()

GlycoCTError: Could not interpret UND SubtreeLinkage 'SubtreeLinkageID1:u(2+1)u' at line 21

Thanks for your help in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions