Mass++ mzML IO Plugin v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
kome::io::mzml::MzmlHandler Class Reference

XML handler class to read mzML file. More...

#include <MzmlHandler.h>

Inheritance diagram for kome::io::mzml::MzmlHandler:
Inheritance graph
[legend]
Collaboration diagram for kome::io::mzml::MzmlHandler:
Collaboration graph
[legend]

Classes

struct  SpecInfo
 spectrum information More...
 

Public Member Functions

 MzmlHandler (MzmlSample &file)
 constructor More...
 
virtual ~MzmlHandler ()
 destructor
 

Protected Types

enum  ArrayType { TYPE_OTHER, TYPE_MZ, TYPE_RT, TYPE_INT }
 array data type
 

Protected Member Functions

SpecInfogetSpecInfo (const char *name)
 gets the spectrum information More...
 
void setSpecInfo (kome::objects::Spectrum *spec, SpecInfo *info)
 sets the spectrum information More...
 
virtual void onStartDocument ()
 This method is called by startDocument method. (override method)
 
virtual void onEndDocument ()
 This method is called by endDocument method. (override method)
 
virtual void onStartElement (const char *name, kome::core::Properties &attrs)
 This method is called by startElement method. (override method) More...
 
virtual void onEndElement (const char *name, const char *text)
 This method is called by end element method. (override method) More...
 

Protected Attributes

MzmlSamplem_file
 
Accessionm_machineAcc
 
Accessionm_arrAcc
 
Accessionm_specAcc
 
Accessionm_softwareAcc
 
long long m_pos
 
MzmlSpectrumm_currSpec
 
MzmlChromatogramm_currChrom
 
ArrayType m_currType
 
MzmlSample::ArrayInfo m_arrayInfo
 
int m_scanNum
 
std::map< std::string, SpecInfom_specMap
 
SpecInfom_currSpecInfo
 
std::string m_currSoftwareName
 
std::string m_currSoftwareVersion
 
bool m_inIonTag
 
bool m_inPrecursor
 
bool m_inProduct
 
std::map< std::string,
MzmlSpectrum * > 
m_specIdMap
 
std::map< int, MzmlSpectrum * > m_specScanMap
 
std::map< std::string,
MzmlChromatogram * > 
m_chromIdMap
 
int m_offsetScan
 
std::string m_offsetId
 

Detailed Description

XML handler class to read mzML file.

Definition at line 33 of file MzmlHandler.h.

Constructor & Destructor Documentation

kome::io::mzml::MzmlHandler::MzmlHandler ( MzmlSample file)

constructor

Parameters
filemzML file object

Definition at line 78 of file MzmlHandler.cpp.

78  : m_file( file ) {
79  // initialize
81 
82  // accessions
84 
85  m_machineAcc = accManager.getAccession( MACHINE_ACC );
86  m_arrAcc = accManager.getAccession( ARRAY_ACC );
87  m_specAcc = accManager.getAccession( SPEC_TYPE_ACC );
88  m_softwareAcc = accManager.getAccession( SOFTWARE_ACC );
89 }
static AccessionManager & getInstance()
gets accession manager object (This is the only object.)
virtual void onStartDocument()
This method is called by startDocument method. (override method)
Accession * getAccession(const unsigned int idx)
gets accession
accession object management class

Here is the call graph for this function:

Member Function Documentation

SpecInfo * kome::io::mzml::MzmlHandler::getSpecInfo ( const char *  name)
protected

gets the spectrum information

Parameters
[in]namespectrum name
Returns
spectrum information

Definition at line 96 of file MzmlHandler.cpp.

