#!/bin/env python2

import sys
from collections import defaultdict

from getwiki import GlycanData, Glycan
w = GlycanData()

# print >>sys.stderr, "Read subsumption graph"
from pygly.GNOme import SubsumptionGraph

gnome = SubsumptionGraph()
gnome.loaddata(sys.argv[1])

gnomeacc = set()
for n in gnome.nodes():
    gnomeacc.add(n)

accs = set()
for fn in sys.argv[2:]:
    accs.update(open(fn).read().split())

for m in w.iterglycan():

    acc = m.get('accession')
    m.delete_annotations(type="Subsumption")

    if acc in gnomeacc:
        m.set_annotation(value=acc,
                         property="GNOme",
                         source="GNOme",
Beispiel #2
0
#!/bin/env python27

import sys

import findpygly

from pygly.GNOme import GNOme, SubsumptionGraph
from pygly.GlyTouCan import GlyTouCan

g = SubsumptionGraph()
g.readfile(sys.argv[1])
sys.argv.pop(1)
# g = GNOme()
gtc = GlyTouCan(usecache=True)

for acc in sys.argv[1:]:
    taccs = set(filter(g.istopology, g.descendants(acc)))
    # print " ".join(sorted(taccs))
    toremove = set()
    for tacc in taccs:
        gly = gtc.getGlycan(tacc)
        if gly.undetermined():
            toremove.add(tacc)
        for m in gly.all_nodes():
            if m.stem() == None:
                toremove.add(tacc)
                break
    for tacc in toremove:
        taccs.remove(tacc)
    toremove = set()
    for tacc in taccs:
#!/bin/env python27
import sys

from collections import defaultdict

import findpygly

# use the current raw GNOme subsumption dump
# Back-fill with GlyTouCan if needed.

from pygly.GNOme import SubsumptionGraph

gnome = SubsumptionGraph()
gnome.loaddata(sys.argv[1])
sys.argv.pop(1)

accs = set()
for f in sys.argv[1:]:
    accs.update(open(f).read().split())

newaccs0 = set(accs)

while True:
    newaccs = set()

    for acc in newaccs0:
        newaccs.add(acc)
        newaccs.update(
            filter(lambda anc: anc.startswith('G'), gnome.ancestors(acc)))
        topo = gnome.get_topology(acc)
        comp = gnome.get_composition(acc)
#!/bin/env python2

import sys
from operator import itemgetter

from collections import defaultdict

from getwiki import GlycanData, Glycan
w = GlycanData()

from pygly.GNOme import SubsumptionGraph

gnome = SubsumptionGraph()
gnome.loaddata(sys.argv[1])
sys.argv.pop(1)

def iterglycan():
    if len(sys.argv) > 1:
	seen = set()
	for acc in sys.argv[1:]:
	    if acc in seen:
		continue
	    m = w.get(acc)
	    if m:
		seen.add(acc)
		yield m
	    for desc in gnome.descendants(acc):
		if desc in seen:
		    continue
		m = w.get(desc)
		if m:
#!/bin/env python2

import sys
from operator import itemgetter
from collections import defaultdict

from getwiki import GlycanData, Glycan
w = GlycanData()

from pygly.GNOme import SubsumptionGraph
gnome = SubsumptionGraph()
gnome.loaddata(sys.argv[1])
sys.argv.pop(1)

debug = False
def iterglycan():
    global debug
    if len(sys.argv) > 1:
	for acc in sys.argv[1:]:
	    m = w.get(acc)
	    if m:
		debug = True
		yield m
    else:
	for m in w.iterglycan():
	    yield m

from clseng import ClassifierEngine
classifier = ClassifierEngine()

acc2type = defaultdict(set)
Beispiel #6
0
#!/bin/env python27

import sys
from collections import defaultdict

from getwiki import GlycanData, Glycan
w = GlycanData()

# print >>sys.stderr, "Read subsumption graph"
from pygly.GNOme import SubsumptionGraph

gnome = SubsumptionGraph()
gnome.loaddata(sys.argv[1])

accs = set()
for fn in sys.argv[2:]:
    accs.update(open(fn).read().split())

for m in w.iterglycan():

    acc = m.get('accession')
    m.delete_annotations(type="Subsumption")

    if gnome.isbasecomposition(acc):
        m.set_annotation(property="Level",
                         value="BaseComposition",
                         source="GNOme",
                         type="Subsumption")
        m.set_annotation(property="BaseComposition",
                         value=acc,
                         source="GNOme",