Esempio n. 1
0

def accessions(args):
    if len(args) == 0:
        for it in sys.stdin:
            yield it.strip()
    else:
        for fn in args:
            for it in open(fn):
                yield it.strip()


gtc = GlyTouCan()

allmotifs = dict()
for acc, label, redend in gtc.allmotifs():
    allmotifs[acc] = dict(label=label, redend=redend)

current = set()
for gtcacc in accessions(sys.argv[1:]):
    start = time.time()

    g = w.get(gtcacc)
    newgly = False

    if not g:
        newgly = True
        g = Glycan(accession=gtcacc)

    g.delete('wurcs')
    g.delete('glycoct')
Esempio n. 2
0
#!/bin/env python27

import sys

from getwiki import GlycoMotifWiki, GlyTouCanMotif
w = GlycoMotifWiki()

import findpygly
from pygly.GlycanResource import GlyTouCan

gtc = GlyTouCan(usecache=False)

current = set()
for m, l, re in sorted(gtc.allmotifs()):
    motif = GlyTouCanMotif(accession=m,
                           prefname=l,
                           name=l,
                           redend=re,
                           wurcs=gtccache.gtc2wurcs(m),
                           glycoct=gtccache.gtc2glycoct(m))
    if w.update(motif):
        print >> sys.stderr, m
    current.add(m)

for m in w.itermotif(collection=GlyTouCanMotif):
    if m.get('accession') not in current:
        print >> sys.stderr, "Deleting:", m.get('pagename')
        w.delete(m.get('pagename'))