28 #include "boost/filesystem/path.hpp" 29 #include "boost/filesystem/fstream.hpp" 36 namespace bfs = boost::filesystem;
100 818.9136, 13756.5684,
101 818.9177, 18748.5176,
102 818.9217, 18208.9883,
103 818.9258, 12877.9766,
271 821.4019, 19850.8086,
272 821.4060, 46906.4688,
273 821.4100, 68569.3750,
274 821.4141, 68448.7812,
275 821.4182, 46811.6289,
276 821.4223, 19901.8672,
296 821.9047, 23122.4727,
297 821.9088, 47305.5195,
298 821.9128, 62059.1055,
299 821.9169, 55725.9336,
300 821.9210, 33587.5078,
301 821.9251, 11589.8770,
322 822.4080, 15413.5098,
323 822.4121, 23855.4492,
324 822.4162, 25214.1484,
325 822.4203, 19019.5293,
391 if (
os_) *
os_ <<
"test()\n" << flush;
410 initialEstimate.
mz = 821.92;
411 vector<PrecursorRecalculator::PrecursorInfo> result;
412 pr.
recalculate(testDataBegin_, testDataEnd_, initialEstimate, result);
423 if (
os_) *
os_ <<
"test2()\n" << flush;
442 initialEstimate.
mz = 821.92;
443 vector<PrecursorRecalculator::PrecursorInfo> result;
444 pr.
recalculate(testDataBegin_, testDataEnd_, initialEstimate, result);
454 vector<MZIntensityPair>
readData(
const bfs::path& filename)
458 bfs::ifstream is(filename);
459 if (!is)
throw runtime_error((
"[PrecursorRecalculatorDefaultTest::readData()] Unable to open file " + filename.string()).c_str());
470 encoder.
decode(encoded, data);
473 vector<MZIntensityPair> result(data.size()/2);
474 copy(data.begin(), data.end(),
reinterpret_cast<double*
>(&result[0]));
506 : mzInitialEstimate(_mzInitialEstimate),
508 chargeTrue(_chargeTrue)
523 vector<PrecursorRecalculator::PrecursorInfo> result;
524 pr.
recalculate(begin, end, initialEstimate, result);
529 for (vector<PrecursorRecalculator::PrecursorInfo>::const_iterator it=result.begin(), end=result.end(); it!=end; ++it)
530 *
os_ <<
" " << it->mz <<
" " << it->charge << endl;
540 if (
os_) *
os_ <<
"test5peptide()\n" << flush;
542 vector<MZIntensityPair> data =
readData(datadir /
"5peptide.b64");
571 vector<MZIntensityPair> data =
readData(filename);
620 int main(
int argc,
char* argv[])
626 bfs::path datadir =
".";
628 for (
int i=1; i<argc; i++)
630 if (!strcmp(argv[i],
"-v"))
636 datadir = bfs::path(argv[i]).branch_path();
void runTests(const bfs::path &datadir)
int main(int argc, char *argv[])
void validateRecalculation(const MZIntensityPair *begin, const MZIntensityPair *end, PrecursorRecalculatorDefault &pr, const TestInfo &testInfo)
static CalibrationParameters thermo_FT()
vector< MZIntensityPair > readData(const bfs::path &filename)
const size_t testDataSize_
#define unit_assert_equal(x, y, epsilon)
FT-specific implementation of PeakFamilyDetector.
TestInfo(double _mzInitialEstimate, double _mzTrue, int _chargeTrue)
void test5peptide(const bfs::path &datadir)
data::CalibrationParameters cp
const MZIntensityPair * testDataBegin_
The data point type of a mass spectrum.
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
virtual void recalculate(const MZIntensityPair *begin, const MZIntensityPair *end, const PrecursorInfo &initialEstimate, std::vector< PrecursorInfo > &result) const
encoding/decoding configuration
const MZIntensityPair * testDataEnd_
#define TEST_PROLOG(argc, argv)
void runSpecialTest(const bfs::path &filename, size_t pairCount, const TestInfo &testInfo)
boost::shared_ptr< PeakFamilyDetector > peakFamilyDetector
shared_ptr< PrecursorRecalculatorDefault > createPrecursorRecalculator_msprefix()
void decode(const char *encodedData, size_t len, std::vector< double > &result) const
decode text-encoded data as binary