96  {
97  // name
98  std::string n = trimstring( name );
99 
100  // spec info
101  bool iniFlg = ( m_specMap.find( n ) == m_specMap.end() );
102  SpecInfo* s = &( m_specMap[ n ] );
103 
104  // initialize
105  if( iniFlg ) {
106  s->stage = -1;
107  s->centroid = -1;
108  s->polarity = kome::objects::Spectrum::POLARITY_UNKNOWN;
109  s->mzLowerLimit = -1.0;
110  s->mzUpperLimit = -1.0;
111  s->tic = -1.0;
112  s->bpm = -1.0;
113  s->bpi = -1.0;
114  s->rt = -1.0;
115  s->prec = -1.0;
116  s->props.clear();
117  s->collisionEnergy.clear();
118  }
119 
120  return s;
121 }
std::map< std::string, SpecInfo > m_specMap
Definition: MzmlHandler.h:116
void kome::io::mzml::MzmlHandler::onEndElement ( const char *  name,
const char *  text 
)
protectedvirtual

This method is called by end element method. (override method)

Parameters
nametag name
textbody text

Definition at line 561 of file MzmlHandler.cpp.

561  {
562  // each tags
563  if( strcmp( name, SOFTWARE_TAG_NAME ) == 0 ) { // </software>
564  if( strlen( m_file.getSoftwareName() ) == 0 ) {
565  m_file.setSoftwareName( m_currSoftwareName.c_str() );
566  m_file.setSoftwareVersion( m_currSoftwareVersion.c_str() );
567  }
568  m_currSoftwareName.clear();
569  m_currSoftwareVersion.clear();
570  }
571  else if( strcmp( name, SPEC_TAG_NAME ) == 0 ) { // </spectrum>
572  m_currSpec = NULL;
573  }
574  else if( strcmp( name, CHROM_TAG_NAME ) == 0 ) { // </chromatogram>
575  if( m_currChrom != NULL ) {
576  double q1 = m_currChrom->getQ1();
577  double q3 = m_currChrom->getQ3();
578 
579  if( q1 >= 0.0 && q3 >= 0.0 ) {
580  m_currChrom->setIcon( "MRM_chrom" );
581  }
582  }
583  m_currChrom = NULL;
584  }
585  else if( strcmp( name, PARAM_GROUP_TAG_NAME ) == 0 ) { // </referenceableParamGroup>
586  if( m_currType != TYPE_OTHER ) {
588  m_arrayInfo.name.c_str(),
589  m_arrayInfo.bits,
590  m_arrayInfo.compressed,
591  m_arrayInfo.scale, m_arrayInfo.isY
592  );
593  }
594 
595  m_currSpecInfo = getSpecInfo( NULL );
596  }
597  else if( strcmp( name, ION_SELECTION_TAG_NAME ) == 0 ) { // </ionSelection>
598  m_inIonTag = false;
599  }
600  else if( strcmp( name, PRECURSOR_TAG_NAME ) == 0 ) { // </precursor>
601  m_inPrecursor = false;
602  }
603  else if( strcmp( name, PRODUCT_TAG_NAME ) == 0 ) { // </product>
604  m_inProduct = false;
605  }
606  else if( strcmp( name, OFFSET_TAG_NAME ) == 0 ) { // </offset>
607  // offset
608  long long offset = toint64( text, 10, -1 );
609 
610  // get object
611  MzmlSpectrum* spec = NULL;
612  MzmlChromatogram* chrom = NULL;
613 
614  if( m_offsetScan >= 0 && m_specScanMap.find( m_offsetScan ) != m_specScanMap.end() ) {
615  spec = m_specScanMap[ m_offsetScan ];
616  }
617  if( m_specIdMap.find( m_offsetId ) != m_specIdMap.end() ) {
618  spec = m_specIdMap[ m_offsetId ];
619  }
620  if( m_chromIdMap.find( m_offsetId ) != m_chromIdMap.end() ) {
621  chrom = m_chromIdMap[ m_offsetId ];
622  }
623 
624  // set offset
625  if( spec != NULL ) {
626  spec->setOffset( offset );
627  }
628  if( chrom != NULL ) {
629  chrom->setOffset( offset );
630  }
631 
632  // initialize offset values
633  m_offsetScan = -1;
634  m_offsetId.clear();
635  }
636 
637  // position
638  m_pos = getPosition();
639 }
std::map< int, MzmlSpectrum * > m_specScanMap
Definition: MzmlHandler.h:143
MzmlChromatogram * m_currChrom
Definition: MzmlHandler.h:84
SpecInfo * getSpecInfo(const char *name)
gets the spectrum information
Definition: MzmlHandler.cpp:96
void setOffset(const long long offset)
sets data offset
MzmlSample::ArrayInfo m_arrayInfo
Definition: MzmlHandler.h:90
std::map< std::string, MzmlChromatogram * > m_chromIdMap
Definition: MzmlHandler.h:146
std::map< std::string, MzmlSpectrum * > m_specIdMap
Definition: MzmlHandler.h:140
std::string m_currSoftwareVersion
Definition: MzmlHandler.h:126
mzml sample spectrum class
mzml sample spectrum class
Definition: MzmlSpectrum.h:29
void setOffset(const long long offset)
sets data offset
void addArrayInfo(const char *name, const int bits, const bool compressed, const double scale, const bool isY)
adds array information
Definition: MzmlSample.cpp:83
MzmlSpectrum * m_currSpec
Definition: MzmlHandler.h:81

