Question: Could You Trust The Bam Header So:Coordinate?
3
gravatar for Pablo Marin-Garcia
7.7 years ago by
Spain
Pablo Marin-Garcia1.8k wrote:

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 bam sequencing • 2.4k views
ADD COMMENTlink written 7.7 years ago by Pablo Marin-Garcia1.8k
3

Did you see this post ? http://biostar.stackexchange.com/questions/5273

ADD REPLYlink written 7.7 years ago by Pierre Lindenbaum116k
1

@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 REPLYlink written 7.7 years ago by Pablo Marin-Garcia1.8k
1

@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 REPLYlink written 7.7 years ago by Pablo Marin-Garcia1.8k
1

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

ADD REPLYlink written 7.7 years ago by Pablo Marin-Garcia1.8k

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 REPLYlink written 7.7 years ago by toni2.1k
0
gravatar for Pablo Marin-Garcia
7.5 years ago by
Spain
Pablo Marin-Garcia1.8k wrote:

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 COMMENTlink modified 7.3 years ago • written 7.5 years ago by Pablo Marin-Garcia1.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2035 users visited in the last hour