26#include "boost/filesystem/path.hpp"
27#include "boost/filesystem/fstream.hpp"
35namespace bfs = boost::filesystem;
53 {4, 122, 576.82, 139, 176.381, 0.9,
"",
"2 3"},
54 {6, 125, 785.72, 76, 333.224, 0.8,
"",
"2 3"},
55 {2, 120, 508.95, 82, 261.342, 0.7,
"",
"2 3"}
63 spec_info->SpectrumInfo::update(*s,
true);
79 *
os_ <<
"spectrum index: " << spec_info->
index <<
"\t"
80 <<
"scan number: " << spec_info->
scanNumber <<
"\t"
81 <<
"level: " << spec_info->
msLevel <<
"\t";
83 *
os_ <<
"precursor mz: " << spec_info->
precursors[0].mz <<
"\t";
85 *
os_ <<
"num peaks: " << spec_info->
data.size() <<
"\t"
86 <<
"first peak mz: " << spec_info->
data.at(0).mz <<
"\t"
87 <<
"intenisity: " << spec_info->
data.at(0).intensity <<
"\t"
88 <<
"possible charges: ";
101 size_t numChargeStates = 0;
125void test(
const bfs::path& datadir,
int msLevel)
127 if (
os_) *
os_ <<
"test()\n";
134 }
else if (msLevel == 2) {
140 cerr <<
"Invalid MS level." << endl;
145 size_t indexes[] = {4, 6, 2};
146 size_t num_spec =
sizeof(indexes)/
sizeof(
size_t);
149 vector<string>::const_iterator file_it =
filenames.begin();
150 for (; file_it !=
filenames.end(); ++file_it)
152 string filename = *file_it;
153 MSDataFile data_file((datadir / filename).
string());
162 <<
" in " << filename << endl;
166 for (
size_t i=0; i<num_spec; i++)
168 SpectrumPtr cur_spec = all_spectra->spectrum(indexes[i],
true);
175 *
os_ <<
"Use scan numbers to get the same spec." << endl;
178 size_t scan_nums[] = {122, 125, 120};
179 num_spec =
sizeof(scan_nums)/
sizeof(
size_t);
180 for (
size_t i=0; i<num_spec; i++)
182 string id_str =
"scan=" + boost::lexical_cast<string>(scan_nums[i]);
185 *
os_ <<
"Looking for the " << i <<
"th scan num, " << scan_nums[i]
186 <<
", id " << id_str << endl;
189 size_t found_index = all_spectra->find(id_str);
192 *
os_ <<
"found_index = " << found_index << endl;
195 if (found_index == all_spectra->size())
199 *
os_ <<
"Not found." << endl;
204 SpectrumPtr cur_spec = all_spectra->spectrum(found_index,
true);
211int main(
int argc,
char* argv[])
217 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
219 std::string srcparent(__FILE__);
220 size_t pos = srcparent.find((bfs::path(
"pwiz") /
"data").
string());
221 srcparent.resize(pos);
223 bfs::path example_data_dir = srcparent +
"example_data/";
224 test(example_data_dir, 1);
225 test(example_data_dir, 2);
int main(int argc, char *argv[])
const TestSpectrumInfo testSpectrum[]
void checkSpectrumInfo(SpectrumPtr s, size_t idx, int msLevel)
MS_possible_charge_state
possible charge state: A possible charge state of the ion in a situation where the charge of an ion i...
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged.
boost::shared_ptr< SpectrumList > SpectrumListPtr
boost::shared_ptr< Spectrum > SpectrumPtr
represents a tag-value pair, where the tag comes from the controlled vocabulary
CVParam cvParam(CVID cvid) const
finds cvid in the container:
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
MSData object plus file I/O.
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
The method of precursor ion selection and activation.
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
simple structure for holding Spectrum info
std::vector< PrecursorInfo > precursors
std::vector< MZIntensityPair > data
#define unit_assert_equal(x, y, epsilon)
#define TEST_PROLOG(argc, argv)