本文整理汇总了C++中PeakMap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PeakMap::begin方法的具体用法?C++ PeakMap::begin怎么用?C++ PeakMap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PeakMap
的用法示例。
在下文中一共展示了PeakMap::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterPeakMap
void ParentPeakMower::filterPeakMap(PeakMap & exp)
{
for (PeakMap::Iterator it = exp.begin(); it != exp.end(); ++it)
{
filterSpectrum(*it);
}
}
示例2: filterPeakMap
void Normalizer::filterPeakMap(PeakMap & exp)
{
for (PeakMap::Iterator it = exp.begin(); it != exp.end(); ++it)
{
filterSpectrum(*it);
}
}
示例3: getRetentionTimes_
// lists of peptide hits in "maps" will be sorted
bool MapAlignmentAlgorithmIdentification::getRetentionTimes_(
PeakMap& experiment, SeqToList& rt_data)
{
for (PeakMap::Iterator exp_it = experiment.begin();
exp_it != experiment.end(); ++exp_it)
{
getRetentionTimes_(exp_it->getPeptideIdentifications(), rt_data);
}
// duplicate annotations should not be possible -> no need to remove them
return false;
}
示例4: filterPeakMap
void WindowMower::filterPeakMap(PeakMap & exp)
{
bool sliding = (String)param_.getValue("movetype") == "slide" ? true : false;
for (PeakMap::Iterator it = exp.begin(); it != exp.end(); ++it)
{
if (sliding)
{
filterPeakSpectrumForTopNInSlidingWindow(*it);
} else
{
filterPeakSpectrumForTopNInJumpingWindow(*it);
}
}
}
示例5: main_
ExitCodes main_(int, const char **)
{
//-------------------------------------------------------------
// parameter handling
//-------------------------------------------------------------
String in_spectra = getStringOption_("in_spectra");
String in_identifications = getStringOption_("in_identifications");
String outfile = getStringOption_("model_output_file");
Int precursor_charge = getIntOption_("precursor_charge");
//-------------------------------------------------------------
// init SvmTheoreticalSpectrumGeneratorTrainer
//-------------------------------------------------------------
SvmTheoreticalSpectrumGeneratorTrainer trainer;
Param param = getParam_().copy("algorithm:", true);
String write_files = getFlag_("write_training_files") ? "true" : "false";
param.setValue("write_training_files", write_files);
trainer.setParameters(param);
//-------------------------------------------------------------
// loading input
//-------------------------------------------------------------
PeakMap map;
MzMLFile().load(in_spectra, map);
std::vector<PeptideIdentification> pep_ids;
std::vector<ProteinIdentification> prot_ids;
String tmp_str;
IdXMLFile().load(in_identifications, prot_ids, pep_ids, tmp_str);
IDMapper idmapper;
Param par;
par.setValue("rt_tolerance", 0.001);
par.setValue("mz_tolerance", 0.001);
idmapper.setParameters(par);
idmapper.annotate(map, pep_ids, prot_ids);
//generate vector of annotations
std::vector<AASequence> annotations;
PeakMap::iterator it;
for (it = map.begin(); it != map.end(); ++it)
{
annotations.push_back(it->getPeptideIdentifications()[0].getHits()[0].getSequence());
}
trainer.trainModel(map, annotations, outfile, precursor_charge);
return EXECUTION_OK;
}
示例6: p
p.setValue("threshold", 10.0);
e_ptr->setParameters(p);
e_ptr->filterSpectrum(spec);
TEST_EQUAL(spec.size(), 14)
END_SECTION
START_SECTION((void filterPeakMap(PeakMap& exp)))
DTAFile dta_file;
PeakSpectrum spec;
dta_file.load(OPENMS_GET_TEST_DATA_PATH("Transformers_tests.dta"), spec);
PeakMap pm;
pm.addSpectrum(spec);
TEST_EQUAL(pm.begin()->size(), 121)
Param p(e_ptr->getParameters());
p.setValue("threshold", 1.0);
e_ptr->setParameters(p);
e_ptr->filterPeakMap(pm);
TEST_EQUAL(pm.begin()->size(), 121)
p.setValue("threshold", 10.0);
e_ptr->setParameters(p);
e_ptr->filterPeakMap(pm);
TEST_EQUAL(pm.begin()->size(), 14)
END_SECTION
示例7: main_
ExitCodes main_(int, const char**)
{
// parsing parameters
String in(getStringOption_("in"));
String feature_in(getStringOption_("feature_in"));
String out(getStringOption_("out"));
double precursor_mass_tolerance(getDoubleOption_("precursor_mass_tolerance"));
// reading input
FileHandler fh;
FileTypes::Type in_type = fh.getType(in);
PeakMap exp;
fh.loadExperiment(in, exp, in_type, log_type_, false, false);
exp.sortSpectra();
FeatureMap feature_map;
if (feature_in != "")
{
FeatureXMLFile().load(feature_in, feature_map);
}
// calculations
FeatureFinderAlgorithmIsotopeWavelet iso_ff;
Param ff_param(iso_ff.getParameters());
ff_param.setValue("max_charge", getIntOption_("max_charge"));
ff_param.setValue("intensity_threshold", getDoubleOption_("intensity_threshold"));
iso_ff.setParameters(ff_param);
FeatureFinder ff;
ff.setLogType(ProgressLogger::NONE);
PeakMap exp2 = exp;
exp2.clear(false);
for (PeakMap::ConstIterator it = exp.begin(); it != exp.end(); ++it)
{
if (it->size() != 0)
{
exp2.addSpectrum(*it);
}
}
exp = exp2;
exp.updateRanges();
// TODO check MS2 and MS1 counts
ProgressLogger progresslogger;
progresslogger.setLogType(log_type_);
progresslogger.startProgress(0, exp.size(), "Correcting precursor masses");
for (PeakMap::Iterator it = exp.begin(); it != exp.end(); ++it)
{
progresslogger.setProgress(exp.end() - it);
if (it->getMSLevel() != 2)
{
continue;
}
// find first MS1 scan of the MS/MS scan
PeakMap::Iterator ms1_it = it;
while (ms1_it != exp.begin() && ms1_it->getMSLevel() != 1)
{
--ms1_it;
}
if (ms1_it == exp.begin() && ms1_it->getMSLevel() != 1)
{
writeLog_("Did not find a MS1 scan to the MS/MS scan at RT=" + String(it->getRT()));
continue;
}
if (ms1_it->size() == 0)
{
writeDebug_("No peaks in scan at RT=" + String(ms1_it->getRT()) + String(", skipping"), 1);
continue;
}
PeakMap::Iterator ms2_it = ms1_it;
++ms2_it;
while (ms2_it != exp.end() && ms2_it->getMSLevel() == 2)
{
// first: error checks
if (ms2_it->getPrecursors().empty())
{
writeDebug_("Warning: found no precursors of spectrum RT=" + String(ms2_it->getRT()) + ", skipping it.", 1);
++ms2_it;
continue;
}
else if (ms2_it->getPrecursors().size() > 1)
{
writeLog_("Warning: found more than one precursor of spectrum RT=" + String(ms2_it->getRT()) + ", using first one.");
}
Precursor prec = *ms2_it->getPrecursors().begin();
double prec_pos = prec.getMZ();
PeakMap new_exp;
// now excise small region from the MS1 spec for the feature finder (isotope pattern must be covered...)
PeakSpectrum zoom_spec;
for (PeakSpectrum::ConstIterator pit = ms1_it->begin(); pit != ms1_it->end(); ++pit)
{
if (pit->getMZ() > prec_pos - 3 && pit->getMZ() < prec_pos + 3)
{
//.........这里部分代码省略.........
示例8: abs
set<Size> correctToNearestMS1Peak(PeakMap & exp, double mz_tolerance, bool ppm, vector<double> & deltaMZs, vector<double> & mzs, vector<double> & rts)
{
set<Size> corrected_precursors;
// load experiment and extract precursors
vector<Precursor> precursors; // precursor
vector<double> precursors_rt; // RT of precursor MS2 spectrum
vector<Size> precursor_scan_index;
getPrecursors_(exp, precursors, precursors_rt, precursor_scan_index);
for (Size i = 0; i != precursors_rt.size(); ++i)
{
// get precursor rt
double rt = precursors_rt[i];
// get precursor MZ
double mz = precursors[i].getMZ();
//cout << rt << " " << mz << endl;
// get precursor spectrum
MSExperiment<Peak1D>::ConstIterator rt_it = exp.RTBegin(rt - 1e-8);
// store index of MS2 spectrum
UInt precursor_spectrum_idx = rt_it - exp.begin();
// get parent (MS1) of precursor spectrum
rt_it = exp.getPrecursorSpectrum(rt_it);
if (rt_it->getMSLevel() != 1)
{
LOG_WARN << "Error: no MS1 spectrum for this precursor" << endl;
}
//cout << rt_it->getRT() << " " << rt_it->size() << endl;
// find peak (index) closest to expected position
Size nearest_peak_idx = rt_it->findNearest(mz);
// get actual position of closest peak
double nearest_peak_mz = (*rt_it)[nearest_peak_idx].getMZ();
// calculate error between expected and actual position
double nearestPeakError = ppm ? abs(nearest_peak_mz - mz)/mz * 1e6 : abs(nearest_peak_mz - mz);
// check if error is small enough
if (nearestPeakError < mz_tolerance)
{
// sanity check: do we really have the same precursor in the original and the picked spectrum
if (fabs(exp[precursor_spectrum_idx].getPrecursors()[0].getMZ() - mz) > 0.0001)
{
LOG_WARN << "Error: index is referencing different precursors in original and picked spectrum." << endl;
}
// cout << mz << " -> " << nearest_peak_mz << endl;
double deltaMZ = nearest_peak_mz - mz;
deltaMZs.push_back(deltaMZ);
mzs.push_back(mz);
rts.push_back(rt);
// correct entries
Precursor corrected_prec = precursors[i];
corrected_prec.setMZ(nearest_peak_mz);
exp[precursor_spectrum_idx].getPrecursors()[0] = corrected_prec;
corrected_precursors.insert(precursor_spectrum_idx);
}
}
return corrected_precursors;
}
示例9: it
TEST_STRING_EQUAL(FileTypes::typeToName(e.getLoadedFileType()),"dta2d");
TEST_EQUAL(e.size(), 9);
ABORT_IF(e.size() != 9)
TEST_STRING_EQUAL(e[0].getNativeID(),"index=0")
TEST_STRING_EQUAL(e[1].getNativeID(),"index=1")
TEST_STRING_EQUAL(e[2].getNativeID(),"index=2")
TEST_STRING_EQUAL(e[3].getNativeID(),"index=3")
TEST_STRING_EQUAL(e[4].getNativeID(),"index=4")
TEST_STRING_EQUAL(e[5].getNativeID(),"index=5")
TEST_STRING_EQUAL(e[6].getNativeID(),"index=6")
TEST_STRING_EQUAL(e[7].getNativeID(),"index=7")
TEST_STRING_EQUAL(e[8].getNativeID(),"index=8")
PeakMap::const_iterator it(e.begin());
TEST_REAL_SIMILAR((*it)[0].getPosition()[0], 230.02)
TEST_REAL_SIMILAR(it->getRT(), 4711.1)
TEST_REAL_SIMILAR((*it)[0].getIntensity(), 47218.89)
++it;
TEST_REAL_SIMILAR((*it)[0].getPosition()[0], 231.51)
TEST_REAL_SIMILAR(it->getRT(), 4711.2)
TEST_REAL_SIMILAR((*it)[0].getIntensity(), 89935.22)
++it;
TEST_REAL_SIMILAR((*it)[0].getPosition()[0], 139.42)
TEST_REAL_SIMILAR(it->getRT(), 4711.3)
TEST_REAL_SIMILAR((*it)[0].getIntensity(), 318.52)
++it;
示例10: run
void MassTraceDetection::run(const PeakMap& input_exp, std::vector<MassTrace>& found_masstraces)
{
// make sure the output vector is empty
found_masstraces.clear();
// gather all peaks that are potential chromatographic peak apices
// - use work_exp for actual work (remove peaks below noise threshold)
// - store potential apices in chrom_apices
PeakMap work_exp;
MapIdxSortedByInt chrom_apices;
Size total_peak_count(0);
std::vector<Size> spec_offsets;
spec_offsets.push_back(0);
Size spectra_count(0);
// *********************************************************** //
// Step 1: Detecting potential chromatographic apices
// *********************************************************** //
for (PeakMap::ConstIterator it = input_exp.begin(); it != input_exp.end(); ++it)
{
// check if this is a MS1 survey scan
if (it->getMSLevel() != 1) continue;
std::vector<Size> indices_passing;
for (Size peak_idx = 0; peak_idx < it->size(); ++peak_idx)
{
double tmp_peak_int((*it)[peak_idx].getIntensity());
if (tmp_peak_int > noise_threshold_int_)
{
// Assume that noise_threshold_int_ contains the noise level of the
// data and we want to be chrom_peak_snr times above the noise level
// --> add this peak as possible chromatographic apex
if (tmp_peak_int > chrom_peak_snr_ * noise_threshold_int_)
{
chrom_apices.insert(std::make_pair(tmp_peak_int, std::make_pair(spectra_count, indices_passing.size())));
}
indices_passing.push_back(peak_idx);
++total_peak_count;
}
}
PeakMap::SpectrumType tmp_spec(*it);
tmp_spec.select(indices_passing);
work_exp.addSpectrum(tmp_spec);
spec_offsets.push_back(spec_offsets.back() + tmp_spec.size());
++spectra_count;
}
if (spectra_count < 3)
{
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Input map consists of too few MS1 spectra (less than 3!). Aborting...", String(spectra_count));
}
// discard last spectrum's offset
spec_offsets.pop_back();
// *********************************************************************
// Step 2: start extending mass traces beginning with the apex peak (go
// through all peaks in order of decreasing intensity)
// *********************************************************************
run_(chrom_apices, total_peak_count, work_exp, spec_offsets, found_masstraces);
return;
} // end of MassTraceDetection::run
示例11: main_
ExitCodes main_(int, const char **) override
{
//-------------------------------------------------------------
// parameter handling
//-------------------------------------------------------------
String in = getStringOption_("in");
String out = getStringOption_("out");
//-------------------------------------------------------------
// loading input
//-------------------------------------------------------------
PeakMap exp;
MzMLFile f;
f.load(in, exp);
//-------------------------------------------------------------
// calculations
//-------------------------------------------------------------
//determine maximum peak
exp.updateRanges();
double max = exp.getMaxInt() / 100.0;
for (PeakMap::Iterator it = exp.begin(); it != exp.end(); ++it)
{
if (it->getMSLevel() < 2)
{
for (PeakMap::SpectrumType::Iterator it2 = it->begin(); it2 != it->end(); ++it2)
{
it2->setIntensity(it2->getIntensity() / max);
}
}
}
/// @todo add chromatogram support for normalization, e.g. for MRM stuff (Andreas)
/*
vector<MSChromatogram > chroms = exp.getChromatograms();
double sum(0);
for (vector<MSChromatogram >::iterator it = chroms.begin(); it != chroms.end(); ++it)
{
for (MSChromatogram::Iterator it2 = it->begin(); it2 != it->end(); ++it2)
{
sum += it2->getIntensity();
}
}
for (vector<MSChromatogram >::iterator it = chroms.begin(); it != chroms.end(); ++it)
{
for (MSChromatogram::Iterator it2 = it->begin(); it2 != it->end(); ++it2)
{
it2->setIntensity(it2->getIntensity() / sum * 1000000.0);
}
}
exp.setChromatograms(chroms);
*/
//-------------------------------------------------------------
// writing output
//-------------------------------------------------------------
//annotate output with data processing info
addDataProcessing_(exp, getProcessingInfo_(DataProcessing::NORMALIZATION));
f.store(out, exp);
return EXECUTION_OK;
}
示例12: main_
ExitCodes main_(int argc, const char** argv)
{
//-------------------------------------------------------------
// parameter handling
//-------------------------------------------------------------
//input/output files
String in(getStringOption_("in")), out(getStringOption_("out"));
FileHandler fh;
FileTypes::Type in_type = fh.getType(in);
//-------------------------------------------------------------
// loading input
//-------------------------------------------------------------
PeakMap exp;
// keep only MS2 spectra
fh.getOptions().addMSLevel(2);
fh.loadExperiment(in, exp, in_type, log_type_);
writeDebug_(String("Spectra loaded: ") + exp.size(), 2);
if (exp.getSpectra().empty())
{
throw OpenMS::Exception::FileEmpty(__FILE__, __LINE__, __FUNCTION__, "Error: No MS2 spectra in input file.");
}
// determine type of spectral data (profile or centroided)
SpectrumSettings::SpectrumType spectrum_type = exp[0].getType();
if (spectrum_type == SpectrumSettings::RAWDATA)
{
if (!getFlag_("force"))
{
throw OpenMS::Exception::IllegalArgument(__FILE__, __LINE__, __FUNCTION__, "Error: Profile data provided but centroided MS2 spectra expected. To enforce processing of the data set the -force flag.");
}
}
//-------------------------------------------------------------
// calculations
//-------------------------------------------------------------
Param mascot_param = getParam_().copy("Mascot_parameters:", true);
MascotGenericFile mgf_file;
Param p;
// TODO: switch this to mzML (much smaller)
p.setValue("internal:format", "Mascot generic", "Sets the format type of the peak list, this should not be changed unless you write the header only.", ListUtils::create<String>("advanced"));
p.setValue("internal:HTTP_format", "true", "Write header with MIME boundaries instead of simple key-value pairs. For HTTP submission only.", ListUtils::create<String>("advanced"));
p.setValue("internal:content", "all", "Use parameter header + the peak lists with BEGIN IONS... or only one of them.", ListUtils::create<String>("advanced"));
mgf_file.setParameters(mascot_param);
// get the spectra into string stream
writeDebug_("Writing MGF file to stream", 1);
stringstream ss;
mgf_file.store(ss, in, exp, true); // write in compact format
// Usage of a QCoreApplication is overkill here (and ugly too), but we just use the
// QEventLoop to process the signals and slots and grab the results afterwards from
// the MascotRemotQuery instance
char** argv2 = const_cast<char**>(argv);
QCoreApplication event_loop(argc, argv2);
MascotRemoteQuery* mascot_query = new MascotRemoteQuery(&event_loop);
Param mascot_query_param = getParam_().copy("Mascot_server:", true);
writeDebug_("Setting parameters for Mascot query", 1);
mascot_query->setParameters(mascot_query_param);
writeDebug_("Setting spectra for Mascot query", 1);
mascot_query->setQuerySpectra(ss.str());
// remove unnecessary spectra
ss.clear();
QObject::connect(mascot_query, SIGNAL(done()), &event_loop, SLOT(quit()));
QTimer::singleShot(1000, mascot_query, SLOT(run()));
writeDebug_("Fire off Mascot query", 1);
event_loop.exec();
writeDebug_("Mascot query finished", 1);
if (mascot_query->hasError())
{
writeLog_("An error occurred during the query: " + mascot_query->getErrorMessage());
delete mascot_query;
return EXTERNAL_PROGRAM_ERROR;
}
// write Mascot response to file
String mascot_tmp_file_name(File::getTempDirectory() + "/" + File::getUniqueName() + "_Mascot_response");
QFile mascot_tmp_file(mascot_tmp_file_name.c_str());
mascot_tmp_file.open(QIODevice::WriteOnly);
mascot_tmp_file.write(mascot_query->getMascotXMLResponse());
mascot_tmp_file.close();
// clean up
delete mascot_query;
vector<PeptideIdentification> pep_ids;
ProteinIdentification prot_id;
// set up mapping between scan numbers and retention times:
MascotXMLFile::RTMapping rt_mapping;
MascotXMLFile::generateRTMapping(exp.begin(), exp.end(), rt_mapping);
//.........这里部分代码省略.........
示例13: correct
void correct(PeakMap & exp, vector<DoubleReal> & deltaMZs, vector<DoubleReal> & mzs, vector<DoubleReal> & rts)
{
// load experiment and extract precursors
vector<Precursor> precursors; // precursor
vector<double> precursors_rt; // RT of precursor MS2 spectrum
getPrecursors_(exp, precursors, precursors_rt);
for (Size i = 0; i != precursors_rt.size(); ++i)
{
// get precursor rt
DoubleReal rt = precursors_rt[i];
// get precursor MZ
DoubleReal mz = precursors[i].getMZ();
//cout << rt << " " << mz << endl;
// get precursor spectrum
MSExperiment<Peak1D>::ConstIterator rt_it = exp.RTBegin(rt);
// store index of MS2 spectrum
UInt precursor_spectrum_idx = rt_it - exp.begin();
// get parent (MS1) of precursor spectrum
rt_it = exp.getPrecursorSpectrum(rt_it);
if (rt_it->getMSLevel() != 1)
{
cout << "Error: no MS1 spectrum for this precursor" << endl;
}
//cout << rt_it->getRT() << " " << rt_it->size() << endl;
// find peak (index) closest to expected position
Size nearest_peak_idx = rt_it->findNearest(mz);
// get actual position of closest peak
DoubleReal nearest_peak_mz = (*rt_it)[nearest_peak_idx].getMZ();
// calculate error between expected and actual position
DoubleReal nearestPeakError = abs(nearest_peak_mz - mz);
// check if error is small enough
if (nearestPeakError < 0.1)
{
// sanity check: do we really have the same precursor in the original and the picked spectrum
if (fabs(exp[precursor_spectrum_idx].getPrecursors()[0].getMZ() - mz) > 0.0001)
{
cout << "Error: index is referencing different precursors in original and picked spectrum." << endl;
}
// cout << mz << " -> " << nearest_peak_mz << endl;
DoubleReal deltaMZ = nearest_peak_mz - mz;
deltaMZs.push_back(deltaMZ);
mzs.push_back(mz);
rts.push_back(rt);
// correct entries
Precursor corrected_prec = precursors[i];
corrected_prec.setMZ(nearest_peak_mz);
exp[precursor_spectrum_idx].getPrecursors()[0] = corrected_prec;
}
}
}
示例14: if
ExitCodes
main_(int, const char**)
{
//-------------------------------------------------------------
// general variables and data
//-------------------------------------------------------------
FileHandler fh;
vector<PeptideIdentification> peptide_identifications;
vector<ProteinIdentification> protein_identifications;
//-------------------------------------------------------------
// reading input
//-------------------------------------------------------------
const String in = getStringOption_("in");
ProgressLogger logger;
logger.setLogType(ProgressLogger::CMD);
logger.startProgress(0, 1, "Loading...");
if (File::isDirectory(in))
{
const String in_directory = File::absolutePath(in).ensureLastChar('/');
const String mz_file = getStringOption_("mz_file");
const bool ignore_proteins_per_peptide = getFlag_("ignore_proteins_per_peptide");
UInt i = 0;
FileHandler fh;
FileTypes::Type type;
MSExperiment<Peak1D> msexperiment;
// Note: we had issues with leading zeroes, so let us represent scan numbers as Int (next line used to be map<String, float> num_and_rt;) However, now String::toInt() might throw.
map<Int, float> num_and_rt;
vector<String> NativeID;
// The mz-File (if given)
if (!mz_file.empty())
{
type = fh.getTypeByFileName(mz_file);
fh.loadExperiment(mz_file, msexperiment, type);
for (MSExperiment<Peak1D>::Iterator spectra_it = msexperiment.begin(); spectra_it != msexperiment.end(); ++spectra_it)
{
String(spectra_it->getNativeID()).split('=', NativeID);
try
{
num_and_rt[NativeID[1].toInt()] = spectra_it->getRT();
// cout << "num_and_rt: " << NativeID[1] << " = " << NativeID[1].toInt() << " : " << num_and_rt[NativeID[1].toInt()] << endl; // CG debuggging 2009-07-01
}
catch (Exception::ConversionError& e)
{
writeLog_(String("Error: Cannot read scan number as integer. '") + e.getMessage());
}
}
}
// Get list of the actual Sequest .out-Files
StringList in_files;
if (!File::fileList(in_directory, String("*.out"), in_files))
{
writeLog_(String("Error: No .out files found in '") + in_directory + "'. Aborting!");
}
// Now get to work ...
for (vector<String>::const_iterator in_files_it = in_files.begin(); in_files_it != in_files.end(); ++in_files_it)
{
vector<PeptideIdentification> peptide_ids_seq;
ProteinIdentification protein_id_seq;
vector<double> pvalues_seq;
vector<String> in_file_vec;
SequestOutfile sequest_outfile;
writeDebug_(String("Reading file ") + *in_files_it, 3);
try
{
sequest_outfile.load((String) (in_directory + *in_files_it), peptide_ids_seq, protein_id_seq, 1.0, pvalues_seq, "Sequest", ignore_proteins_per_peptide);
in_files_it->split('.', in_file_vec);
for (Size j = 0; j < peptide_ids_seq.size(); ++j)
{
// We have to explicitly set the identifiers, because the normal set ones are composed of search engine name and date, which is the same for a bunch of sequest out-files.
peptide_ids_seq[j].setIdentifier(*in_files_it + "_" + i);
Int scan_number = 0;
if (!mz_file.empty())
{
try
{
scan_number = in_file_vec[2].toInt();
peptide_ids_seq[j].setRT(num_and_rt[scan_number]);
}
catch (Exception::ConversionError& e)
{
writeLog_(String("Error: Cannot read scan number as integer. '") + e.getMessage());
}
catch (exception& e)
{
writeLog_(String("Error: Cannot read scan number as integer. '") + e.what());
//.........这里部分代码省略.........
示例15: main_
ExitCodes main_(int, const char**)
{
//-------------------------------------------------------------
// parsing parameters
//-------------------------------------------------------------
String in(getStringOption_("in"));
String out(getStringOption_("out"));
String pair_in(getStringOption_("pair_in"));
String feature_out(getStringOption_("feature_out"));
double precursor_mass_tolerance(getDoubleOption_("precursor_mass_tolerance"));
double RT_tolerance(getDoubleOption_("RT_tolerance"));
double expansion_range(getDoubleOption_("expansion_range"));
Size max_isotope(getIntOption_("max_isotope"));
Int debug(getIntOption_("debug"));
//-------------------------------------------------------------
// reading input
//-------------------------------------------------------------
PeakMap exp;
MzMLFile().load(in, exp);
exp.sortSpectra();
exp.updateRanges();
// read pair file
ifstream is(pair_in.c_str());
String line;
vector<SILAC_pair> pairs;
while (getline(is, line))
{
line.trim();
if (line.empty() || line[0] == '#')
{
continue;
}
vector<String> split;
line.split(' ', split);
if (split.size() != 4)
{
cerr << "missformated line ('" << line << "') should be (space separated) 'm/z-light m/z-heavy charge rt'" << endl;
}
SILAC_pair p;
p.mz_light = split[0].toDouble();
p.mz_heavy = split[1].toDouble();
p.charge = split[2].toInt();
p.rt = split[3].toDouble();
pairs.push_back(p);
}
is.close();
//-------------------------------------------------------------
// calculations
//-------------------------------------------------------------
ConsensusMap results_map;
results_map.getFileDescriptions()[0].label = "light";
results_map.getFileDescriptions()[0].filename = in;
results_map.getFileDescriptions()[1].label = "heavy";
results_map.getFileDescriptions()[1].filename = in;
FeatureFinderAlgorithmIsotopeWavelet iso_ff;
Param ff_param(iso_ff.getParameters());
ff_param.setValue("max_charge", 3);
ff_param.setValue("intensity_threshold", -1.0);
iso_ff.setParameters(ff_param);
FeatureFinder ff;
ff.setLogType(ProgressLogger::NONE);
vector<SILACQuantitation> quantlets;
FeatureMap all_features;
for (PeakMap::ConstIterator it = exp.begin(); it != exp.end(); ++it)
{
if (it->size() == 0 || it->getMSLevel() != 1 || !it->getInstrumentSettings().getZoomScan())
{
continue;
}
PeakSpectrum new_spec = *it;
// get spacing from data
double min_spacing(numeric_limits<double>::max());
double last_mz(0);
for (PeakSpectrum::ConstIterator pit = new_spec.begin(); pit != new_spec.end(); ++pit)
{
if (pit->getMZ() - last_mz < min_spacing)
{
min_spacing = pit->getMZ() - last_mz;
}
last_mz = pit->getMZ();
}
writeDebug_("Min-spacing=" + String(min_spacing), 1);
// split the spectrum into two subspectra, by using different hypothesis of
// the SILAC pairs
Size idx = 0;
for (vector<SILAC_pair>::const_iterator pit = pairs.begin(); pit != pairs.end(); ++pit, ++idx)
{
// in RT window?
//.........这里部分代码省略.........