File: create_testdata_flqt.py

package info (click to toggle)
openms 2.4.0-real-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 646,136 kB
  • sloc: cpp: 392,260; xml: 215,373; python: 10,976; ansic: 3,325; php: 2,482; sh: 901; ruby: 399; makefile: 141; perl: 85
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)