29 #include <boost/algorithm/string/split.hpp>
33 using namespace pwiz::util;
34 using namespace pwiz::analysis;
49 {0,9, 1,9, 2,9, 3,9, 4,9, 5,9, 6,9},
50 {0.1,9, 1.1,0, 2.1,1.5, 3.1,2, 4.1,1.5, 5.1,0, 6.1,9},
51 {-.1,9, .9,0, 1.9,3, 3.9,3, 4.9,0, 5.9,9, 6,0},
52 {0.1,9, 1.1,0, 2.1,1.5, 3.1,2, 4.1,1.5, 5.1,0, 6.1,9},
53 {0,9, 1,9, 2,9, 3,9, 4,9, 5,9, 6,9}
62 for (
size_t i=0; i<5; i++)
65 sl->spectra.push_back(spectrum);
67 spectrum->id =
"scan=" +
lexical_cast<
string>(18+(int)i);
68 spectrum->scanList.scans.push_back(
Scan());
95 <<
"indexApex: " << stats.
indexApex << endl;
106 shared_ptr<RegionAnalyzer> regionAnalyzer(
new RegionAnalyzer(config, *cache));
109 analyzers.push_back(cache);
110 analyzers.push_back(regionAnalyzer);
115 unit_assert(regionAnalyzer->spectrumStats().size() == 5);
117 if (
os_) *
os_ <<
"sumIntensity (max) (peak):\n";
119 vector<RegionAnalyzer::SpectrumStats>::const_iterator it =
120 regionAnalyzer->spectrumStats().begin();
121 if (
os_) *
os_ << *it << endl;
129 if (
os_) *
os_ << *it << endl;
137 if (
os_) *
os_ << *it << endl;
145 if (
os_) *
os_ << *it << endl;
153 if (
os_) *
os_ << *it << endl;
163 if (
os_) *
os_ << stats << endl;
177 std::vector<std::string> options;
178 std::vector<std::string> outputs;
180 boost::algorithm::split(options, delimiter_help, boost::algorithm::is_any_of(
"=|") );
182 for (
int n=1; n<(int)options.size(); n++)
184 std::ostringstream txtstream;
185 std::string delim = options[0] +
"=" + options[n];
186 if (
os_) *
os_ <<
"test with delimiter style " << delim <<
":\n";
188 if (
os_) *
os_ <<
"test index:\n";
192 config.
osDump = &txtstream;
193 config.
mzRange = make_pair(.5, 5.5);
197 if (
os_) *
os_ <<
"test scanNumber:\n";
201 config.
osDump = &txtstream;
202 config.
mzRange = make_pair(.5, 5.5);
206 if (
os_) *
os_ <<
"test retentionTime:\n";
210 config.
osDump = &txtstream;
211 config.
mzRange = make_pair(.5, 5.5);
212 config.
rtRange = make_pair(420.5, 423.5);
216 outputs.push_back(txtstream.str());
220 for (
int m=(
int)outputs.size();m-->1;)
225 for (
int mm=(
int)outputs.size();mm--;)
229 for (
int n=outputs[mm].size();n-->1;)
231 if ((outputs[mm][n]==
' ') && (outputs[mm][n-1]==
' '))
233 outputs[mm] = outputs[mm].substr(0,n-1)+outputs[mm].substr(n);
235 if ((outputs[mm][n]==
' ') && (outputs[mm][n-1]==
'\n'))
238 outputs[mm] = outputs[mm].substr(0,n-1)+outputs[mm].substr(n);
239 outputs[mm][n-1]=
'\n';
243 boost::algorithm::replace_all(outputs[mm],std::string(
"\t"),std::string(
" "));
244 boost::algorithm::replace_all(outputs[mm],std::string(
","),std::string(
" "));
247 for (
int delimtype=(
int)outputs.size();delimtype-->1;)
249 unit_assert(outputs[delimtype]==outputs[delimtype-1]);
254 int main(
int argc,
char* argv[])
260 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;