]> git.donarmstrong.com Git - rsem.git/blobdiff - parseIt.cpp
The order of @SQ tags in SAM/BAM files can be arbitrary now
[rsem.git] / parseIt.cpp
index 55dd954d3d1e2059911987ed5a8521748b16e9a1..8620432c2840140561451c211208b560b7e48363 100644 (file)
@@ -13,8 +13,6 @@
 #include "utils.h"
 
 #include "GroupInfo.h"
-
-#include "Transcript.h"
 #include "Transcripts.h"
 
 #include "SingleRead.h"
@@ -96,6 +94,9 @@ void parseIt(SamParser *parser) {
                        if (record_val >= 0) {
                                record_read.write(n_os, cat[record_val]);
                                ++N[record_val];
+                       }
+                       // flush out previous read's hits if the read is alignable reads
+                       if (record_val == 1) {
                                hits.updateRI();
                                nHits += hits.getNHits();
                                nMulti += hits.calcNumGeneMultiReads(gi);
@@ -127,6 +128,9 @@ void parseIt(SamParser *parser) {
        if (record_val >= 0) {
                record_read.write(n_os, cat[record_val]);
                ++N[record_val];
+       }
+
+       if (record_val == 1) {
                hits.updateRI();
                nHits += hits.getNHits();
                nMulti += hits.calcNumGeneMultiReads(gi);
@@ -220,9 +224,11 @@ int main(int argc, char* argv[]) {
        fout<<N[0]<<" "<<N[1]<<" "<<N[2]<<" "<<(N[0] + N[1] + N[2])<<endl;
        fout<<nUnique<<" "<<nMulti<<" "<<nIsoMulti<<endl;
        fout<<nHits<<" "<<read_type<<endl;
+       fout<<"0\t"<<N[0]<<endl;
        for (iter = counter.begin(); iter != counter.end(); iter++) {
                fout<<iter->first<<'\t'<<iter->second<<endl;
        }
+       fout<<"Inf\t"<<N[2]<<endl;
        fout.close();
 
        release();