"Fossies" - the Fresh Open Source Software Archive

Member "augustus-3.3.3/src/pp_fastBlockSearcher.cc" (22 May 2019, 2223 Bytes) of package /linux/misc/augustus-3.3.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pp_fastBlockSearcher.cc" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.3.2_vs_3.3.3.

    1 /*
    2  * pp_fastBlockSearcher.cc
    3  *
    4  * License: Artistic License, see file LICENSE.TXT or 
    5  *          https://opensource.org/licenses/artistic-license-1.0
    6  */
    7 
    8 #include "pp_fastBlockSearcher.hh"
    9 
   10 #include <sstream>
   11 
   12 int    PP::FsHitType::maxIntronLen = 100000;
   13 double PP::FsHitType::intronMalus  = 1e-5;
   14 
   15 int    PP::FsSeedCollection::expSeedCount = 10000;
   16 double PP::FsSeedCollection::maxCoverage  = 0.8;
   17 
   18 void PP::FsHitCollection::newHit(FsHitType* ht) {
   19     allHits.push_back(ht);
   20     vector<HitQueue>& allQueues = pendingHits[ht->reverse];
   21     int b = ht->reverse ? ht->blockNo+1 : ht->blockNo-1;
   22     if (b>=0 && b<size) 
   23     ht->linkTo(allQueues[b]);
   24     if (ht->reverse) 
   25     for (b=ht->blockNo; b>0; b--)
   26         ht->pushOn(allQueues[b]);
   27     else
   28     for (b=ht->blockNo; b<size-1; b++)
   29         ht->pushOn(allQueues[b]);
   30 
   31     // Put this entry in to the final result container
   32     if (finalResult.empty()) {
   33     finalResult.push_back(ht);
   34     return;
   35     }
   36     int i = finalResult.size()-1;
   37     while (i>=0 && finalResult[i]->start() > ht->start()) 
   38     i--;
   39     if (i>=0 && finalResult[i]->head == ht->head) {
   40     if (finalResult[i]->pathScore < ht->pathScore) 
   41         finalResult[i] = ht;
   42     } else if (i == finalResult.size()-1) {
   43     finalResult.push_back(ht);
   44     } else  {
   45     int j = finalResult.size()-1;
   46     finalResult.push_back(finalResult.back());
   47     while (--j>i)
   48         finalResult[j+1] = finalResult[j];
   49     finalResult[i+1] = ht;
   50     }
   51 }
   52 
   53 void PP::FsHitCollection::storeBestResults(multimap<double, FsHitType>& result, int mincount, double threshold) {
   54     int maxcount = finalResult.size();
   55     result.clear();
   56     
   57     if (mincount > maxcount)
   58     mincount = maxcount;
   59     int i;
   60     for (i=0; i<mincount; i++) {
   61     FsHitType* ht = finalResult[i];
   62     result.insert(make_pair(ht->pathScore, *ht));
   63     }
   64     if (mincount) for(; i<maxcount; i++) {
   65     FsHitType* ht = finalResult[i];
   66     double sc = ht->pathScore;
   67     double listSc = result.begin()->second.pathScore;
   68     if (listSc > threshold)
   69         break;
   70     if (listSc > sc)
   71         continue;
   72     result.erase(result.begin());
   73     result.insert(make_pair(sc, *ht));
   74     }
   75     for (; i<maxcount; i++) {
   76     FsHitType* ht = finalResult[i];
   77     if (ht->pathScore > threshold)
   78         result.insert(make_pair(ht->pathScore, *ht));
   79     }
   80 }