Here is the call graph for this function:

void kome::io::mzml::MzmlHandler::onStartElement ( const char *  name,
kome::core::Properties &  attrs 
)
protectedvirtual

This method is called by startElement method. (override method)

Parameters
nametag name
attrsattributes

Definition at line 198 of file MzmlHandler.cpp.

198  {
199  // each tags
200  if( strcmp( name, CVPARAM_TAG_NAME ) == 0 ) { // <cvParam>
201  const char* a = attrs.getStringValue( CV_ACC_ATTR_NAME, "" );
202  const char* n = attrs.getStringValue( CV_NAME_ATTR_NAME, "" );
203  const char* v = attrs.getStringValue( CV_VALUE_ATTR_NAME, "" );
204 
205  if( strcmp( a, "MS:1000511" ) == 0 ) { // ms level
206  int stage = toint( v, 10, 1 );
207  if( m_currSpec == NULL ) {
208  m_currSpecInfo->stage = stage;
209  }
210  else {
211  m_currSpec->setMsStage( stage );
212  }
213  }
214  else if( strcmp( a, "MS:1000521" ) == 0 ) { // 32-bit float
215  m_arrayInfo.bits = 32;
216  }
217  else if( strcmp( a, "MS:1000523" ) == 0 ) { // 64-bit float
218  m_arrayInfo.bits = 64;
219  }
220  else if( strcmp( a, "MS:1000576" ) == 0 ) { // no compression
221  m_arrayInfo.compressed = false;
222  }
223  else if( strcmp( a, "MS:1000574" ) == 0 ) { // zlib compression
224  m_arrayInfo.compressed = true;
225  }
226  else if( strcmp( a, "MS:1000127" ) == 0 ) { // centroid spectrum
227  if( m_currSpec == NULL ) {
228  m_currSpecInfo->centroid = 1;
229  }
230  else {
231  m_currSpec->setCentroidMode( true );
232  }
233  }
234  else if( strcmp( a, "MS:1000128" ) == 0 ) { // profile spectrum
235  if( m_currSpec == NULL ) {
236  m_currSpecInfo->centroid = 0;
237  }
238  else {
239  m_currSpec->setCentroidMode( false );
240  }
241  }
242  else if( strcmp( a, "MS:1000129" ) == 0 ) { // negative scan
243  if( m_currSpec == NULL ) {
244  m_currSpecInfo->polarity = kome::objects::Spectrum::POLARITY_NEGATIVE;
245  }
246  else {
247  m_currSpec->setPolarity( kome::objects::Spectrum::POLARITY_NEGATIVE );
248  }
249  }
250  else if( strcmp( a, "MS:1000130" ) == 0 ) { // positive scan
251  if( m_currSpec == NULL ) {
252  m_currSpecInfo->polarity = kome::objects::Spectrum::POLARITY_POSITIVE;
253  }
254  else {
255  m_currSpec->setPolarity( kome::objects::Spectrum::POLARITY_POSITIVE );
256  }
257  }
258  else if( strcmp( a, "MS:1000501" ) == 0 ) { // scan m/z lower limit
259  double lowMz = todouble( v, -1.0 );
260  if( m_currSpec == NULL ) {
261  m_currSpecInfo->mzLowerLimit = lowMz;
262  }
263  else {
264  m_currSpec->setMinX( lowMz );
265  }
266  }
267  else if( strcmp( a, "MS:1000500" ) == 0 ) { // scan m/z upper limit
268  double upMz = todouble( v, -1.0 );
269  if( m_currSpec == NULL ) {
270  m_currSpecInfo->mzUpperLimit = upMz;
271  }
272  else {
273  m_currSpec->setMaxX( upMz );
274  }
275  }
276  else if( strcmp( a, "MS:1000285" ) == 0 ) { // total ion current
277  double tic = todouble( v, -1.0 );
278  if( m_currSpec == NULL ) {
279  m_currSpecInfo->tic = tic;
280  }
281  else {
282  m_currSpec->setTotalIntensity( tic );
283  }
284  }
285  else if( strcmp( a, "MS:1000504" ) == 0 ) { // base peak m/z
286  double bpm = todouble( v, -1.0 );
287  if( m_currSpec == NULL ) {
288  m_currSpecInfo->bpm = bpm;
289  }
290  else {
291  m_currSpec->setBasePeakMass( bpm );
292  }
293  }
294  else if( strcmp( a, "MS:1000505" ) == 0 ) { // base peak intensity
295  double bpi = todouble( v, -1.0 );
296  if( m_currSpec == NULL ) {
297  m_currSpecInfo->bpi = bpi;
298  }
299  else {
300  m_currSpec->setMaxIntensity( bpi );
301  }
302  }
303  else if( strcmp( a, "MS:1000016" ) == 0 ) { // scan start time
304  double rt = todouble( v, -1.0 );
305  const char* unit = attrs.getStringValue( CV_UNIT_ATTR_NAME, "" );
306  if( strcmp( unit, "UO:0000031" ) != 0 ) { // second
307  rt /= 60.0;
308  }
309 
310  if( m_currSpec == NULL ) {
311  m_currSpecInfo->rt = rt;
312  }
313  else {
314  m_currSpec->setRt( rt );
315  m_currSpec->setHasChromatogram( true );
316  }
317  }
318  else if( strcmp( a, "MS:1000744" ) == 0 ) { // selected ion m/z
319  double prec = todouble( v, -1.0 );
320  if( m_currSpec == NULL ) {
321  m_currSpecInfo->prec = prec;
322  }
323  else {
324  m_currSpec->setPrecursor( prec );
325  }
326  }
327  else if( strcmp( a, "MS:1000512" ) == 0 ) { // filter string
328  if( m_currSpec == NULL ) {
329  m_currSpecInfo->props.push_back( std::make_pair( "Filter", v ) );
330  }
331  else {
332  m_currSpec->getProperties().setValue( "Filter", v );
333  }
334  }
335  else if( strcmp( a, "MS:1000040" ) == 0 ) { // m/z
336  double mz = todouble( v, -1.0 );
337  if( m_inIonTag && m_currSpec != NULL ) {
338  m_currSpec->setPrecursor( mz );
339  }
340  }
341  else if( strcmp( a, "MS:1000827" ) == 0 ) { // isolation window target m/z
342  if( m_currSpec != NULL || m_currSpecInfo != NULL ) { // spectrum
343  std::string name = "Isolation Window Target m/z";
344  if( m_inPrecursor ) {
345  name = "Precursor Target";
346  }
347  if( m_inProduct ) {
348  name = "Product Target";
349  }
350 
351  if( m_currSpec == NULL ) {
352  m_currSpecInfo->props.push_back( std::make_pair( name.c_str(), v ) );
353  }
354  else {
355  m_currSpec->getProperties().setValue( name.c_str(), v );
356  }
357  }
358 
359  if( m_currChrom != NULL ) { // chromatogram
360  double mz = todouble( v, -1.0 );
361  if( mz >= 0.0 ) {
362  if( m_inPrecursor ) {
363  m_currChrom->setQ1( mz );
364  }
365  else if( m_inProduct ) {
366  m_currChrom->setQ3( mz );
367  }
368  }
369  }
370  }
371  else if( strcmp( a, "MS:1000045" ) == 0 ) {
372  const char* unitId = attrs.getStringValue( "unitAccession", "" );
373  std::string ce = v;
374  if( strcmp( unitId, "UO:0000266" ) == 0 ) {
375  ce = FMT( "%s eV", v );
376  }
377  if( m_currSpec == NULL ) {
378  m_currSpecInfo->collisionEnergy = ce;
379  }
380  else {
381  m_currSpec->setCollisionEnergy( ce.c_str() );
382  }
383  }
384  else {
385  // accession
387  Accession* acc = accManager.getAccession( a );
388 
389  // parent
390  Accession* parent = ( acc == NULL ? NULL : acc->getOrigin() );
391 
392  // each accessions
393  if( parent == m_machineAcc ) { // machine name
394  m_file.setInstrument( n );
395  }
396  else if( parent == m_arrAcc ) { // array type
397  // unit scale size
398  const char* u = attrs.getStringValue( CV_UNIT_ATTR_NAME, "" );
399  m_arrayInfo.isY = false;
400 
401  // set type
402  if( strcmp( a, MZ_ARRAY_ACC ) == 0 ) {
403  m_currType = TYPE_MZ;
404  }
405  else if( strcmp( a, RT_ARRAY_ACC ) == 0 ) {
406  m_currType = TYPE_RT;
407  if( strcmp( u, "UO:0000031" ) != 0 ) { // second
408  m_arrayInfo.scale = 1.0 / 60.0;
409  }
410  }
411  else if( strcmp( a, INT_ARRAY_ACC ) == 0 ) {
412  m_currType = TYPE_INT;
413  m_arrayInfo.isY = true;
414  }
415  else {
416  m_currType = TYPE_OTHER;
417  }
418  }
419  else if( parent == m_specAcc ) { // spectrum type
420  if( m_currSpec == NULL ) {
421  m_currSpecInfo->props.push_back( std::make_pair( "Spectrum Type", n ) );
422  }
423  else {
424  m_currSpec->getProperties().setValue( "Spectrum Type", n );
425  }
426  }
427  else if( parent == m_softwareAcc ) { // software
428  m_currSoftwareName = acc->getName();
429  }
430  }
431  }
432  else if( strcmp( name, SRC_FILE_TAG_NAME ) == 0 ) { // <sourceFile>
433  // add source file
434  std::string file = attrs.getStringValue( SRC_FILE_ATTR_NAME, "" );
435  std::string location = attrs.getStringValue( SRC_LOC_ATTR_NAME, "" );
436 
437  if( !location.empty() ) {
438  if( location[ (int)location.length() - 1 ] != '/' ) {
439  location.append( "/" );
440  }
441  }
442  location.append( file );
443 
444  m_file.addParentFile( location.c_str() );
445  }
446  else if( strcmp( name, SOFTWARE_TAG_NAME ) == 0 ) { // <software>
447  m_currSoftwareName = attrs.getStringValue( SOFTWARE_ID_ATTR_NAME, "" );
448  m_currSoftwareVersion = attrs.getStringValue( SOFTWARE_VER_ATTR_NAME, "" );
449  }
450  else if( strcmp( name, PARAM_GROUP_TAG_NAME ) == 0 ) { // <referenceableParamGroup>
451  m_arrayInfo.name = attrs.getStringValue( PARAM_GROUP_ID_ATTR_NAME, "" );
452  m_arrayInfo.bits = 32;
453  m_arrayInfo.compressed = false;
454  m_arrayInfo.scale = 1.0;
455  m_arrayInfo.isY = false;
456 
457  m_currType = TYPE_OTHER;
458 
459  m_currSpecInfo = getSpecInfo( m_arrayInfo.name.c_str() );
460  }
461  else if( strcmp( name, SPEC_TAG_NAME ) == 0 ) { // <spectrum>
462  // spectrum
463  const char* id = attrs.getStringValue( SPEC_ID_ATTR_NAME, "Scan" );
464  m_currSpec = new MzmlSpectrum( &m_file, id );
465  m_specIdMap[ id ] = m_currSpec;
466  long long pos = m_pos;
467  if( pos > 0 ) {
468  m_currSpec->setOffset( pos );
469  }
470 
471  m_file.getRootDataGroupNode()->addSpectrum( m_currSpec );
472 
473  // default attributes
474  SpecInfo* dfSpec = getSpecInfo( NULL );
475  setSpecInfo( m_currSpec, dfSpec );
476 
477  // set attributes
478  int scanNum = attrs.getIntValue( SPEC_SCAN_NUM_ATTR_NAME, m_scanNum );
479  m_scanNum++;
480  m_currSpec->setScanNumber( scanNum );
481  m_specScanMap[ scanNum ] = m_currSpec;
482 
483  int stage = attrs.getIntValue( SPEC_MS_LEVEL_ATTR_NAME, dfSpec->stage );
484  if( stage >= 1 ) {
485  m_currSpec->setMsStage( stage );
486  }
487 
488  std::string strSpotID = attrs.getStringValue( "spotID", "" );
489  if ( !strSpotID.empty( ) )
490  {
491  m_currSpec->setSpotId( strSpotID.c_str( ) );
492  }
493  }
494  else if( strcmp( name, PRECURSOR_TAG_NAME ) == 0 ) { // <precursor>
495  // parent
496  const char* id = attrs.getStringValue( PREC_SPEC_ATTR_NAME, NULL );
497  kome::objects::Spectrum* parent = NULL;
498 
499  if( id != NULL && m_currSpec != NULL ) {
500  if( m_specIdMap.find( id ) != m_specIdMap.end() ) {
501  parent = m_specIdMap[ id ];
502  }
503 
504  m_currSpec->setParentSpectrum( parent );
505  }
506 
507  m_inPrecursor = true;
508  }
509  else if( strcmp( name, PRODUCT_TAG_NAME ) == 0 ) { // <product>
510  m_inProduct = true;
511  }
512  else if( strcmp( name, CHROM_TAG_NAME ) == 0 ) { // <chromatogram>
513  // chromatogram
514  const char* id = attrs.getStringValue( CHROM_ID_ATTR_NAME, "Chromatogram" );
516  m_currChrom->setName( id );
517  m_chromIdMap[ id ] = m_currChrom;
518 
519  m_file.getRootDataGroupNode()->addChromatogram( m_currChrom );
520  }
521  else if( strcmp( name, ION_SELECTION_TAG_NAME ) == 0 ) { // <ionSelection>
522  m_inIonTag = true;
523  }
524  else if( strcmp( name, USR_PARAM_TAG_NAME ) == 0 ) { // <userParam>
525  // name & value
526  std::string n = attrs.getStringValue( USR_PARAM_NAME_ATTR_NAME, "" );
527  std::string v = attrs.getStringValue( USR_PARAM_VAL_ATTR_NAME, "" );
528 
529  // SPEC No.86058 File Name is "Err!" @@date 2012.06.11 <Mod> M.Izumi ->
530  // properties
531  kome::core::Properties* props = &m_file.getRootDataGroupNode()->getProperties();
532  if( m_currSpec != NULL ) {
533  props = &m_currSpec->getProperties();
534  }
535  if( m_currChrom != NULL ) {
536  props = &m_currChrom->getProperties();
537  }
538 
539  // add
540  if( !n.empty() ) {
541  props->setValue( n.c_str(), v.c_str() );
542  }
543  // <- @date 2012.06.11 <Mod> M.Izum
544  }
545  else if( strcmp( name, OFFSET_TAG_NAME ) == 0 ) { // <offset>
546  m_offsetScan = attrs.getIntValue( OFFSET_SCAN_ATTR_NAME, -1 );
547  m_offsetId = attrs.getStringValue( OFFSET_IDREF_ATTR_NAME, "" );
548  }
549  else if( strcmp( name, REF_TAG_NAME ) == 0 ) { // <referenceableParamGroupRef>
550  std::string id = attrs.getStringValue( REF_REF_ATTR_NAME, "" );
551 
552  if( m_currSpec != NULL ) {
553  SpecInfo* info = getSpecInfo( id.c_str() );
554 
555  setSpecInfo( m_currSpec, info );
556  }
557  }
558 }
std::map< int, MzmlSpectrum * > m_specScanMap
Definition: MzmlHandler.h:143
static AccessionManager & getInstance()
gets accession manager object (This is the only object.)
MzmlChromatogram * m_currChrom
Definition: MzmlHandler.h:84
SpecInfo * getSpecInfo(const char *name)
gets the spectrum information
Definition: MzmlHandler.cpp:96
const char * getName()
gets accession name
Definition: Accession.cpp:57
Accession * getOrigin()
gets origin accesion
Definition: Accession.cpp:72
MzmlSample::ArrayInfo m_arrayInfo
Definition: MzmlHandler.h:90
std::map< std::string, MzmlChromatogram * > m_chromIdMap
Definition: MzmlHandler.h:146
Accession * getAccession(const unsigned int idx)
gets accession
std::map< std::string, MzmlSpectrum * > m_specIdMap
Definition: MzmlHandler.h:140
accession object management class
std::string m_currSoftwareVersion
Definition: MzmlHandler.h:126
mzml sample spectrum class
accession information class
Definition: Accession.h:24
mzml sample spectrum class
Definition: MzmlSpectrum.h:29
void setSpecInfo(kome::objects::Spectrum *spec, SpecInfo *info)
sets the spectrum information
void setOffset(const long long offset)
sets data offset
MzmlSpectrum * m_currSpec
Definition: MzmlHandler.h:81
void addParentFile(const char *path)
adds parent files
Definition: MzmlSample.cpp:43

