本文整理汇总了C++中PeakMap::getNrSpectra方法的典型用法代码示例。如果您正苦于以下问题:C++ PeakMap::getNrSpectra方法的具体用法?C++ PeakMap::getNrSpectra怎么用?C++ PeakMap::getNrSpectra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PeakMap
的用法示例。
在下文中一共展示了PeakMap::getNrSpectra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cacheFile
CachedmzML cacheFile(std::string & tmp_filename, PeakMap& exp)
{
NEW_TMP_FILE(tmp_filename);
// Load experiment
MzMLFile().load(OPENMS_GET_TEST_DATA_PATH("MzMLFile_1.mzML"), exp);
TEST_EQUAL(exp.getNrSpectra() > 0, true)
TEST_EQUAL(exp.getNrChromatograms() > 0, true)
// Cache the experiment to a temporary file
CachedmzML cache;
cache.writeMemdump(exp, tmp_filename);
// Create the index from the given file
cache.createMemdumpIndex(tmp_filename);
return cache;
}
示例2: ifs_
{
delete ptr;
}
END_SECTION
// see also MSDataCachedConsumer_test.cpp -> consumeSpectrum
// this is a complete test of the caching object
START_SECTION(( [EXTRA] testCaching))
{
std::string tmp_filename;
NEW_TMP_FILE(tmp_filename);
// Load experiment
PeakMap exp;
MzMLFile().load(OPENMS_GET_TEST_DATA_PATH("MzMLFile_1.mzML"), exp);
TEST_EQUAL(exp.getNrSpectra() > 0, true)
TEST_EQUAL(exp.getNrChromatograms() > 0, true)
// Cache the experiment to a temporary file
CachedmzML cache;
cache.writeMemdump(exp, tmp_filename);
// Check whether spectra were written to disk correctly...
{
// Create the index from the given file
cache.createMemdumpIndex(tmp_filename);
std::vector<std::streampos> spectra_index = cache.getSpectraIndex();
TEST_EQUAL(spectra_index.size(), 4)
std::ifstream ifs_(tmp_filename.c_str(), std::ios::binary);
// retrieve the spectrum
示例3: pickExperiment
/**
* @brief Applies the peak-picking algorithm to a map (MSExperiment). This
* method picks peaks for each scan in the map consecutively. The resulting
* picked peaks are written to the output map.
*
* @param input input map in profile mode
* @param output output map with picked peaks
* @param boundaries_spec boundaries of the picked peaks in spectra
* @param boundaries_chrom boundaries of the picked peaks in chromatograms
* @param check_spectrum_type if set, checks spectrum type and throws an exception if a centroided spectrum is passed
*/
void PeakPickerHiRes::pickExperiment(const PeakMap& input, PeakMap& output,
std::vector<std::vector<PeakBoundary> >& boundaries_spec,
std::vector<std::vector<PeakBoundary> >& boundaries_chrom,
const bool check_spectrum_type) const
{
// make sure that output is clear
output.clear(true);
// copy experimental settings
static_cast<ExperimentalSettings &>(output) = input;
// resize output with respect to input
output.resize(input.size());
Size progress = 0;
startProgress(0, input.size() + input.getChromatograms().size(), "picking peaks");
if (input.getNrSpectra() > 0)
{
for (Size scan_idx = 0; scan_idx != input.size(); ++scan_idx)
{
if (ms_levels_.empty()) // auto mode
{
SpectrumSettings::SpectrumType spectrum_type = input[scan_idx].getType();
if (spectrum_type == SpectrumSettings::CENTROID)
{
output[scan_idx] = input[scan_idx];
}
else
{
std::vector<PeakBoundary> boundaries_s; // peak boundaries of a single spectrum
pick(input[scan_idx], output[scan_idx], boundaries_s);
boundaries_spec.push_back(boundaries_s);
}
}
else if (!ListUtils::contains(ms_levels_, input[scan_idx].getMSLevel())) // manual mode
{
output[scan_idx] = input[scan_idx];
}
else
{
std::vector<PeakBoundary> boundaries_s; // peak boundaries of a single spectrum
// determine type of spectral data (profile or centroided)
SpectrumSettings::SpectrumType spectrum_type = input[scan_idx].getType();
if (spectrum_type == SpectrumSettings::CENTROID && check_spectrum_type)
{
throw OpenMS::Exception::IllegalArgument(__FILE__, __LINE__, __FUNCTION__, "Error: Centroided data provided but profile spectra expected.");
}
pick(input[scan_idx], output[scan_idx], boundaries_s);
boundaries_spec.push_back(boundaries_s);
}
setProgress(++progress);
}
}
for (Size i = 0; i < input.getChromatograms().size(); ++i)
{
MSChromatogram chromatogram;
std::vector<PeakBoundary> boundaries_c; // peak boundaries of a single chromatogram
pick(input.getChromatograms()[i], chromatogram, boundaries_c);
output.addChromatogram(chromatogram);
boundaries_chrom.push_back(boundaries_c);
setProgress(++progress);
}
endProgress();
return;
}