This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Predict/Estimate/Find Bwa Parameters From Bam Or Sam File

Hi All,

I would like to know if there is a way of finding out the parameters of BWA aligned BAM/SAM file. I am aware that samtools might able to tell what is the version of BWA was used by using the following command:

samtools view -H File.bam | grep PG

However, what I am looking for is the parameters that were used in generating the BAM/SAM file such as the quality of the alignment (-q) and/or information about distance, gap and seed random number?

Cheers

bwa bam sam

This is a very good question. Projects like the 1000G have a comment on top of the files with the exact command-line used for generating the BAM file, but if such information is missing, there should be a way of estimating the parameters used from the list of hits. This would be very useful for reproducibility of results. Looking forward to the answers.

2 answers

The PG header line can optionally contain a CL field with the command line that was used to run the mapper. If you don't see a CL field in the PG header, then BWA probably doesn't output it. I am afraid there really is no way to obtain the exact command used to run BWA.

Two suggestions, ranked in order of increasing difficulty and decreasing sensibility:

1) Contact the producer of the bam and ask them.

2) Extract the reads from the bam and remap a subset of them using different combinations of parameters. Check the alignments against the original bam and try to match them up.

(Note - I didn't say 2 was a good idea, but if you have a lot of free time and CPU cycles and REALLY need the information, it might work).

Log in to answer this question.