Here is the call graph for this function:

void kome::io::mzml::MzmlHandler::setSpecInfo ( kome::objects::Spectrum *  spec,
SpecInfo info 
)
protected

sets the spectrum information

Parameters
[out]specspectrum object
[in]infospectrum information

Definition at line 124 of file MzmlHandler.cpp.

124  {
125  if( info->stage > 0 ) {
126  spec->setMsStage( info->stage );
127  }
128 
129  if( info->centroid == 0 || info->centroid == 1 ) {
130  spec->setCentroidMode( info->centroid == 1 );
131  }
132 
133  if( info->polarity != kome::objects::Spectrum::POLARITY_UNKNOWN ) {
134  spec->setPolarity( info->polarity );
135  }
136 
137  if( info->mzLowerLimit >= 0.0 ) {
138  spec->setMinX( info->mzLowerLimit );
139  }
140 
141  if( info->mzUpperLimit >= 0.0 ) {
142  spec->setMaxX( info->mzUpperLimit );
143  }
144 
145  if( info->tic >= 0.0 ) {
146  spec->setTotalIntensity( info->tic );
147  }
148 
149  if( info->bpi >= 0.0 ) {
150  spec->setMaxIntensity( info->bpi );
151  }
152 
153  if( info->prec >= 0.0 ) {
154  spec->setPrecursor( info->prec );
155  }
156 
157  if( !info->collisionEnergy.empty() ) {
158  spec->setCollisionEnergy( info->collisionEnergy.c_str() );
159  }
160 
161  for( unsigned int i = 0; i < info->props.size(); i++ ) {
162  spec->getProperties().setValue( info->props.at( i ).first.c_str(), info->props.at( i ).second.c_str() );
163  }
164 }

