Problem with scanBam
1
1
Entering edit mode
felix.klein ▴ 150
@felixklein-6900
Last seen 4.6 years ago
Germany

Hello,

somehow the scanBam function does not properly read in the mapq scores from this file:

HWI-ST227:407:C56MLACXX:1:1316:6877:64103    0    chr10    3153911    255    24M    *    0    0    CCCAATTAATGGGGGCAGGATAAG    HFHGHI@DAEI@GGIDEBGFGHHG    NH:i:1    HI:i:1    AS:i:19    nM:i:2
HWI-ST227:407:C56MLACXX:1:2102:2752:79037    0    chr10    3153911    255    24M    *    0    0    CCCAATTAATGGGGGCAGGATAAG    HGIJJIIJJIGHIJJJIJJIJJIG    NH:i:1    HI:i:1    AS:i:19    nM:i:2
HWI-ST227:407:C56MLACXX:1:2113:3448:85785    0    chr10    3175788    255    24M    *    0    0    TCTTTTAGATCTATTTACTCTGGA    ########################    NH:i:1    HI:i:1    AS:i:19    nM:i:2
HWI-ST227:407:C56MLACXX:1:1203:13148:73589    16    chr10    3180818    255    24M    *    0    0    TAGGCTTCAAGGAGAGTCTCCTGT    ?DBEIIEDD?99>C@DEEE9FFC4    NH:i:1    HI:i:1    AS:i:23    nM:i:0

They all should be 255 but are read in as NA.

The code I used was just:

scanBam("test.bam")[[1]]$mapq
 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[34] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA

What could be the reason for this?

Best regards,

Felix

PS: How could I provide the test.bam file for testing?

scanBam scanbamparam • 916 views
ADD COMMENT
1
Entering edit mode
@martin-morgan-1513
Last seen 8 days ago
United States

It's an intentional (maybe misguided?) interpretation of the SAM spec,

5. MAPQ: MAPping Quality. It equals −10 log10 Pr{mapping position is wrong},
   rounded to the nearest integer. A value 255 indicates that the mapping
   quality is not available.

translating the magic number '255' to the R representation 'NA'.

ADD COMMENT
0
Entering edit mode

Martin I see your point, however the value 255 for MAPQ is often used (in particular by the aligner topHat and STAR) for uniquely mapped reads. 
This may not be a good practice ("No alignments should be assigned mapping quality 255" (SAM spec, "2 Recommended practice for the SAM format"), but it is used, maybe by default scanBAM could allow 255?

ADD REPLY
1
Entering edit mode

I'll likely change the behavior, unless I hear arguments against...

ADD REPLY
0
Entering edit mode

Should be updated in Rsamtools 1.19.42, in svn now and hopefully via biocLite() after Sunday at 10am ish

ADD REPLY

Login before adding your answer.

Traffic: 530 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6