msrunSelectionXic.cpp 1.18 KB
Newer Older
Edlira Nano's avatar
Edlira Nano committed
1
/**
Edlira Nano's avatar
gui    
Edlira Nano committed
2
 * \file msrunSelectionXic.cpp
Edlira Nano's avatar
Edlira Nano committed
3
4
5
6
 * \date October 28, 2011
 * \author Edlira Nano
 */

Edlira Nano's avatar
gui    
Edlira Nano committed
7
#include "msrunSelectionXic.h"
Edlira Nano's avatar
Edlira Nano committed
8

Edlira Nano's avatar
gui    
Edlira Nano committed
9
10
11
12
MsrunSelectionXic::MsrunSelectionXic(const Msrun * msrun, 
				     const XicExtractionMethodBase * extraction_method,
				     const mcq_xic_type xic_type,
				     const QPen * style) :
Edlira Nano's avatar
Edlira Nano committed
13
14
15
16
17
18
19
20
21
  XicTreatment(style), 
  _msrun(msrun),
  _xic_extraction_method(extraction_method),
  _xic_type(xic_type)
{
  _quanti_item = new QuantiItemBase(_xic_extraction_method);
  
}

Edlira Nano's avatar
gui    
Edlira Nano committed
22
MsrunSelectionXic::~MsrunSelectionXic() {
Edlira Nano's avatar
Edlira Nano committed
23
24
25
26
27
28
29
  if (_quanti_item != 0) {
    delete _quanti_item;
    _quanti_item = 0;
  }
}

XicProfile *
Edlira Nano's avatar
gui    
Edlira Nano committed
30
MsrunSelectionXic::applyTreatment(XicProfile * xic_profile) {
Edlira Nano's avatar
Edlira Nano committed
31
32
33
34
35
  // extract XIC
  _msrun->prepareSpectraForQuantification(_xic_extraction_method);
  xicBase * current_xic = _msrun->extractXic(_xic_type, _quanti_item);
  
  if (current_xic == 0) {
Edlira Nano's avatar
gui    
Edlira Nano committed
36
    qDebug() << "MsrunSelectionXic null xic ";
Edlira Nano's avatar
Edlira Nano committed
37
38
39
40
41
42
43
44
45
46
47
  }
  
  XicProfile * result_xic_profile = new XicProfile();
  result_xic_profile->setRtVector(*(current_xic->getRetentionTimes()));
  result_xic_profile->setIntensityVector(*(current_xic->getIntensities()));
  
  delete (current_xic);
  _msrun.doneWithSpectra();
  
  return result_xic_profile;
}