Member Data Documentation

Accession* kome::io::mzml::MzmlHandler::m_arrAcc
protected

array accession

Definition at line 57 of file MzmlHandler.h.

MzmlSample::ArrayInfo kome::io::mzml::MzmlHandler::m_arrayInfo
protected

current array information

Definition at line 90 of file MzmlHandler.h.

std::map< std::string, MzmlChromatogram* > kome::io::mzml::MzmlHandler::m_chromIdMap
protected

chromatogram ID map

Definition at line 146 of file MzmlHandler.h.

MzmlChromatogram* kome::io::mzml::MzmlHandler::m_currChrom
protected

current chromaotgram

Definition at line 84 of file MzmlHandler.h.

std::string kome::io::mzml::MzmlHandler::m_currSoftwareName
protected

current software name

Definition at line 123 of file MzmlHandler.h.

std::string kome::io::mzml::MzmlHandler::m_currSoftwareVersion
protected

current software version

Definition at line 126 of file MzmlHandler.h.

MzmlSpectrum* kome::io::mzml::MzmlHandler::m_currSpec
protected

current spectrum

Definition at line 81 of file MzmlHandler.h.

SpecInfo* kome::io::mzml::MzmlHandler::m_currSpecInfo
protected

current spectrum information

Definition at line 119 of file MzmlHandler.h.

