I tried it, it was throwing up lot of errors.
Hi, I have two output reads in Sam format generated from mapping to a reference genome, I would like to know if any tools or command available to compare the two generated sam files. This comparison is done to check if the mappings are same in both the sam files. Kindly help.
Thanks Madhu
2 answers
I happened to write something a while back to compare equivalently sorted files from different aligners (or with different settings, or with/without post-processing) to see which alignments differ and why. It currently compares chromosome, position, and the cigar string and prints out information about the differences. If you happen to know C then this could be modified to return something else.
Aside from that, you can at least use bamhash to see if both files have the same reads (though the alignments themselves aren't checked).
It was likely printing a lot of output (assuming you got it compiled).
Curious if others have also benefited from Picard's CompareSAMs tool. Seems to do exactly what Madhu has requested.
If the headers are identical, this would generate SAM files match if the mappings are the same
java -jar picard.jar CompareSAMs \
file_1.bam \
file_2.bam \
O=comparison.tsv
I have used the LENIENT_HEADER=true option to compare SAM files where the headers differ, which has saved a lot of time
Log in to answer this question.
This is going to be always tricky but this recent thread may be of help: BAM file comparison