Samtools-0.1.18: Samtools View Filtering Based On Chromosome Reports Wrong Output
1
0
Entering edit mode
12.4 years ago
Rm 8.3k

If i filter based on non-existing chromosome: it displays output from random chromosome say from 1 or 2

samtools view input.sorted.bam M | head

/soft/samtools-0.1.18/samtools view Sample_2_NS.bam.sorted.bam 555 | head

HWI-ST388-W7D:304:D0KG0ACXX:1:1301:12638:194719 89      1       9993    37      7M2D83M =       9993    0       CTGTCTGCACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCC    <<<>>587A<=<;53???>;6>?6?;7>?6ADA@DCA@7C@CB?0DDBB?3DDDDDEDC:):1EEC8CACAEC?3@EDDA<DBB:DA?<=       RG:Z:120208_SN388_0304_AD0KG0ACXX       XT:A:U  NM:i:4  XN:i:8  SM:i:37 AM:i:0  X0:i:1  X1:i:0  XM:i:2  XO:i:1XG:i:2   MD:Z:5C1^AT0A82
HWI-ST388-W7D:304:D0KG0ACXX:1:1301:12638:194719 181     1       9993    0       *       =       9993    0       AAATAATTCATTCCCCCCACCTCCCACGGCAGGGGGTAGCGTGGGAATCAAGCATGTGTACGGCCCTGCCCCCGCCAGACCCTTCTAACT    ####################################################################DJIHF@GC?BHAFDDBDDD@B?       RG:Z:120208_SN388_0304_AD0KG0ACXX

Is this a bug? or I am i doing something wrong?

samtools bam • 4.3k views
ADD COMMENT
0
Entering edit mode
12.4 years ago
matted 7.8k

In my tests and looking at the latest source, it will ignore unknown chromosome names and simply output the records in the order of the BAM file with no filtering. If you try to give it an unknown reference name and position range, it will print "foo specifies an unknown reference name. Continue anyway." and again print records with no filtering. What is your desired behavior? I wouldn't say this is a bug, since it's working as designed and follows a reasonable (albeit undocumented, though easily guessable) choice.

ADD COMMENT
0
Entering edit mode

I still think that it is a bug; as it should output anything irrelevant if not present in the bam.

In my pipeline: I used M instead of MT for extracting mitochondria: that resulted in extracting all the alignments from Chr2 without any error messages.

ADD REPLY

Login before adding your answer.

Traffic: 1672 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