Skip to content

Commit

Permalink
include mapq
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasrausch committed Mar 15, 2024
1 parent 42ffb70 commit cd1af69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pct.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace lorax
// Output file
std::ofstream ofile;
ofile.open(c.outfile.string().c_str(), std::ofstream::out | std::ofstream::trunc);
ofile << "qname\tqlen\tqsublen\tpctidentity\tlargestdel\tlargestins\tmapped\tmatches\tmismatches\tdeletions\tdelsize\tinsertions\tinssize\tsoftclips\tsoftclipsize\thardclips\thardclipsize" << std::endl;
ofile << "qname\tmapq\tqlen\tqsublen\tpctidentity\tlargestdel\tlargestins\tmapped\tmatches\tmismatches\tdeletions\tdelsize\tinsertions\tinssize\tsoftclips\tsoftclipsize\thardclips\thardclipsize" << std::endl;

// Parse GAF
std::ifstream gafFile;
Expand Down Expand Up @@ -100,7 +100,7 @@ namespace lorax
// Percent identity
int32_t qsublen = ar.qend - ar.qstart;
double pctval = (double) (match) / (double) qsublen;
ofile << qname << '\t' << ar.qlen << '\t' << qsublen << '\t' << pctval << '\t' << largestdel << '\t' << largestins << "\taligned\t" << match << '\t' << mismatch << '\t' << del << '\t' << delsize << '\t' << ins << '\t' << inssize << '\t' << sc << '\t' << scsize << '\t' << hc << '\t' << hcsize << std::endl;
ofile << qname << '\t' << ar.mapq << '\t' << ar.qlen << '\t' << qsublen << '\t' << pctval << '\t' << largestdel << '\t' << largestins << "\taligned\t" << match << '\t' << mismatch << '\t' << del << '\t' << delsize << '\t' << ins << '\t' << inssize << '\t' << sc << '\t' << scsize << '\t' << hc << '\t' << hcsize << std::endl;
} else parseAR = false;
}

Expand All @@ -123,7 +123,7 @@ namespace lorax
// Output file
std::ofstream ofile;
ofile.open(c.outfile.string().c_str(), std::ofstream::out | std::ofstream::trunc);
ofile << "qname\tqlen\tqsublen\tpctidentity\tlargestdel\tlargestins\tmapped\tmatches\tmismatches\tdeletions\tdelsize\tinsertions\tinssize\tsoftclips\tsoftclipsize\thardclips\thardclipsize" << std::endl;
ofile << "qname\tmapq\tqlen\tqsublen\tpctidentity\tlargestdel\tlargestins\tmapped\tmatches\tmismatches\tdeletions\tdelsize\tinsertions\tinssize\tsoftclips\tsoftclipsize\thardclips\thardclipsize" << std::endl;

// Parse BAM
int32_t refIndex = -1;
Expand Down Expand Up @@ -165,7 +165,7 @@ namespace lorax

// Unmapped read
if (rec->core.flag & (BAM_FUNMAP)) {
ofile << bam_get_qname(rec) << '\t' << sequence.size() << "\t0\t0\t0\t0\tunmapped" << std::endl;
ofile << bam_get_qname(rec) << "\t0\t" << sequence.size() << "\t0\t0\t0\t0\tunmapped" << std::endl;
continue;
}

Expand Down Expand Up @@ -221,7 +221,7 @@ namespace lorax
uint32_t qsublen = querySubLength(rec);
uint32_t qlen = sequenceLength(rec);
double pctval = (double) (match) / (double) qsublen;
ofile << bam_get_qname(rec) << '\t' << qlen << '\t' << qsublen << '\t' << pctval << '\t' << largestdel << '\t' << largestins << "\taligned\t" << match << '\t' << mismatch << '\t' << del << '\t' << delsize << '\t' << ins << '\t' << inssize << '\t' << sc << '\t' << scsize << '\t' << hc << '\t' << hcsize << std::endl;
ofile << bam_get_qname(rec) << '\t' << rec->core.qual << '\t' << qlen << '\t' << qsublen << '\t' << pctval << '\t' << largestdel << '\t' << largestins << "\taligned\t" << match << '\t' << mismatch << '\t' << del << '\t' << delsize << '\t' << ins << '\t' << inssize << '\t' << sc << '\t' << scsize << '\t' << hc << '\t' << hcsize << std::endl;
}
if (seq != NULL) free(seq);
ofile.close();
Expand Down

0 comments on commit cd1af69

Please sign in to comment.