30 #include "boost/filesystem/path.hpp"
33 using namespace pwiz::util;
34 using namespace pwiz::analysis;
35 using namespace pwiz::data;
36 using namespace pwiz::data::peakdata;
37 using namespace pwiz::msdata;
38 namespace 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"));
108 void 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;
232 void test(
const bfs::path& datadir)
234 testBombesin((datadir /
"FeatureDetectorTest_Bombesin.mzML").
string());
238 int 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();