bwa
bwa copied to clipboard
bugfix: HD line should be printed before SQ
Fixes a long standing bug, but made more apparent in https://github.com/lh3/bwa/pull/336. Thank @jmarshall for pointing this out.
I tested this by on my local machine three ways.
- Not specifying
-H
, so the default header line should be emitted at the start of the SAM:
./bwa mem phix.fasta phix.fastq
[M::bwa_idx_load_from_disk] read 0 ALT contigs
@HD VN:1.5 SO:unsorted GO:query
@SQ SN:gi|9626372|ref|NC_001422.1| LN:5386
...
- Specifying
-H
with@HD
, so the user provided header line should be emitted at the start of the SAM:
./bwa mem -H '@HD VN:1.4 SO:unsorted GO:query' phix.fasta phix.fastq
[M::bwa_idx_load_from_disk] read 0 ALT contigs
@HD VN:1.4 SO:unsorted GO:query
@SQ SN:gi|9626372|ref|NC_001422.1| LN:5386
...
- Specifying
-H
with@CO
, so the default header line should be emitted at the start of the SAM, while the CO line should be after the SQ lines.
./bwa mem -H '@CO ID:id' phix.fasta phix.fastq
[M::bwa_idx_load_from_disk] read 0 ALT contigs
@HD VN:1.5 SO:unsorted GO:query
@SQ SN:gi|9626372|ref|NC_001422.1| LN:5386
@CO ID:id
Superceded by #348, which completely refactors this function.
Closing in favor of #348 (more flexible) and in the hopes that this increases the chances the latter is merged!