本文整理汇总了C++中Hits::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Hits::size方法的具体用法?C++ Hits::size怎么用?C++ Hits::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hits
的用法示例。
在下文中一共展示了Hits::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDocs
list<int> *Searcher::search(list<string> &terms, list<int> &res) {
int ndocs = getDocs();
vector<double> A(ndocs + 1);
list<int> numhits;
BOOST_FOREACH(string &term, terms) {
Hits hits = getHits(term);
int ft = hits.size();
if(hits.size() == 0)
continue;
Hits::iterator ai;
for(ai = hits.begin(); ai != hits.end(); ++ai) {
Node &anode = *ai;
int doc = anode.doc;
double wdt = getWdt(anode.freq, getWd()[doc]);
double wqt = getWqt(ndocs, ft);
A[doc] += wdt * wqt;
}
hits.free();
}
示例2: main
int main(int argc, char* argv[])
{
//options
// -i inputfile -a annotationfiles -f forcestrand
bool showHelp = false;
string infile;
vector<string> annofiles;
bool forcestrand = false;
// Show help when has no options
if(argc <= 1)
{
Help();
return 0;
}
// Parsing options
for(int i = 1; i < argc; i++)
{
int parameterLength = (int)strlen(argv[i]);
if((PARAMETER_CHECK("-h", 2, parameterLength)) || (PARAMETER_CHECK("--help", 5, parameterLength)))
showHelp=true;
else if ((PARAMETER_CHECK("-i", 2, parameterLength)) || (PARAMETER_CHECK("--input", 7, parameterLength)))
{
if ((++i) < argc)
infile=argv[i];
}
else if ((PARAMETER_CHECK("-a", 2, parameterLength)) || (PARAMETER_CHECK("--annotations", 13, parameterLength)))
{
if ((++i) < argc)
{
StringUtils::tokenize(string(argv[i]),annofiles,",");
}
}
else if ((PARAMETER_CHECK("-s", 2, parameterLength)) || (PARAMETER_CHECK("--forcestrand", 13, parameterLength)))
forcestrand = true;
else
{
cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl;
showHelp = true;
}
}
// Show help if no proper auguments.
if (showHelp)
{
Help();
return 0;
}
// definition
int annocount=annofiles.size(); // File count
vector<BedMap> bedmaps(annocount); // BedMap
vector<double> annos(annocount+1,0); // Count reads for each kind of annotaions. The last one counts the remained reads.
LINE_ELEMS elems; // Column reader buffer
Hits hits;
ColumnReader beds(infile);
// Load annotations into BedMaps
for(int i=0;i<annocount;i++)
BedUtils::loadBedFileToMap(bedmaps[i],annofiles[i]);
// Annotation
beds.open();
while(beds.getNext(elems)!=LINE_INVALID)
{
Bed tbed(elems);
cout << tbed;
bool intersectflag=true;
for(int i=0;i<annocount;i++)
{
if(intersectflag)
{
BedUtils::intersectBed(tbed,bedmaps[i],hits,forcestrand);
if(hits.size())
{
annos[i]+=tbed.score;
cout << "\t" << tbed.score;
intersectflag=false; // if found hits, suppress intersection for the following annotations.
}
else
cout << "\t0";
hits.clear();
}
else
cout << "\t0";
}
if(intersectflag) // No overlas with annotations.
{
cout << "\t" << tbed.score << endl;
annos[annocount]+=tbed.score;
}
else
cout << "\t0" << endl;
}
for(int i=0;i<annocount;i++)
//.........这里部分代码省略.........