本文整理汇总了C++中Spectrum::getMz方法的典型用法代码示例。如果您正苦于以下问题:C++ Spectrum::getMz方法的具体用法?C++ Spectrum::getMz怎么用?C++ Spectrum::getMz使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spectrum
的用法示例。
在下文中一共展示了Spectrum::getMz方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runSearch
// assumes at least one spectrum in allRefs
void SearchLibrary::runSearch(Spectrum& s)
{
scoreMatches(s, cachedSpectra_, targetMatches_);
scoreMatches(s, cachedDecoySpectra_, decoyMatches_);
// keep scores from all target psms for estimating Weibull parameters
vector<double> allScores;
if(compute_pvalues_){
for(size_t i=0; i < targetMatches_.size(); i++){
double dotp = targetMatches_[i].getScore(DOTP);
allScores.push_back(dotp);
}
}
// there may have been spectra in cachedSpectra_ but none at the
// correct charge state. Check again
if( targetMatches_.size() == 0 ){
Verbosity::warn("No library spectra found for query %d "
"(precursor m/z %.2f).", s.getScanNumber(), s.getMz());
return;
}
if( compute_pvalues_ ){
addNullScores(s, allScores);
}
// sort the matches descending
sort(targetMatches_.begin(), targetMatches_.end(), compMatchDotScore);
sort(decoyMatches_.begin(), decoyMatches_.end(), compMatchDotScore);
setRank();
if( printAll_ ){
cout << "spec " << s.getScanNumber() << endl;
}
if( compute_pvalues_ ){
weibullEstimator_.estimateParams(allScores);
// print params to file
if( weibullParamFile_.is_open() ){
weibullParamFile_ << s.getScanNumber() << "\t"
<< weibullEstimator_.getEta() << "\t"
<< weibullEstimator_.getBeta() << "\t"
<< weibullEstimator_.getShift() << "\t"
<< weibullEstimator_.getCorrelation() << "\t"
<< weibullEstimator_.getNumPointsFit()
//(int)(allScores.size() * fraction_to_fit_)
<< endl;
}
setMatchesPvalues(allScores.size());
}
}
示例2: if
RefSpectrum::RefSpectrum(const Spectrum& s)
{
length = 0;
annot = -1;
copies = 1;
id = -1;
//or could do data = s.data and then change type and peaks
data.type = REFERENCE;
data.scanNumber = s.getScanNum();
data.mz = s.getMz();
data.numPeaks = s.getNumPeaks();
if(data.numPeaks)
{
data.peaks = new PEAK_T[data.numPeaks]; //add if(data.numPeaks?)
s.getPeaks(data.peaks, data.numPeaks);
}
}
示例3: initLibraries
/**
* Before searching each spectrum, set the appropriate precursor m/z
* range and charge states.
*/
void SearchLibrary::initLibraries(Spectrum& querySpec){
// TODO: for cache, set min as max(cacheMax, searchMin)
// max is still searchMax. charge is all charges
// set the precursor m/z range and charge states in each library
double minMZ = querySpec.getMz() - mzWindow_;
double maxMZ = querySpec.getMz() + mzWindow_;
for(size_t i = 0; i < libraries_.size(); i++){
LibReader* curLibrary = libraries_.at(i);
curLibrary->setLowMZ(minMZ);
curLibrary->setHighMZ(maxMZ);
// set min and max charges to look for either by the query
// charge or by the given parameters
/* if( ignoreQueryCharge ){ ...use current else clause } else if*/
//if( querySpec.sizeZ() == 1 ){
const vector<int>& charges = querySpec.getPossibleCharges();
if( charges.size() == 1 ){
curLibrary->setCharge(charges.front());
} else { // TODO instead use min and max charge of query as range
curLibrary->setLowChg(minSpecCharge_);
curLibrary->setHighChg(maxSpecCharge_);
curLibrary->setCharge(-1); // hack to say there is no one
// charge
} /* else {
int min = 100;
int max = 0;
for(i=0; i < querySpec.sizeZ(); i++){
if( querySpec.atZ(i).z > max )
max = querySpec.atZ(i).z;
}
if( querySpec.atZ(i).z < min )
min = querySpec.atZ(i).z;
}
curLibrary->setLowChg(min);
curLibrary->setHighChg(max);
} */
}
}
示例4:
bool Spectrum::operator< (Spectrum otherSpec) {
return data.mz < otherSpec.getMz();
}