Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
AlignedChromatogram.cpp
Go to the documentation of this file.
1 
12 #include "stdafx.h"
13 #include "AlignedChromatogram.h"
14 
15 
16 using namespace kome::operation;
17 
18 
19 #include <crtdbg.h>
20 #ifdef _DEBUG
21  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
22  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
23 #endif // _DEBUG
24 
25 
26 
27 // constructor
29  : kome::objects::Chromatogram( org.getSample() ), m_org( org ) {
30  // initialize
31  m_align = align;
32  if( m_align == NULL ) {
34  }
35 
37 }
38 
39 // destructor
41 }
42 
43 // on get xy data
45  // check the parameter
46  if( xyData == NULL ) {
47  return;
48  }
49 
50  // get xy data
52  m_org.getXYData( &dps, false );
53 
54  // add points
55  for( unsigned int i = 0; i < dps.getLength(); i++ ) {
56  const double x = m_align->convertRt( dps.getX( i ), m_org.getMz() );
57  const double y = dps.getY( i );
58 
59  xyData->addPoint( x, y );
60  }
61 }
62 
63 // on get spectra
65  kome::objects::DataSet& spectra,
66  const double startRt,
67  const double endRt,
68  const kome::objects::SearchType startSearch,
69  const kome::objects::SearchType endSearch
70 ) {
71  // get xy data
75 
76  m_org.getXYData( &dps0, false );
77  onGetXYData( &dps1 );
78 
79  // add aligned xy data
80  if( dps0.getLength() > 0 ) {
81  dps2.reserve( dps0.getLength() );
82  }
83 
84  for( unsigned int i = 0; i < dps0.getLength(); i++ ) {
85  dps2.addPoint( dps1.getX( 0 ), dps0.getX( i ) );
86  }
87 
88  // get org RT
89  const double orgStartRt = kome::numeric::Interpolation::linear( dps2, startRt );
90  const double orgEndRt = kome::numeric::Interpolation::linear( dps2, endRt );
91 
92  // get spectra
93  m_org.getSpectra( spectra, orgStartRt, orgEndRt, startSearch, endSearch );
94 }
95 
96 // on get mass
97 double AlignedChromatogram::onGetMass( const unsigned int index ) {
98  return m_org.getMass( index );
99 }
100 
101 // on get MS stage
102 int AlignedChromatogram::onGetMsStage( const unsigned int index ) {
103  return m_org.getMsStage( index );
104 }
105 
106 // on get precursor
107 double AlignedChromatogram::onGetPrecursor( const unsigned int index ) {
108  return m_org.getPrecursor( index );
109 }
alignment class
Definition: Alignment.h:26
virtual double onGetPrecursor(const unsigned int index)
This method is called by getPrecursor method (override method)
abstraction class of two dimention coordinate data
Definition: XYData.h:34
virtual double onGetMass(const unsigned int index)
This method is called by getMass method (override method)
data points data of profile management class
Definition: DataPoints.h:25
double convertRt(const double rt, const double mz)
gets aligned RT
Definition: Alignment.cpp:71
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
void setOrgChromatogram(Chromatogram *chrom)
sets original chromatogram
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
interfaces of AlignedChromatogram class
kome::core::XYData * getXYData()
gets xy data from data manager
#define NULL
Definition: CoreMacros.h:18
int getMsStage(const unsigned int index)
gets MS stage
kome::objects::Chromatogram & m_org
void getSpectra(DataSet &dataSet, const double startRt, const double endRt, const SearchType startSearch=SEARCH_NEAR, const SearchType endSearch=SEARCH_NEAR)
get spectra in specified RT range
SearchType
search type
void reserve(const unsigned int num)
reserves enough contiguous memory of array
Definition: XYData.cpp:262
double getPrecursor(const unsigned int index)
gets precursor mass
static Alignment & getDefaultAlignment()
gets default alignment
Definition: Alignment.cpp:119
Chromatogram * getOrgChromatogram()
gets original chromatogram
virtual int onGetMsStage(const unsigned int index)
This method is called by getMsStage method (override method)
one or more spectra management class
Definition: DataSet.h:31
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
virtual void onGetXYData(kome::core::XYData *const xyData)
This method is called by getXYData method (override method)
chromatogram information management class
Definition: Chromatogram.h:33
double getMass(const unsigned int index)
gets mass
virtual void onGetSpectra(kome::objects::DataSet &spectra, const double startRt, const double endRt, const kome::objects::SearchType startSearch, const kome::objects::SearchType endSearch)
This method is called by searchSpectrum or getDataSet method (overriede method)
AlignedChromatogram(kome::objects::Chromatogram &org, Alignment *align)
constructor
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216