ProteoWizard
Main Page
Namespaces
Classes
Files
File List
File Members
pwiz
analysis
calibration
Calibrator.hpp
Go to the documentation of this file.
1
//
2
// $Id: Calibrator.hpp 1191 2009-08-14 19:33:05Z chambm $
3
//
4
//
5
// Darren Kessner <darren@proteowizard.org>
6
//
7
// Copyright 2009 Spielberg Family Center for Applied Proteomics
8
// Cedars Sinai Medical Center, Los Angeles, California 90048
9
//
10
// Licensed under the Apache License, Version 2.0 (the "License");
11
// you may not use this file except in compliance with the License.
12
// You may obtain a copy of the License at
13
//
14
// http://www.apache.org/licenses/LICENSE-2.0
15
//
16
// Unless required by applicable law or agreed to in writing, software
17
// distributed under the License is distributed on an "AS IS" BASIS,
18
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
// See the License for the specific language governing permissions and
20
// limitations under the License.
21
//
22
23
24
#ifndef _CALIBRATOR_HPP_
25
#define _CALIBRATOR_HPP_
26
27
28
#include "
pwiz/data/misc/CalibrationParameters.hpp
"
29
#include <memory>
30
#include <vector>
31
#include <cmath>
32
33
34
namespace
pwiz {
35
namespace
calibration {
36
37
38
class
MassDatabase
;
39
class
MassSpread
;
40
41
42
/// Calibrates using EM algorithm using peptide mass database.
43
class
Calibrator
44
{
45
public
:
46
47
/// Structure for holding frequency-charge pairs.
48
struct
Measurement
49
{
50
double
frequency
;
51
int
charge
;
52
Measurement
(
double
f=0,
int
c=1) :
frequency
(f),
charge
(c) {}
53
bool
operator==
(
const
Measurement
& that)
const
{
return
frequency
==that.
frequency
&&
charge
==that.
charge
;}
54
};
55
56
/// Create an instance;
57
/// Log output can be suppressed by setting outputDirectory==""
58
static
std::auto_ptr<Calibrator>
create
(
const
MassDatabase
& massDatabase,
59
const
std::vector<Measurement>& measurements,
60
const
data::CalibrationParameters
& initialParameters,
61
double
initialErrorEstimate,
62
int
errorEstimatorIterationCount,
63
const
std::string& outputDirectory);
64
/// Perform a single iteration.
65
virtual
void
iterate
() = 0;
66
67
/// Return total number of iterations that have been performed.
68
virtual
int
iterationCount
()
const
= 0;
69
70
/// Return current estimate of calibration parameters.
71
virtual
const
data::CalibrationParameters
&
parameters
()
const
= 0;
72
73
/// Return number of measurements.
74
virtual
int
measurementCount
()
const
= 0;
75
76
/// Return requested measurement.
77
virtual
const
Measurement*
measurement
(
int
index)
const
= 0;
78
79
/// Return mass spread associated with the measurement.
80
virtual
const
MassSpread
*
massSpread
(
int
index)
const
= 0;
81
82
/// Return current error measurement.
83
virtual
double
error
()
const
= 0;
84
85
virtual
~Calibrator
(){}
86
};
87
88
89
}
// namespace calibration
90
}
// namespace pwiz
91
92
93
#endif // _CALIBRATOR_HPP_
94
Generated on Mon Nov 26 2012 18:05:46 for ProteoWizard by
1.8.1.1