Skip to content

Commit b4b499d

Browse files
committed
Use bam mapping file for sequence quality
1 parent 26d7d3a commit b4b499d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sequence/bamreader.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ bool BamReader::next()
2424
char *chr = bamHdr->target_name[aln->core.tid] ; //contig name (chromosome)
2525
uint32_t len = aln->core.l_qseq; //length of the read.
2626

27-
uint8_t *q = bam_get_seq(aln); //quality string
28-
uint32_t q2 = aln->core.qual ; //mapping quality
27+
uint8_t *q = bam_get_seq(aln); //sequence string
28+
uint8_t *q2 = bam_get_qual(aln); //sequence quality
2929

30-
char *qseq = (char *)malloc(len);
30+
char *qseq = static_cast<char *>(malloc(len));
31+
char* qqua = static_cast<char *>(malloc(len));
3132

3233
for(int i=0; i< len ; i++){
3334
qseq[i] = seq_nt16_str[bam_seqi(q,i)]; //gets nucleotide id and converts them into IUPAC id.
35+
qqua[i] = static_cast<char>(q2[i]);
3436
}
3537

3638
seq.setSequence(QByteArray(qseq, len));
37-
seq.setQuality(QByteArray(qseq, len));
39+
seq.setQuality(QByteArray(qqua, len));
3840

3941

4042
// update sequence

0 commit comments

Comments
 (0)