Ensembl / Bio-DB-HTS

Git repo for Bio::DB::HTS module on CPAN, providing Perl links into HTSlib
Apache License 2.0
24 stars 16 forks source link

'missing SAM header' when opening SAM files #54

Closed AlexanderDilthey closed 6 years ago

AlexanderDilthey commented 7 years ago

Hi,

There seems to be an issue with iterating over alignments in a SAM file. I get the errors

[E::sam_parse1] missing SAM header
[W::sam_read1] parse error at line 4

although there are headers.

Code for reproducing the problem:

use Bio::DB::HTS;
my $sam =  Bio::DB::HTS->new(-bam => 'test.sam');
my $alignment_iterator = $sam->features(-iterator => 1);    
$alignment_iterator->next_seq;

and test.sam:

@HD VN:1.5  SO:coordinate
@SQ SN:ref  LN:100
r001    99  ref 1   30  1M3D2M  =   37  3   TAT *
r002    99  ref 1   30  1M2D2M  =   37  3   TAT *

samtools can view the SAM without problems.

avullo commented 6 years ago

Hi @AlexanderDilthey, this is now sorted on master. You can check it out or wait until the new release happening soon.

Let me know,

Alessandro