Closed aokinobu closed 8 years ago
Hello,
Yes, it does implement a subset of the GlycoMinds LinearCode, but not repeating structures or the "non-standard ring type" notation. The documentation: http://glypy.readthedocs.org/en/master/io/linear_code.html, which details all of the machinery. The public API follows the standard loads
from string and dumps
to string.
The glycoct
implementation is more complete, being the basis for the object model I started with. There is limited support for repeating subsequences, and ambiguous linkages, though I haven't yet implemented undetermined topologies. The documentation: http://glypy.readthedocs.org/en/master/io/glycoct.html. It also follows the loads/dumps
interface.
It also does similar things with the IUPAC Three Letter Code.
from glypy.io import glycoct, linear_code
# Taken from GlyTouCan G40906DZ
broad_n_glycan = '''
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:b-dglc-HEX-1:5
8s:n-acetyl
9b:b-dgal-HEX-1:5
10b:a-lgal-HEX-1:5|6:d
11b:b-dglc-HEX-1:5
12s:n-acetyl
13b:b-dgal-HEX-1:5
14b:a-dman-HEX-1:5
15b:b-dglc-HEX-1:5
16s:n-acetyl
17b:b-dgal-HEX-1:5
18b:b-dglc-HEX-1:5
19s:n-acetyl
20b:b-dgal-HEX-1:5
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)14d
6:5o(6+1)6d
7:6o(2+1)11d
8:6o(6+1)7d
9:7d(2+1)8n
10:7o(3+1)10d
11:7o(4+1)9d
12:11d(2+1)12n
13:11o(4+1)13d
14:14o(2+1)18d
15:14o(4+1)15d
16:15d(2+1)16n
17:15o(4+1)17d
18:18d(2+1)19n
19:18o(4+1)20d'''
structure = glycoct.loads(broad_n_glycan)
# 2516.9144725292003
print(structure.mass())
linear_encoding = linear_code.dumps(structure)
# 'Ab4(Fa3)GNb6(Ab4GNb2)Ma6(Ab4GNb4(Ab4GNb2)Ma3)Mb4GNb4GNb'
print(linear_encoding)
print linear_code.loads(linear_encoding) == structure
To serialize to glycoct, right now just invoke str
on a Glycan object. I'll write a function to do so in the glycoct module though
thank you this answers my question. I would like to incorporate this into the glytoucan project.
Hi, i am looking for a library that can convert from glycoct/linearcode. Does this library have that kind of functionality?