MCPcopy Create free account
hub / github.com/arq5x/bedtools2 / doHist

Method doHist

src/coverageFile/coverageFile.cpp:188–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186
187
188void 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
217void CoverageFile::doDefault(RecordOutputMgr *outputMgr, RecordKeyVector &hits)
218{

Callers

nothing calls this directly

Calls 6

strMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
printRecordMethod · 0.45
getKeyMethod · 0.45

Tested by

no test coverage detected