ArrayType kome::io::mzml::MzmlHandler::m_currType
protected

current array type

Definition at line 87 of file MzmlHandler.h.

MzmlSample& kome::io::mzml::MzmlHandler::m_file
protected

mzML file

Definition at line 50 of file MzmlHandler.h.

bool kome::io::mzml::MzmlHandler::m_inIonTag
protected

in ion tag flag

Definition at line 130 of file MzmlHandler.h.

bool kome::io::mzml::MzmlHandler::m_inPrecursor
protected

in precursor

Definition at line 133 of file MzmlHandler.h.

bool kome::io::mzml::MzmlHandler::m_inProduct
protected

in product

Definition at line 136 of file MzmlHandler.h.

Accession* kome::io::mzml::MzmlHandler::m_machineAcc
protected

machine accession

Definition at line 54 of file MzmlHandler.h.

std::string kome::io::mzml::MzmlHandler::m_offsetId
protected

offset ID

Definition at line 152 of file MzmlHandler.h.

int kome::io::mzml::MzmlHandler::m_offsetScan
protected

offset scan number

Definition at line 149 of file MzmlHandler.h.

long long kome::io::mzml::MzmlHandler::m_pos
protected

position

Definition at line 66 of file MzmlHandler.h.

int kome::io::mzml::MzmlHandler::m_scanNum
protected

scan number

Definition at line 94 of file MzmlHandler.h.

Accession* kome::io::mzml::MzmlHandler::m_softwareAcc
protected

software accession

Definition at line 63 of file MzmlHandler.h.

Accession* kome::io::mzml::MzmlHandler::m_specAcc
protected

spectrum type accession

Definition at line 60 of file MzmlHandler.h.

std::map< std::string, MzmlSpectrum* > kome::io::mzml::MzmlHandler::m_specIdMap
protected

spectrum ID map

Definition at line 140 of file MzmlHandler.h.

std::map< std::string, SpecInfo > kome::io::mzml::MzmlHandler::m_specMap
protected

spectrum map

Definition at line 116 of file MzmlHandler.h.

std::map< int, MzmlSpectrum* > kome::io::mzml::MzmlHandler::m_specScanMap
protected

scan map

Definition at line 143 of file MzmlHandler.h.


The documentation for this class was generated from the following files: