gt1 / biobambam2

Tools for early stage alignment file processing
Other
93 stars 17 forks source link

bamsort - SO:coordinate not being added to @HD line #11

Closed amatchan closed 8 years ago

amatchan commented 8 years ago

Hi there, I'm running a bamsort command on my RNA-Seq mapped BAM file which has been aligned with STAR. The sort command completes successfully with no errors and I am able to use the BAM file in downstream analysis that requires BAM files to be coordinate sorted but the header line just looks like this with no SO:coordinate tag added which is not what I would expect: @HD VN:1.4

The version of bamsort I am using is: 2.0.25

The command I am running is this: bamsort I=Aligned.out.bam fixmate=1 inputformat=bam level=1 tmpfile=./star/tmp O=Aligned.sortedByCoord.out.bam inputthreads=4 outputthreads=4

When I run a samtools sort command, the SO:coordinate tag is added. Can you think of why this might be happening?

Thanks Angela

gt1 commented 8 years ago

Hi Angela,

bamsort so far only ever updated an existing sort order tag but never added one by itself. I have changed this in the latest release (2.0.31). Could you please check whether this works better for you?

Thanks German

amatchan commented 8 years ago

Hi German, thanks for the quick reply. Yes I've just done some further checking and can see that the STAR command outputs a BAM with just this in the header line to start with: @HD VN:1.4

If I manually rehead the file with samtools reheader to add: SO:unsorted, then bamsort will work. I'm constrained to using v2.0.25 in our production environment at the moment but I should be able to at least modify the input BAM to add the SO:unsorted tag.

I'll test v 2.0.31 and, if that works, will request that our system moves to that asap.

Thanks very much Angela