fwiw, I marked this reply as helpful because the @PG tags are optional, and you give some good suggestions of what to look for if the info is not in the bam header.
I've got some bam files from other people. Because I've only tried BWA (not bowtie or other things) so I just take it for granted that it's produced by BWA.
Now I highly doubt if it's produced by BWA. I'm just wondering is there any way to check if bam file is produced by BWA or other programs? (say use samtools view?)
Thanks
2 answers
The @PG tag in the header will tell you this:
$ samtools view -H your_file.bam | grep PG
@PG ID:bowtie2 PN:bowtie2 VN:2.0.0-beta3
The SAM specification is a great resource for details:
There is no requirements in the SAM format headers to display the mapping program used. You might be able to guess what mapping program was used by looking at the optional fields in each SAM mapping line.
If you look at the manuals for bowtie (http://bowtie-bio.sourceforge.net/manual.shtml) and bwa (http://bio-bwa.sourceforge.net/bwa.shtml).
Bowtie can optionally generate: NM CM MD XA XM
BWA can optionally generate: NM MD AS BC X0 X1 XN XM XO XG XT XA XS XF XE
You can see if there are any BWA specific fields in your sAM entries. But it's kind of a hack honestly.
edit*** nevermind, Brad has the answer :)
Log in to answer this question.