MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / testFeatureXMLFile

Function testFeatureXMLFile

src/pyOpenMS/tests/unittests/test000.py:2047–2106  ·  view source on GitHub ↗

@tests: FeatureXMLFile FeatureXMLFile.__init__ FeatureXMLFile.load FeatureXMLFile.store FeatureXMLFile.getOptions FeatureXMLFile.setOptions FeatureXMLFile.loadSize FileHandler.__init__ FileHandler.loadFeature

()

Source from the content-addressed store, hash-verified

2045
2046@report
2047def testFeatureXMLFile():
2048 """
2049 @tests: FeatureXMLFile
2050 FeatureXMLFile.__init__
2051 FeatureXMLFile.load
2052 FeatureXMLFile.store
2053 FeatureXMLFile.getOptions
2054 FeatureXMLFile.setOptions
2055 FeatureXMLFile.loadSize
2056
2057 FileHandler.__init__
2058 FileHandler.loadFeature
2059 """
2060
2061 fm = pyopenms.FeatureMap()
2062 fm.setUniqueIds()
2063
2064 f = pyopenms.Feature()
2065 f.setMZ(200)
2066 f.setCharge(1)
2067 f.setRT(10)
2068 f.setIntensity(10000)
2069 f.setOverallQuality(10)
2070
2071 ch = pyopenms.ConvexHull2D()
2072 ch.setHullPoints(np.asarray([[8,199],[12,201]], dtype='f'))
2073 f.setConvexHulls([ch])
2074
2075 f.setMetaValue(b'mv1', 1)
2076 f.setMetaValue(b'mv2', 2)
2077
2078 f.setMetaValue('spectrum_native_id', 'spectrum=123')
2079 pep_id = pyopenms.PeptideIdentification()
2080 pep_id.insertHit(pyopenms.PeptideHit())
2081 f.setPeptideIdentifications([pep_id])
2082
2083 fm.push_back(f)
2084
2085 f.setMetaValue('spectrum_native_id', 'spectrum=124')
2086 fm.push_back(f)
2087
2088 assert len(fm.get_assigned_peptide_identifications()) == 2
2089 assert fm.get_df(meta_values='all').shape == (2, 16)
2090 assert fm.get_df(meta_values='all', export_peptide_identifications=False).shape == (2, 12)
2091
2092 assert pd.merge(fm.get_df(), pyopenms.peptide_identifications_to_df(fm.get_assigned_peptide_identifications()),
2093 on = ['feature_id', 'ID_native_id', 'ID_filename']).shape == (2,24)
2094
2095 fm = pyopenms.FeatureMap()
2096 pyopenms.FeatureXMLFile().load(os.path.join(os.environ['OPENMS_DATA_PATH'], 'examples/FRACTIONS/BSA1_F1_idmapped.featureXML'), fm)
2097
2098 assert pd.merge(fm.get_df(), pyopenms.peptide_identifications_to_df(fm.get_assigned_peptide_identifications()),
2099 on = ['feature_id', 'ID_native_id', 'ID_filename']).shape == (15,26)
2100
2101 fh = pyopenms.FeatureXMLFile()
2102 fh.store("test.featureXML", fm)
2103 fh.load("test.featureXML", fm)
2104

Callers

nothing calls this directly

Calls 15

setOverallQualityMethod · 0.95
setHullPointsMethod · 0.95
setConvexHullsMethod · 0.95
insertHitMethod · 0.95
loadFeaturesMethod · 0.95
FeatureMapMethod · 0.80
FeatureMethod · 0.80
ConvexHull2DMethod · 0.80
PeptideIdentificationMethod · 0.80
PeptideHitMethod · 0.80
FeatureXMLFileMethod · 0.80

Tested by

no test coverage detected