예제 #1
0
            if it <= 0:
                continue
            trans.append((trid, it))
        trans.sort(key=lambda t: -t[1])
        pepid = data['trlib_pepid']
        z1 = data['trlib_z1']
        mz1 = data['trlib_mz1']
        extras = {}
        for key in ("intensity", "score", "extraction", "fdr"):
            if key in data:
                extras[key] = data[key]
        tg, mod = w.addtransgroup(peptide=pepid,
                                  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'])
예제 #2
0
                                      z1=z1,
                                      mz2=mz2,
                                      z2=z2)
        if modified:
            print t.get('id')

        if (pid, z1, spectra) not in tgroup:
            tgroup[(pid, z1, spectra)] = dict(transitions=[],
                                              nrt=nrt,
                                              rt=rt,
                                              mz1=mz1,
                                              scans=scans)
        tgroup[(pid, z1, spectra)]['transitions'].append((t.get('id'), relint))

    for pid, z1, spectra in tgroup:
        tgroup[(pid, z1, spectra)]['ntransition'] = len(
            tgroup[(pid, z1, spectra)]['transitions'])
        tg, mod = w.addtransgroup(peptide=pid,
                                  z1=z1,
                                  spectra=spectra,
                                  **tgroup[(pid, z1, spectra)])
        if mod:
            print tg.get('id')
        if tg.get('id') in spectra2tg[spectra]:
            spectra2tg[spectra].remove(tg.get('id'))

for spectra in allspectra:
    for tgid in spectra2tg[spectra]:
        print "Deleting transition group", tgid
        w.delete(tgid)