26 #include "boost/filesystem/path.hpp" 27 #include "boost/filesystem/fstream.hpp" 35 namespace 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;
107 unit_assert(string::npos != testSpectrum[idx].possible_charges.find(param.
value));
125 void test(
const bfs::path& datadir,
int msLevel)
127 if (
os_) *
os_ <<
"test()\n";
131 filenames.push_back(
"10-spec.ms1");
132 filenames.push_back(
"10-spec.bms1");
133 filenames.push_back(
"10-spec.cms1");
134 }
else if (msLevel == 2) {
135 filenames.push_back(
"10-spec.ms2");
136 filenames.push_back(
"10-spec.bms2");
137 filenames.push_back(
"10-spec.bms2.gz");
138 filenames.push_back(
"10-spec.cms2");
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++)
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);
211 int main(
int argc,
char* argv[])
217 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
219 std::string buildparent(argv[0]);
220 size_t pos = buildparent.find(
"build");
221 if (string::npos==pos)
223 buildparent = __FILE__;
225 pos = buildparent.rfind(
"pwiz");
227 buildparent.resize(pos);
228 bfs::path example_data_dir = buildparent +
"example_data/";
229 test(example_data_dir, 1);
230 test(example_data_dir, 2);
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
CVParam cvParam(CVID cvid) const
finds cvid in the container:
The method of precursor ion selection and activation.
int main(int argc, char *argv[])
boost::shared_ptr< Spectrum > SpectrumPtr
#define unit_assert_equal(x, y, epsilon)
void test(const bfs::path &datadir, int msLevel)
float lexical_cast(const std::string &str)
const TestSpectrumInfo testSpectrum[]
std::vector< PrecursorInfo > precursors
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
boost::shared_ptr< SpectrumList > SpectrumListPtr
MSData object plus file I/O.
MS_possible_charge_state
possible charge state: A possible charge state of the ion in a situation where the charge of an ion i...
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. Subsidiary data arrays are also both described and attached here.
#define TEST_PROLOG(argc, argv)
void checkSpectrumInfo(SpectrumPtr s, size_t idx, int msLevel)
std::vector< MZIntensityPair > data
simple structure for holding Spectrum info
represents a tag-value pair, where the tag comes from the controlled vocabulary