| 186 | |
| 187 | |
| 188 | void CoverageFile::doHist(RecordOutputMgr *outputMgr, RecordKeyVector &hits) |
| 189 | { |
| 190 | //make a map of depths to num bases with that depth |
| 191 | _currDepthMap.clear(); |
| 192 | for (size_t i=0; i < _queryLen; i++) { |
| 193 | _currDepthMap[_depthArray[i]]++; |
| 194 | _finalDepthMap[_depthArray[i]]++; |
| 195 | } |
| 196 | |
| 197 | for (depthMapType::iterator iter = _currDepthMap.begin(); iter != _currDepthMap.end(); iter++) { |
| 198 | size_t depth = iter->first; |
| 199 | size_t numBasesAtDepth = iter->second; |
| 200 | float coveredFraction = (float)numBasesAtDepth / (float)_queryLen; |
| 201 | |
| 202 | ostringstream s; |
| 203 | s << depth; |
| 204 | s << "\t"; |
| 205 | s << numBasesAtDepth; |
| 206 | s << "\t"; |
| 207 | s << _queryLen; |
| 208 | s << "\t"; |
| 209 | char *coveredFractionString; |
| 210 | asprintf(&coveredFractionString, "%0.7f", coveredFraction); |
| 211 | s << coveredFractionString; |
| 212 | _finalOutput = s.str(); |
| 213 | outputMgr->printRecord(hits.getKey(), _finalOutput); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | void CoverageFile::doDefault(RecordOutputMgr *outputMgr, RecordKeyVector &hits) |
| 218 | { |