本文整理汇总了C++中Spectrum::getPossibleCharges方法的典型用法代码示例。如果您正苦于以下问题:C++ Spectrum::getPossibleCharges方法的具体用法?C++ Spectrum::getPossibleCharges怎么用?C++ Spectrum::getPossibleCharges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spectrum
的用法示例。
在下文中一共展示了Spectrum::getPossibleCharges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scoreMatches
/**
* Compare the given query spectrum to all library spectra. Create a
* match for each and add to matches.
*/
void SearchLibrary::scoreMatches(Spectrum& s, deque<RefSpectrum*>& spectra,
vector<Match>& matches ){
Verbosity::debug("Scoring %d matches.", spectra.size());
// get the charge states we will search
const vector<int>& charges = s.getPossibleCharges();
// compare all ref spec to query, create match for each
for(size_t i=0; i< spectra.size(); i++) {
// is there a better place to check this?
if(spectra.at(i)->getNumProcessedPeaks() == 0 ){
Verbosity::debug("Skipping library spectrum %d. No peaks.",
spectra.at(i)->getLibSpecID());
continue;
}
if( ! checkCharge(charges, spectra.at(i)->getCharge()) ){
continue;
}
Match thisMatch(&s, spectra.at(i));
thisMatch.setMatchLibID(spectra.at(i)->getLibID());
Verbosity::comment(V_ALL, "Comparing query spec %d and library spec %d",
s.getScanNumber(), spectra.at(i)->getLibSpecID());
DotProduct::compare(thisMatch); //static method
// save match for reporting
matches.push_back(thisMatch);
}
}
示例2: 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);
} */
}
}