Could You Trust The Bam Header So:Coordinate?
1
3
Entering edit mode
12.9 years ago

I can remember where I read it but, I recall that I have read some where that if you have a bam sorted, you can unsorted it and some programs don't change the header (was samtools? picard?) so the SO:coordinate still is there. Is that true? Could I be sure that a file is sorted only looking to the bam header SO tag? or should I need always double check sorting them with samtools sort?.

Which is your preferred way of checking that the bam files passed to you are really sorted?

next-gen sequencing bam • 4.6k views
ADD COMMENT
3
Entering edit mode

Did you see this post?

ADD REPLY
1
Entering edit mode

@pierre I saw it after asking the question, but it does not answer directly to the question: can I trust the SO label? , never the less was very useful and your program from your blog seems a nice option.

ADD REPLY
1
Entering edit mode

@tony, this is the program I was mentioning from his blog.

http://plindenbaum.blogspot.com/2011/02/testing-if-bam-file-is-sorted-using.html

ADD REPLY
1
Entering edit mode

Pierre, if you write your comment as an answer I will choose it and you will obtain extra points ;-).

ADD REPLY
0
Entering edit mode

you could also use a C program that Pierre wrote using samtools API some time ago (bamsorted.c) to check if it's sorted. Merci Pierre by the way !

ADD REPLY
0
Entering edit mode
12.7 years ago

From post "is my BAM file sorted?" and post http://plindenbaum.blogspot.com/2011/02/testing-if-bam-file-is-sorted-using.html and their comments, seems that there is not a definitive answer and the safest thing is to index the bam file and it will throw an error if not sorted (some people report that this does not work in old samtools versions). Other option is to use Pierre script.

ADD COMMENT

Login before adding your answer.

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