Last active
July 1, 2019 21:50
-
-
Save fataltes/35fbcc30fe9cace8fddeb5df9907f130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getPufferfishContigStats(IndexT& pi) { | |
//size_t k = pi.k(); | |
CanonicalKmer::k(pi.k()); | |
size_t found = 0; | |
size_t notFound = 0; | |
size_t correctPosCntr = 0; | |
size_t incorrectPosCntr = 0; | |
size_t numTrueTxp = 0; | |
size_t numLostTxp = 0; | |
std::ofstream out("contigInfo.txt"); | |
std::cerr << "store the contig info\n"; | |
uint64_t cid{0}, totalLength{0}; | |
while (totalLength < pi.getSeq().size()) { | |
auto kmer = pi.getStartKmer(cid); | |
auto clen = pi.getContigLen(cid); | |
totalLength += clen; | |
out << cid << "\t" << clen << "\t"; // contigId, contigLen | |
float sumTxphits{0}; | |
std::unordered_map<uint64_t, uint64_t> txpCntMap; | |
auto chits = pi.getRefPos(kmer) ; | |
for (auto& rpos : chits.refRange) { | |
if (txpCntMap.find(rpos.transcript_id()) == txpCntMap.end()) | |
txpCntMap[rpos.transcript_id()] = 0; | |
txpCntMap[rpos.transcript_id()]++; | |
} | |
for (auto kv: txpCntMap) { | |
sumTxphits += kv.second; | |
} | |
out << txpCntMap.size() << "\t" << (txpCntMap.size() > 0 ? sumTxphits/txpCntMap.size():0) << "\n"; // # of txps, avg of hits per txp | |
cid++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment