Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
DataMapInfo.cpp
Go to the documentation of this file.
1 
12 #include "stdafx.h"
13 #include "DataMapInfo.h"
14 
15 #include "DataGroupNode.h"
16 #include "Spectrum.h"
17 #include "DataSet.h"
18 #include "DataManager.h"
19 
20 #include <math.h>
21 
22 
23 using namespace kome::objects;
24 
25 
26 #include <crtdbg.h>
27 #ifdef _DEBUG
28  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
29  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
30 #endif // _DEBUG
31 
32 
33 
34 #define DEFAULT_MZ_ZERO_RANGE 0.2
35 #define DEFAULT_RT_ZERO_RANGE 1.0
36 
37 
38 // constructor
39 DataMapInfo::DataMapInfo( DataGroupNode& group, const unsigned int row, const unsigned int col ) {
40  // initialize
41  m_row = row;
42  m_group = &group;
43  m_col = col;
44 
45  // create map
46  unsigned int size = row * col;
47  if( size == 0 ) {
48  m_map = NULL;
49  }
50  else {
51  m_map = new double[ size ];
52  }
53 
54  // initialize
55  m_minMz = double();
56  m_maxMz = double();
57  m_minRt = double();
58  m_maxRt = double();
59  m_maxIntensity = double();
60  m_minIntensity = double();
61  m_autoCommit = true;
62  m_tmp = NULL;
63  m_completed = false;
64 }
65 
66 // destructor
68  // delete map
69  if( m_map != NULL ) {
70  delete[] m_map;
71  }
72 
73  // delete data map
74  deleteTmpData();
75 
76  // close
77  DataManager::closeDataMap( this, true );
78 }
79 
80 // get row size
81 unsigned int DataMapInfo::getRowSize() {
82  return m_row;
83 }
84 
85 // get column size
86 unsigned int DataMapInfo::getColSize() {
87  return m_col;
88 }
89 
90 // get spectrum group
92  return *m_group;
93 }
94 
95 // get sample
97  return m_group->getSample();
98 }
99 
100 // get min m/z
102  return m_minMz;
103 }
104 
105 // get max m/z
107  return m_maxMz;
108 }
109 
110 // get min RT
112  return m_minRt;
113 }
114 
115 // get max RT
117  return m_maxRt;
118 }
119 
120 // get min intenstiy
122  return m_minIntensity;
123 }
124 
125 // get max intensity
127  return m_maxIntensity;
128 }
129 
130 // get the intensity of the image map
131 double DataMapInfo::getIntensity( const unsigned int row, const unsigned int col ) {
132  int idx = row * m_col + col;
133 
134  return m_map[ idx ];
135 }
136 
137 // set completed flag
138 void DataMapInfo::setCompleted( const bool completed ) {
139  m_completed = completed;
140 }
141 
142 // get completed flag
144  return m_completed;
145 }
146 
147 // set intensity range
148 void DataMapInfo::setIntensityRange( const double minInt, const double maxInt ) {
149  m_minIntensity = minInt;
150  m_maxIntensity = maxInt;
151 }
152 
153 // get spectrum array
154 void DataMapInfo::getSpecArray( const char* filterName, std::vector< kome::objects::Spectrum* >& tmpSpecArray ){
155  // create temporary data
156  createTmpData();
157 
158  // data set
159  kome::objects::DataSet spectra;
160  m_group->getDataSet( &spectra );
161  spectra.sortSpectra();
162 
163  // create array
164  int specNum = (int)spectra.getNumberOfSpectra();
165 
166  // MS
167  if( strcmp( filterName, "ms" ) == 0 ){
168  for( int i = 0; i < specNum; i++ ) {
169  kome::objects::Spectrum* spec = spectra.getSpectrum( i );
170  if( spec->getMsStage() == 1 && spec->hasChromatogram() ) {
171  tmpSpecArray.push_back( spec );
172  }
173  }
174  // MS/MS
175  }else if( strcmp( filterName, "ms2" ) == 0 ){
176  for( int i = 0; i < specNum; i++ ) {
177  kome::objects::Spectrum* spec = spectra.getSpectrum( i );
178  if( spec->getMsStage() >= 2 && spec->hasChromatogram() ) {
179  tmpSpecArray.push_back( spec );
180  }
181  }
182  // All
183  }else if( strcmp( filterName, "all" ) == 0 ){
184  for( int i=0; i< specNum; i++ ){
185  kome::objects::Spectrum* spec = spectra.getSpectrum( i );
186  if( spec->hasChromatogram() ){
187  tmpSpecArray.push_back( spec );
188  }
189  }
190  }
191 }
192 
193 // set spectra
195  double minMz,
196  double maxMz,
197  double minRt,
198  double maxRt,
199  const char* filterName,
200  kome::core::Progress& progress
201 ) {
202  // @date 2012.09.07 <Mod> M.Izumi ->
203  std::vector< kome::objects::Spectrum* > tmpSpecArray;
204  getSpecArray( filterName, tmpSpecArray );
205  // @date 2012.09.07 <Mod> M.Izumi <-
206 
207  int specNum = (int)tmpSpecArray.size();
208 
209  // start index
210  int startIdx = 0;
211  if( minRt >= 0.0 ) {
212  for( int i = 0; i < specNum; i++ ) {
213  if( tmpSpecArray[ i ]->getRt() <= minRt ) {
214  startIdx = i;
215  }
216  }
217  }
218 
219  // end index
220  int endIdx = specNum - 1;
221  if( maxRt >= 0.0 ) {
222  for( int i = specNum - 1; i >= 0; i-- ) {
223  if( tmpSpecArray[ i ]->getRt() >= maxRt ) {
224  endIdx = i;
225  }
226  }
227  }
228 
229  int length = endIdx - startIdx + 1;
230 
231  // spectra
232  std::vector< kome::objects::Spectrum* > specArray;
233  for( int i = startIdx; i <= endIdx; i++ ) {
234  specArray.push_back( tmpSpecArray[ i ] );
235  }
236 
237  // check the data
238  if( length <= 0 ) { // There is no spectrum.
239  // set value
240  m_tmp->minMz = MAX( minMz, 0.0 );
241  m_tmp->maxMz = MAX( maxMz, 0.1 );
242  m_tmp->minRt = MAX( minRt, 0.0 );
243  m_tmp->maxRt = MAX( maxRt, 0.1 );
244  m_tmp->minIntensity = 0.0;
245  m_tmp->maxIntensity = 0.0;
246 
247  // progress
248  progress.setRange( 0, 1 );
249  progress.setPosition( 1 );
250 
251  // commit
252  if( m_autoCommit ) {
253  commit();
254  }
255 
256  // flag
257  m_completed = true;
258 
259  return true;
260  }
261 
262  // rt
263  m_tmp->minRt = minRt < 0.0 ? tmpSpecArray[ startIdx ]->getRt() : minRt;
264  m_tmp->maxRt = maxRt < 0.0 ? tmpSpecArray[ endIdx ]->getRt() : maxRt;
265 
266  // progress range
267  progress.setRange( 0, 6 * length );
268  progress.setPosition( 0 );
269 
270  // min m/z
271  if( minMz < 0.0 ) {
272  minMz = tmpSpecArray[ startIdx ]->getMinX();
273 
274  for( int i = startIdx + 1; i <= endIdx && !progress.isStopped(); i++ ) {
275  progress.setPosition( i - startIdx );
276  minMz = MIN( minMz, tmpSpecArray[ i ]->getMinX() );
277  }
278  }
279  progress.setPosition( length );
280 
281  // max m/z
282  if( maxMz < 0.0 ) {
283  maxMz = tmpSpecArray[ startIdx ]->getMaxX();
284 
285  for( int i = startIdx + 1; i < endIdx && !progress.isStopped(); i++ ) {
286  progress.setPosition( length + i - startIdx );
287  maxMz = MAX( maxMz, tmpSpecArray[ i ]->getMaxX() );
288  }
289  }
290 
291  if( !progress.isStopped() ) {
292  progress.setPosition( 2 * length );
293 
294  m_tmp->minMz = MIN( maxMz, minMz );
295  m_tmp->maxMz = MAX( maxMz, minMz );
296  double midMz = ( m_tmp->minMz + m_tmp->maxMz ) / 2.0;
297  m_tmp->minMz = std::min( midMz - 0.01, m_tmp->minMz );
298  m_tmp->maxMz = std::max( midMz + 0.01, m_tmp->maxMz );
299  }
300 
301  // create image map
302  if( !progress.isStopped() ) {
303  createImageMap( specArray, progress );
304  }
305 
306  // restore
307  if( progress.isStopped() ) {
308  rollback();
309  }
310 
311  // commit
312  if( m_autoCommit ) {
313  commit();
314  }
315 
316  // flag
317  m_completed = !progress.isStopped();
318 
319  return m_completed;
320 }
321 
322 // set auto commit flag
323 void DataMapInfo::setAutoCommit( const bool autoCommit ) {
324  m_autoCommit = autoCommit;
325 }
326 
327 // get auto commit flag
329  return m_autoCommit;
330 }
331 
332 // commit
334  // check the data
335  if( m_tmp == NULL ) {
336  return;
337  }
338 
339  // set values
340  m_minMz = m_tmp->minMz;
341  m_maxMz = m_tmp->maxMz;
342  m_minRt = m_tmp->minRt;
343  m_maxRt = m_tmp->maxRt;
344  m_minIntensity = m_tmp->minIntensity;
345  m_maxIntensity = m_tmp->maxIntensity;
346 
347  // map
348  int size = m_row * m_col;
349  if( size > 0 ) {
350  memcpy( m_map, m_tmp->intensities, sizeof( double ) * size );
351  }
352 
353  // delete data
354  deleteTmpData();
355 }
356 
357 // rollback
359  deleteTmpData();
360 }
361 
362 // save data map
363 bool DataMapInfo::saveDataMap( const char* path ) {
364  // file open
365  FILE* fp = fileopen( path, "wb" );
366  if( fp == NULL ) {
367  return false;
368  }
369 
370  // array size
371  const unsigned int size = m_row * m_col;
372 
373  // save
374  fwrite( &m_row, sizeof( m_row ), 1, fp );
375  fwrite( &m_col, sizeof( m_col ), 1, fp );
376  fwrite( &m_minMz, sizeof( m_minMz ), 1, fp );
377  fwrite( &m_maxMz, sizeof( m_maxMz ), 1, fp );
378  fwrite( &m_minRt, sizeof( m_minRt ), 1, fp );
379  fwrite( &m_maxRt, sizeof( m_maxRt ), 1, fp );
380  fwrite( &m_minIntensity, sizeof( m_minIntensity ), 1, fp );
381  fwrite( &m_maxIntensity, sizeof( m_maxIntensity ), 1, fp );
382 
383  if( size > 0 ) {
384  fwrite( m_map, sizeof( double ), size, fp );
385  }
386 
387  fflush( fp );
388  fclose( fp );
389 
390  return true;
391 }
392 
393 // load data
394 bool DataMapInfo::loadDataMap( const char* path ) {
395  // file open
396  FILE* fp = fileopen( path, "rb" );
397  if( fp == NULL ) {
398  return false;
399  }
400 
401  // array size
402  const unsigned int size = m_row * m_col;
403 
404  // load array size
405  unsigned int row = 0;
406  unsigned int col = 0;
407 
408  fread( &row, sizeof( row ), 1, fp );
409  fread( &col, sizeof( col ), 1, fp );
410 
411  if( row != m_row || col != m_col ) {
412  LOG_WARN( FMT( "Data Map size is different." ) );
413  fclose( fp );
414  return false;
415  }
416 
417  fread( &m_minMz, sizeof( m_minMz ), 1, fp );
418  fread( &m_maxMz, sizeof( m_maxMz ), 1, fp );
419  fread( &m_minRt, sizeof( m_minRt ), 1, fp );
420  fread( &m_maxRt, sizeof( m_maxRt ), 1, fp );
421  fread( &m_minIntensity, sizeof( m_minIntensity ), 1, fp );
422  fread( &m_maxIntensity, sizeof( m_maxIntensity ), 1, fp );
423 
424  if( size > 0 ) {
425  fread( m_map, sizeof( double ), size, fp );
426  }
427 
428  fclose( fp );
429 
430  return true;
431 }
432 
433 // create image map
435  std::vector< kome::objects::Spectrum* >& spectra,
436  kome::core::Progress& progress
437 ) {
438  // intensities array
439  double* prevInts = new double[ m_col ];
440  double* nowInts = new double[ m_col ];
441 
442  // initialize
443  m_tmp->minIntensity = 0.0;
444  m_tmp->maxIntensity = 0.1;
445 
446  // unit range (RT)
447  double unitRange = ( m_tmp->maxRt - m_tmp->minRt ) / (double)( m_row - 1 );
448  double rtZeroRange = DEFAULT_RT_ZERO_RANGE;
449  double prevRt = 0.0;
450  if( m_group->getNumberOfSpectra() > 0 ) {
451  prevRt = m_group->getSpectrum( 0 )->getRt() - rtZeroRange;
452  }
453  double prevScan = 0;
454  for( unsigned int i = 0; i < m_group->getNumberOfSpectra(); i++ ) {
456  rtZeroRange = std::max( rtZeroRange, fabs( spec->getRt() - prevRt ) );
457  prevRt = spec->getRt();
458  prevScan = spec->getScanNumber();
459  }
460 
461  // length
462  int length = (int)spectra.size();
463 
464  // create image map
465  int prevIdx = -1;
466  prevRt = -9999999.9;
467  for( unsigned int i = 0; i < spectra.size() && !progress.isStopped() ; i++ ) {
468  // spectrum
469  Spectrum* spec = spectra[ i ];
470 
471  progress.setStatus( FMT( "Getting spectrum data... [%s]", spec->getName() ).c_str() );
472  progress.setPosition( 2 * length + 4 * i );
473 
474  // intensities
475  getSpecIntensities( spec, nowInts, m_row );
476  if( spectra.size() == 1 ) {
477  prevRt = spec->getRt();
478  memcpy( prevInts, nowInts, sizeof( double ) * m_col );
479  }
480 
481  // intensity range
482  for( unsigned int j = 0; j < m_col; j++ ) {
483  if( nowInts[ j ] < m_tmp->minIntensity ) {
484  m_tmp->minIntensity = nowInts[ j ];
485  }
486  if( nowInts[ j ] > m_tmp->maxIntensity ) {
487  m_tmp->maxIntensity = nowInts[ j ];
488  }
489  }
490 
491  // get index
492  int idx = (int)m_row - 1;
493  if( spectra.size() > 1 ) {
494  idx = roundnum( ( spec->getRt() - m_tmp->minRt ) / unitRange );
495  }
496 
497  // set intensities
498  if( idx >= 0 && idx < (int)m_row ) {
499  if( idx == prevIdx ) {
500  for( unsigned int j = 0; j < m_col; j++ ) {
501  int ptIdx = idx * m_col + j;
502  double prevInt = m_tmp->intensities[ ptIdx ];
503  double nowInt = nowInts[ j ];
504 
505  if( fabs( nowInt ) > fabs( prevInt ) ) {
506  m_tmp->intensities[ ptIdx ] = nowInt;
507  }
508  }
509  }
510  else {
511  for( unsigned int j = 0; j < m_col; j++ ) {
512  int ptIdx = idx * m_col + j;
513  m_tmp->intensities[ ptIdx ] = nowInts[ j ];
514  }
515  }
516  }
517 
518  // interpolation
519  int sIdx = prevIdx + 1;
520  sIdx = MAX( 0, sIdx );
521  if( spec->getRt() <= prevRt + rtZeroRange ) { // linear interpolation
522  for( int j = sIdx; j < idx && j < (int)m_row; j++ ) {
523  double rt = m_tmp->minRt + (double)j * unitRange;
524 
525  double d1 = fabs( rt - prevRt );
526  double d2 = fabs( spec->getRt() - rt );
527  if( prevRt == spec->getRt() ) {
528  d1 = 1.0;
529  d2 = 0.0;
530  }
531  for( int k = 0; k < (int)m_col; k++ ) {
532  int ptIdx = j * m_row + k;
533  m_tmp->intensities[ ptIdx ] = ( d2 * prevInts[ k ] + d1 * nowInts[ k ] ) / ( d1 + d2 );
534  }
535  }
536  }
537  else { // insert zero
538  double zeroRange = std::min( ( spec->getRt() - prevRt ) / 2.5, rtZeroRange );
539 
540  for( int j = sIdx; j < idx && j < (int)m_row; j++ ) {
541  double rt = m_tmp->minRt + (double)j * unitRange;
542 
543  if( rt > spec->getRt() - zeroRange ) {
544  double d = rt - ( spec->getRt() - zeroRange );
545 
546  for( int k = 0; k < (int)m_col; k++ ) {
547  int ptIdx = j * m_col + k;
548  m_tmp->intensities[ ptIdx ] = ( d * nowInts[ k ] ) / zeroRange;
549  }
550  }
551  else if( rt < prevRt + zeroRange ) {
552  double d = zeroRange - fabs( rt - prevRt );
553 
554  for( int k = 0; k < (int)m_col; k++ ) {
555  int ptIdx = j * m_col + k;
556  m_tmp->intensities[ ptIdx ] = ( d * prevInts[ k ] ) / zeroRange;
557  }
558  }
559  else {
560  for( int k = 0; k < (int)m_col; k++ ) {
561  int ptIdx = j * m_col + k;
562  m_tmp->intensities[ ptIdx ] = 0.0;
563  }
564  }
565  }
566  }
567 
568  // set previous
569  prevIdx = idx;
570  prevRt = spec->getRt();
571  memcpy( prevInts, nowInts, sizeof( double ) * m_row );
572  }
573 
574  // delete array
575  delete[] prevInts;
576  delete[] nowInts;
577 
578  // check progress
579  if( progress.isStopped() ) {
580  return;
581  }
582 
583  // log
584  LOG_DEBUG(
585  FMT(
586  "Data Map : mz=[%.2f, %.2f] RT=[%.2f, %.2f] Int=[%.2f, %.2f]",
587  m_tmp->minMz,
588  m_tmp->maxMz,
589  m_tmp->minRt,
590  m_tmp->maxRt,
591  m_tmp->minIntensity,
592  m_tmp->maxIntensity
593  )
594  );
595 
596  // progress
597  progress.fill();
598 }
599 
600 // get spectrum intensities
602  Spectrum* spec,
603  double* intensities,
604  int size
605 ) {
606  // variables
608 
609  // initialize
610  for( int i = 0; i < size; i++ ) {
611  intensities[ i ] = 0.0;
612  }
613 
614  // unit range (m/z)
615  double unitRange = ( m_tmp->maxMz - m_tmp->minMz ) / (double)( size - 1 );
616  double mzZeroRange = std::max( DEFAULT_MZ_ZERO_RANGE, spec->getResolution() );
617 
618  // get point index
619  int mzStartIdx = 0;
620  int mzEndIdx = 0;
621  int length = 0;
622 
623  // get points
624  pt.clearPoints();
625  spec->getXYData( &pt, m_tmp->minMz - mzZeroRange, m_tmp->maxMz + mzZeroRange, false );
626 
627  length = (int)pt.getLength();
628  mzStartIdx = pt.searchIndex( m_tmp->minMz );
629  mzEndIdx = pt.searchIndex( m_tmp->maxMz );
630 
631  if( mzStartIdx < 0 ) {
632  mzStartIdx = - mzStartIdx - 2;
633  mzStartIdx = MAX( 0, mzStartIdx );
634  }
635  if( mzEndIdx < 0 ) {
636  mzEndIdx = - mzEndIdx - 1;
637  mzEndIdx = MIN( length - 1, mzEndIdx );
638  }
639 
640  // get data points
641  int prevIdx = -1;
642  double prevMz = -9999999.9;
643  double prevInt = 0.0;
644  for( int i = mzStartIdx; i <= mzEndIdx + 1; i++ ) {
645  // get point
646  double x = 0.0;
647  double y = 0.0;
648  if( i <= mzEndIdx ) {
649  x = (double)pt.getX( i );
650  y = (double)pt.getY( i );
651  }
652  else {
653  x = std::max( m_tmp->maxMz, prevMz + 1.0 );
654  }
655 
656  // get index
657  int idx = roundnum( (double)( x - m_tmp->minMz ) / unitRange );
658 
659  // set intensity
660  if( idx >= 0 && idx < size ) {
661  if( idx == prevIdx ) {
662  if( fabs( y ) > fabs( intensities[ idx ] ) ) {
663  intensities[ idx ] = y;
664  }
665  }
666  else{
667  intensities[ idx ] = y;
668  }
669  }
670 
671  // interpolation
672  int sIdx = prevIdx + 1;
673  sIdx = MAX( 0, sIdx );
674  if( x <= prevMz + mzZeroRange ) { // linear interpolation
675  for( int j = sIdx; j < idx && j < size; j++ ) {
676  double mz = m_tmp->minMz + (double)j * unitRange;
677 
678  double d1 = fabs( mz - prevMz );
679  double d2 = fabs( x - mz );
680 
681  intensities[ j ] = ( d2 * prevInt + d1 * y ) / ( d1 + d2 );
682  }
683  }
684  else { // insert zero
685  double zeroRange = std::min( ( x - prevMz ) / 2.5, mzZeroRange );
686 
687  for( int j = sIdx; j < idx && j < size; j++ ) {
688  double mz = m_tmp->minMz + (double)j * unitRange;
689 
690  if( mz > x - zeroRange ) {
691  double d = mz - ( x - zeroRange );
692 
693  intensities[ j ] = ( d * y ) / zeroRange;
694  }
695  else if( mz < prevMz + zeroRange ) {
696  double d = zeroRange - fabs( mz - prevMz );
697 
698  intensities[ j ] = ( d * prevInt ) / zeroRange;
699  }
700  else {
701  intensities[ j ] = 0.0;
702  }
703  }
704  }
705 
706  // previous
707  prevIdx = idx;
708  prevMz = x;
709  prevInt = y;
710  }
711 }
712 
713 // creates temporary data
715  // delete data
716  deleteTmpData();
717 
718  // create
719  m_tmp = (TmpData*)malloc( sizeof( TmpData ) );
720 
721  // set values
722  m_tmp->minMz = double();
723  m_tmp->maxMz = double();
724  m_tmp->minRt = double();
725  m_tmp->maxRt = double();
726  m_tmp->minIntensity = double();
727  m_tmp->maxIntensity = double();
728 
729  // array
730  unsigned int size = m_row * m_col;
731  if( size > 0 ) {
732  m_tmp->intensities = new double[ size ];
733  for( unsigned int i = 0; i < size; i++ ) {
734  m_tmp->intensities[ i ] = 0.0;
735  }
736  }
737  else {
738  m_tmp->intensities = NULL;
739  }
740 }
741 
742 // delete temporary data
744  // check the member
745  if( m_tmp == NULL ) {
746  return;
747  }
748 
749  // delete array
750  if( m_tmp->intensities != NULL ) {
751  delete[] m_tmp->intensities;
752  }
753 
754  // delete data
755  free( m_tmp );
756 
757  // set NULL
758  m_tmp = NULL;
759 }
760 
761 // compare to sort
762 bool DataMapInfo::lessSpec( Spectrum* spec0, Spectrum* spec1 ) {
763  return ( spec0->getRt() < spec1->getRt() );
764 }
static void closeDataMap(DataMapInfo *dataMap, const bool deleting)
This method is called when a data map is closed.
group of spectrum management class
Definition: DataGroupNode.h:33
data points data of profile management class
Definition: DataPoints.h:25
DataMapInfo(DataGroupNode &group, const unsigned int row, const unsigned int col)
constructor
Definition: DataMapInfo.cpp:39
virtual ~DataMapInfo()
destructor
Definition: DataMapInfo.cpp:67
void getDataSet(DataSet *dataSet)
gets spectra that contains this group. (getSpectrum method cannot get spectra that belong to child gr...
void createTmpData()
creates temporary data
double getRt()
gets retention time
Definition: Spectrum.cpp:184
void fill()
sets end position
Definition: Progress.cpp:206
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
const char * getName()
gets spectrum name
Definition: Spectrum.cpp:123
double getMinMz()
gets min m/z
sample information management class
Definition: Sample.h:34
double getMaxIntensity()
gets max intensity
Sample * getSample()
gets sample
Definition: DataMapInfo.cpp:96
void createImageMap(std::vector< kome::objects::Spectrum * > &spectra, kome::core::Progress &progress)
creates image map
void setCompleted(const bool completed)
sets completed flag
bool loadDataMap(const char *path)
loads data map
void clearPoints()
clear all data points
Definition: XYData.cpp:137
void rollback()
rollback data
unsigned int getNumberOfSpectra()
gets the number of spectra
Definition: DataSet.cpp:128
double getMinIntensity()
gets min intensity
bool isStopped()
judges whether it has to finish
Definition: Progress.cpp:199
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
interfaces of Spectrum class
int roundnum(const double v)
gets the closest integer to the argument
double getMaxRt()
gets max RT
double getResolution()
gets resolution
Definition: Spectrum.cpp:952
progress display abstract class
Definition: Progress.h:31
void getSpecArray(const char *filterName, std::vector< kome::objects::Spectrum * > &tmpSpecArray)
get spectrum array
Spectrum * getSpectrum(const unsigned int index)
gets the number of spectra
Definition: DataSet.cpp:133
interfaces of DataGroupNode class
int getMsStage()
gets ms stage
Definition: Spectrum.cpp:634
void setPosition(const int pos, const bool bForced=false)
sets progress position
Definition: Progress.cpp:98
interfaces of DataSet class
static bool lessSpec(Spectrum *spec0, Spectrum *spec1)
compare RT of spectrum to sort
int getScanNumber()
gets scan number
Definition: Spectrum.cpp:915
double getMaxMz()
gets max m/z
void deleteTmpData()
deletes temporary data
interfaces of GraphInfo class
#define MIN(x, y)
Definition: CoreMacros.h:30
DataGroupNode & getGroup()
gets raw data
Definition: DataMapInfo.cpp:91
#define NULL
Definition: CoreMacros.h:18
double getIntensity(const unsigned int row, const unsigned int col)
gets the intensity of the image map
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
FILE * fileopen(const char *path, const char *mode)
opens file
virtual void sortSpectra()
sorts spectra in retention time order
Definition: DataSet.cpp:155
void setIntensityRange(const double minInt, const double maxInt)
sets intensity range
#define MAX(x, y)
Definition: CoreMacros.h:27
void setAutoCommit(const bool autoCommit)
sets auto commit flag
bool setRange(double minMz, double maxMz, double minRt, double maxRt, const char *filterName, kome::core::Progress &progress)
sets data map range
DataGroupNode * m_group
Definition: DataMapInfo.h:54
void commit()
commit data
void getSpecIntensities(Spectrum *spec, double *intensities, int size)
gets intensities of spectrum
spectrum information management class
Definition: Spectrum.h:30
one or more spectra management class
Definition: DataSet.h:31
Sample * getSample()
gets sample
Definition: DataSet.cpp:49
unsigned int getRowSize()
gets row size
Definition: DataMapInfo.cpp:81
unsigned int getColSize()
gets column size
Definition: DataMapInfo.cpp:86
bool isAutoCommit()
gets auto commit flag
void setStatus(const char *status, const bool bForced=false)
sets status
Definition: Progress.cpp:160
bool isCompleted()
gets completed flag
interfaces of DataManager class
void setRange(const int start, const int end)
sets progress range
Definition: Progress.cpp:79
int searchIndex(const double x)
searches index of specified x value.
Definition: XYData.cpp:276
double getMinRt()
gets min RT
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216
bool saveDataMap(const char *path)
saves data map
bool hasChromatogram()
judges whether this spectrum has chromatogram
Definition: Spectrum.cpp:888