import numpy as np
import getwiki
from analysis.fisher import lod, fisher_exact_low, fisher_exact_high
from transitionspecificity import specscore

w = GPTWiki()
trspec = {}
labelspec = {}
glycanlabelspec = {}
smallwindow = 1
largewindow = 6
threshold = 50
nonspeccount = 0
alltrs = set()

for tg in w.itertgs(acqtype='DIA'):
    pepid = tg.get('peptide')
    pepage = w.get(pepid)
    z1 = tg.get('z1')
    spectra = tg.get('spectra')

    if spectra.find('DIA') == -1:
        continue

    try:
        glycan = re.search('\[H(.)*?\]', pepage.get('name')).group(0)[1:-1]
    except:
        continue
    filename = pepid + '.' + str(z1) + '.50.json'
    onlinefile = 'http://edwardslab.bmcb.georgetown.edu/~nedwards/dropbox/pBYmLSkGeq/' + spectra + '/' + filename
예제 #2
0
from collections import defaultdict

nrtonly = False
if len(sys.argv) > 1 and sys.argv[1] == "nrtonly":
    nrtonly = True

w = GPTWiki()
seenpeps = set()
sites = set()
prot2site = defaultdict(set)
samples = set()
glycans = set()
glysites = set()
site2gly = defaultdict(set)
for sp in w.iterspec(type='DDA'):
    for tg in w.itertgs(spectra=sp.get('name')):
        tgid = tg.get('id')
        if tg.get('peptide') in seenpeps:
            continue
        pep = w.get(tg.get('peptide'))
        if nrtonly and pep.get('nrt') == None:
            continue
        seenpeps.add(pep.get('id'))
        gly = pep.get('glycan')[0][0]
        glycans.add(gly)
        for al in pep.get('alignments', []):
            site = al.get('prsites')
            prot = al.get('protein')
            print pep.get('id'), prot, site, gly
            sites.add((prot, site))
            prot2site[prot].add(site)
예제 #3
0
                                  z1=z1,
                                  spectra=spectra,
                                  mz1=mz1,
                                  nrt=nrt,
                                  rt=rt,
                                  prt=rt,
                                  transitions=trans,
                                  ntransition=len(trans),
                                  **extras)
        if 'lccalibration' in data and spectra not in lccal:
            nrtslope, nrtintercept = map(float,
                                         data['lccalibration'].split(":"))
            lccal[spectra]['nrtslope'] = nrtslope
            lccal[spectra]['nrtintercept'] = nrtintercept
        tgs[spectra].add(tg.get('id'))

for spectra in allspec:
    spec = w.get(spectra)
    if spectra in lccal:
        spec.set("nrtslope", lccal[spectra]['nrtslope'])
        spec.set("nrtintercept", lccal[spectra]['nrtintercept'])
    else:
        spec.delete("nrtslope")
        spec.delete("nrtintercept")
    w.put(spec)

    for tg in w.itertgs(spectra=spectra, all=True):
        if tg.get('id') not in tgs[spectra]:
            if w.cleartransgroup(tg):
                print "Clear", tg.get("id")
예제 #4
0
w = GPTWiki()

# if len(sys.argv) < 2:
#     print 'please enter the spectra file name regex'
#     exit(1)

for spectrapage in w.iterspec(acqtype="DDA"):
    # if not re.search(sys.argv[1],spectrapage.get('name')):
    #   continue
    print spectrapage.get('name')
    nrtslope = spectrapage.get('nrtslope')
    nrtintercept = spectrapage.get('nrtintercept')
    if not nrtslope or not nrtintercept:
        print "No NRT slope or intercept"
        continue
    for tgpage in w.itertgs(spectra=spectrapage.get('name')):
        tgid = tgpage.get('id')
        peakrt = tgpage.get('prt')
        nrt = 0.0

        if peakrt != None:
            nrt = (peakrt - nrtintercept) / nrtslope
            tgpage.set('nrt', nrt)
            if w.put(tgpage):
                print tgid
        else:
            tgpage.set('nrt', '')
            if w.put(tgpage):
                print tgid

def label2series(lab):
    return lab[0].lower()


w = GPTWiki()

peps = defaultdict(lambda: defaultdict(dict))

for sp in w.iterspec(sample=opts.sample,
                     acqtype=opts.acqtype,
                     method=opts.method,
                     inst=opts.inst):
    print >> sys.stderr, sp.get('name')
    for i, tg in enumerate(w.itertgs(spectra=sp.get('name'))):
        pep = w.get(tg.get('peptide'))
        pepid = pep.get('id')
        if pep.get('nrt') == None:
            continue
        z1 = tg.get('z1')
        ntrans = len(tg.get('transitions', []))
        if ntrans == 0:
            continue
        proteins = set()
        for al in pep.get("alignments", []):
            proteins.add(al.get("protein"))
        for trid, trint in tg.get('transitions', []):
            tr = w.get(trid)
            if trid not in peps[(pepid, z1)]:
                peps[(pepid, z1)][trid]['pepname'] = pep.get('name')
예제 #6
0
    data = json.loads(open(opts.cachefile).read())
    tgrows = data['tgrows']
    peprows = data['peprows']
    tgs = data['tgs']
    origpepnrt = data['pepnrt']
else:
    monos = "NHFS"
    tgs = dict()
    origpepnrt = dict()
    tgrows = []
    peprows = []
    pepseen = set()
    w = GPTWiki(quiet=True)
    for spec in w.iterspec(acqtype="DDA"):
        print spec.get("name")
        for tg in w.itertgs(spectra=spec.get("name")):
            pepid = tg.get('peptide')
            p = w.get(pepid)
            pepacc = p.get('id')
            pepseq = p.get('sequence')
            pepname = p.get('name')
            pepnrt = p.get('nrt')
            pepnrtobs = int(p.get('nrtobs', 0))
            if pepnrtobs == 0:
                pepnrt = None
            nrt = tg.get('nrt')
            if nrt is None and pepnrt is None:
                continue
            glyacc = p.get('glycan')[0][0]
            g = w.get(glyacc)
            gsym = g.get('sym')