Beispiel #1
0
from getwiki import GPTWiki, Glycan

import findpygly
from pygly.GlyTouCan import GlyTouCan

import os, sys, urllib, string
import Bio.SeqIO

gtc = GlyTouCan(usecache=True)
w = GPTWiki()
try:
    os.mkdir('../glycoct')
except OSError:
    pass

for gc in sorted(w.iterglycans(), key=lambda gc: gc.get('accession')):
    acc = gc.get('accession')
    topos = map(str.strip, map(str, gc.get('topo')))
    for tacc in topos:
        glycoct = gtc.getseq(tacc, 'glycoct')
        if not glycoct:
            gly = gtc.getGlycan(tacc)
            glycoct = gly.glycoct()
        f = open('../glycoct/' + acc + '.' + tacc + '.txt', 'w')
        f.write(glycoct)
        f.close()
        print >> sys.stderr, "Dump GlycoCT to %s.%s.txt" % (acc, tacc)
Beispiel #2
0
#!/bin/env python27

from getwiki import GPTWiki
import re

w = GPTWiki()

monos = "NHSF"
for gly in w.iterglycans():
    gsym = gly.get('sym')
    mcnt = {}
    for mono in monos:
        mcnt[mono] = 0
        m = re.search(mono + r'(\d+)', gsym)
        if m:
            mcnt[mono] = int(m.group(1))
        elif mono in gsym:
            mcnt[mono] = 1
    gly.set('nneuac', mcnt['S'])
    if w.put(gly):
        print gly.get('id')

for pep in w.iterpeptides():
    pepname = pep.get('name')
    pep.set('nox', pepname.count('[Ox]'))
    if w.put(pep):
        print pep.get('id')