File: create_testdata_flqt.py

package info (click to toggle)
openms 2.6.0%2Bcleaned1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 783,168 kB
  • sloc: cpp: 526,888; xml: 142,287; ansic: 54,252; python: 11,640; php: 2,454; sh: 1,137; ruby: 529; yacc: 403; perl: 85; lex: 74; makefile: 61
file content (33 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

import pyopenms
"""
Producing the test data for TOPP_FeatureLinkerUnlabeledQT_5 and TOPP_FeatureLinkerUnlabeledQT_6
"""

fmaps = [ pyopenms.FeatureMap() for i in range(3)]
pepids = []
pepseq = ["PEPTIDEA", "PEPTIDEK", "PEPTIDER"]
for s in pepseq:
    pepid = pyopenms.PeptideIdentification()
    hit = pyopenms.PeptideHit()
    hit.setSequence(pyopenms.AASequence.fromString(s, True))
    pepid.insertHit(hit)
    pepid.setIdentifier("Protein0")
    pepids.append(pepid)

protid = pyopenms.ProteinIdentification()
protid.setIdentifier("Protein0")
for i,fmap in enumerate(fmaps):
    fmap.setProteinIdentifications( [protid])
    # add 3 features to each map, but with a twist (adding different peptide ids to different maps)
    for k in range(3):
        f = pyopenms.Feature()
        f.setRT(300 + k*100 + i*10)
        f.setMZ(500 + k*0.001 + i*0.01)
        f.setIntensity(500 + i*100)
        f.setMetaValue("sequence", pepseq[ (i+k) % 3]) # easier viewing in TOPPView
        f.setPeptideIdentifications( [pepids[(i+k) % 3]] )
        fmap.push_back(f)
    pyopenms.FeatureXMLFile().store("output_%s.featureXML" % i, fmap)