30#include "boost/filesystem/path.hpp"
38namespace bfs = boost::filesystem;
52 shared_ptr<PeakFinder> peakFinder(
new PeakFinder_SNR(noiseCalculator, pfsnrConfig));
58 return shared_ptr<PeakExtractor>(
new PeakExtractor(peakFinder, peakFitter));
75 const size_t spectrumCount = msdCache.size();
76 vector< vector<Peak> > result(spectrumCount);
78 for (
size_t index=0; index<spectrumCount; index++)
82 vector<Peak>& peaks = result[index];
88 *
os_ <<
"index: " << index << endl;
89 *
os_ <<
"peaks: " << peaks.size() << endl;
90 copy(peaks.begin(), peaks.end(), ostream_iterator<Peak>(*
os_,
"\n"));
108void print(ostream& os,
const string& label, vector<PeakelPtr> v)
110 os << label <<
":\n";
111 for (vector<PeakelPtr>::const_iterator it=v.begin(); it!=v.end(); ++it)
123 if (
os_)
print(*
os_,
"bombesin_2_0", bombesin_2_0);
127 if (
os_)
print(*
os_,
"bombesin_2_1", bombesin_2_1);
131 if (
os_)
print(*
os_,
"bombesin_2_2", bombesin_2_2);
135 if (
os_)
print(*
os_,
"bombesin_2_3", bombesin_2_3);
141 if (
os_)
print(*
os_,
"bombesin_3_0", bombesin_3_0);
145 if (
os_)
print(*
os_,
"bombesin_3_1", bombesin_3_1);
149 if (
os_)
print(*
os_,
"bombesin_3_2", bombesin_3_2);
169 const double mz_bomb2 = 810.415;
170 vector<FeaturePtr> bombesin_2_found = featureField.
find(mz_bomb2,
epsilon,
173 const Feature& bombesin_2 = *bombesin_2_found[0];
183 const double mz_bomb3 = 540.612;
184 vector<FeaturePtr> bombesin_3_found = featureField.
find(mz_bomb3,
epsilon,
187 const Feature& bombesin_3 = *bombesin_3_found[0];
199 if (
os_) *
os_ <<
"testBombesin()" << endl;
210 vector< vector<Peak> > peaks =
extractPeaks(msd, *peakExtractor);
216 peakelGrower->sowPeaks(peakelField, peaks);
218 if (
os_) *
os_ <<
"peakelField:\n" << peakelField << endl;
225 peakelPicker->pick(peakelField, featureField);
227 if (
os_) *
os_ <<
"featureField:\n" << featureField << endl;
232void test(
const bfs::path& datadir)
234 testBombesin((datadir /
"FeatureDetectorTest_Bombesin.mzML").
string());
238int main(
int argc,
char* argv[])
244 bfs::path datadir =
".";
246 for (
int i=1; i<argc; i++)
248 if (!strcmp(argv[i],
"-v"))
254 datadir = bfs::path(argv[i]).branch_path();
shared_ptr< PeakExtractor > createPeakExtractor()
shared_ptr< PeakelGrower > createPeakelGrower()
void testBombesin(const string &filename)
int main(int argc, char *argv[])
shared_ptr< PeakelPicker > createPeakelPicker()
void print(ostream &os, const string &label, vector< PeakelPtr > v)
void verifyBombesinFeatures(const FeatureField &featureField)
void verifyBombesinPeakels(const PeakelField &peakelField)
vector< vector< Peak > > extractPeaks(const MSData &msd, const PeakExtractor &peakExtractor)
simple memory cache for common MSData info
virtual void open(const DataInfo &dataInfo)
start analysis of the data
const SpectrumInfo & spectrumInfo(size_t index, bool getBinaryData=false)
access to SpectrumInfo with automatic update (open() must be called first)
PeakFinder implementation based on signal-to-noise ratio.
PeakFitter implementation based on fitting a parabola.
simple PeakelGrower implementation, based on proximity of Peaks
SetRetentionTime(double _rt)
void operator()(Peak &peak)
MZRTField is a std::set of boost::shared_ptrs, stored as a binary tree ordered by LessThan_MZRT.
std::vector< TPtr > find(double mz, MZTolerance mzTolerance, RTMatches matches) const
find all objects with a given m/z, within a given m/z tolerance, satisfying the 'matches' predicate
represents some generic metadata about a peak detected in a signal
size_t minMonoisotopicPeakelSize
predicate returns true iff the object's retention time range contains the specified retention time
std::vector< PeakelPtr > peakels
MSData object plus file I/O.
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
simple structure for holding Spectrum info
std::vector< MZIntensityPair > data
#define unit_assert_equal(x, y, epsilon)
#define TEST_PROLOG(argc, argv)