Ah, thanks for pointing out the tabs issue, I fixed my exporter to match
the spec.  I found and fixed my issue as well which turns out was unrelated
to htslib. :-)

-Will

On Fri, Nov 16, 2018 at 4:26 AM James Bonfield <j...@sanger.ac.uk> wrote:

> Hello Will,
>
> Sorry for the slow reply.
>
> On Fri, Nov 09, 2018 at 09:43:46PM -0500, Will Stokes wrote:
> > [W::bam_hdr_read] EOF marker is absent. The input is probably truncated
>
> This is a confusing message.
>
> It's claiming EOF marker is absent, but I don't think it is.
> I suspect it's due to the @HD line using spaces instead of tabs and
> triggering something else.
>
> For me samtools reads your file just fine, despite the broken header.
>
> Scramble correctly reports the missing tab and Picard reports a
> malformed header.
>
> > In order to write the SAM/BAM files I make the following calls:
> >
> > sam_open
> >
> > sam_hdr_write
> >
> > sam_write1
> >
> > sam_close
>
> That looks fine to me.
>
> > This is with the most recent release of htslib. When writing a BAM file I
> > find:
> >
> >
> > outputFile->format.compression = 2
> >
> > outputFile->format.compression_level = -1
>
> Level -1 just means default zlib compression.
>
> The compression value is the htsCompression enum with 2 being bgzf,
> which is correct.
>
> > From reading the SAM/BAM specification it sounds like I'm missing a 28
> byte
> > EOF at the end of my file. Am I expeted to write those 1f 8b .. 00 00
> bytes
> > myself manually, or was htslib supposed to have done that for me, or is
> > there some htslib command I have failed to call?
>
> No, the close will do it for you.
>
> > Note reading the header for this file works, but sam_read1 fails so I
> > cannot parse the various reads.
>
> Odd that I don't see this with "samtools view" nor htslib/test_view.
>
> James
>
> --
> James Bonfield (j...@sanger.ac.uk)
> The Sanger Institute, Hinxton, Cambs, CB10 1SA
>
>
> --
>  The Wellcome Sanger Institute is operated by Genome Research
>  Limited, a charity registered in England with number 1021457 and a
>  company registered in England with number 2742969, whose registered
>  office is 215 Euston Road, London, NW1 2BE.
>
>
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to