|
From: Henrik B. <hb...@bi...> - 2013-08-23 01:05:39
|
Hi,
'samtools index' gives me the following error:
[bam_index_core] the alignment is not sorted: reads without
coordinates prior to reads with coordinates.
[bam_index_build2] fail to index the BAM file.
if the BAM file was 'samtools sort':ed using samtools v0.1.19, but not
samtools v0.1.18. All details are below.
# DATA:
## BAM file:
foo.bam [425,850,792 bytes; bd32ab151e3a664f68edc8ab6bea2a71]
This was generated via BWA alignment, i.e. "bwa aln -n 2 -q 40 ..."
followed by "bwa samse -r
@RG\tSM:LH001\tPL:Illumina\tPU:D278VACXX.5.LH001\tID:1 ...").
% samtools view -h foo.bam | head
@HD VN:1.3 SO:coordinate
@SQ SN:1 LN:249250621
@SQ SN:2 LN:243199373
@SQ SN:3 LN:198022430
@SQ SN:4 LN:191154276
@SQ SN:5 LN:180915260
@SQ SN:6 LN:171115067
@SQ SN:7 LN:159138663
@SQ SN:8 LN:146364022
@SQ SN:9 LN:141213431
# SORTING:
## Sorting using samtools 0.1.18 (r982:295):
% samtools-0.1.18/samtools sort foo.bam foo.sort.samtools0_1_18
=> (a) foo.sort.samtools0_1_18.bam [425,254,135 bytes;
e832f4575d7c7ce98f22c9f6386ca54a]
## Sorting using samtools 0.1.19-44428cd:
% samtools-0.1.19/samtools sort foo.bam foo.sort.samtools0_1_19
=> (b) foo.sort.samtools0_1_19.bam [425,293,387 bytes;
0dcd0a5b867d3e049d1edd35fe09445a]
# INDEXING:
## Indexing (a) using samtools 0.1.18 (r982:295):
samtools-0.1.18/samtools index foo.sort.samtools0_1_18.bam
=> foo.sort.samtools0_1_18.bam.bai [8,274,272 bytes;
828580343579031313b05b3fccc32ff6]
## Indexing (a) using samtools 0.1.19-44428cd:
samtools-0.1.19/samtools index foo.sort.samtools0_1_18.bam
=> foo.sort.samtools0_1_18.bam.bai [8,274,272 bytes;
828580343579031313b05b3fccc32ff6]
Both (a) and (b) outputs:
cclc01{henrik}: samtools view -h foo.sort.samtools0_1_1?.bam | head
@HD VN:1.3 SO:coordinate
@SQ SN:1 LN:249250621
@SQ SN:2 LN:243199373
@SQ SN:3 LN:198022430
@SQ SN:4 LN:191154276
@SQ SN:5 LN:180915260
@SQ SN:6 LN:171115067
@SQ SN:7 LN:159138663
@SQ SN:8 LN:146364022
@SQ SN:9 LN:141213431
## Indexing (b) using samtools 0.1.18 (r982:295):
samtools-0.1.18/samtools index foo.sort.samtools0_1_19.bam
=>
[bam_index_core] the alignment is not sorted: reads without
coordinates prior to reads with coordinates.
[bam_index_build2] fail to index the BAM file.
## Indexing (b) using samtools 0.1.19-44428cd:
samtools-0.1.19/samtools index foo.sort.samtools0_1_19.bam
=>
[bam_index_core] the alignment is not sorted: reads without
coordinates prior to reads with coordinates.
[bam_index_build2] fail to index the BAM file.
I should also say that it happens with other files from the same data
set, but not on small toy FASTQ/BAM files.
Any thoughts, comments, workarounds? Anyone experienced this before?
Thanks,
Henrik
|