| 400 | } |
| 401 | |
| 402 | int FilterResult::getAdapterReportCount(map<string, long, classcomp>& adapterCounts) { |
| 403 | map<string, long>::iterator iter; |
| 404 | long total = 0; |
| 405 | long totalAdapterBases = 0; |
| 406 | for(iter = adapterCounts.begin(); iter!=adapterCounts.end(); iter++) { |
| 407 | total += iter->second; |
| 408 | totalAdapterBases += iter->first.length() * iter->second; |
| 409 | } |
| 410 | if(total == 0) |
| 411 | return 0; |
| 412 | const double reportThreshold = 0.01; |
| 413 | const double dTotal = (double)total; |
| 414 | int count = 0; |
| 415 | for(iter = adapterCounts.begin(); iter!=adapterCounts.end(); iter++) { |
| 416 | if(iter->second /dTotal < reportThreshold ) |
| 417 | continue; |
| 418 | count++; |
| 419 | } |
| 420 | return count; |
| 421 | } |
| 422 | |
| 423 | int FilterResult::outputAdaptersHtml(ofstream& ofs, map<string, long, classcomp>& adapterCounts, long totalBases, int limitCount) { |
| 424 | |