Hello Claudio, On Mon, Dec 07, 2015 at 12:18:22PM +0100, Claudio Alberti wrote: > lOffset = hts_utell(htsInputFile); > hts_useek(htsInputFile, lOffset, SEEK_SET); > > Now the problem is that after parsing a few records I get an assertion > > bgzf_useek: Assertion `fp->block_offset <= fp->block_length' failed. > > fp->block_offset is 66644 while block_length is 65498. > Any idea why this is happening and how to prevent it?
See also this thread: http://sourceforge.net/p/samtools/mailman/message/34430632/ I'm less clear on the actual fix though, sorry for not realising this earlier when I replied to you. From reading that thread it appears: - hts_seek / hts_tell (or useek/utell) aren't supported functions. They're not in public header files, so shouldn't be expected to work (and indeed don't in all cases as you've seen). I'm not sure what's missing / broken though, perhaps just the purging of the read-ahead buffer after a seek. - htell/hseek only work if all of your I/O is via the lower level hFILE object. If you try to fix hts_file I/O with htell/hseek then the buffering breaks things. (The analogy is lseek on a fileno(fp) for FILE* and then try using fread.) I'm not sure the solution actually exists therefore apart from rolling your own interface or avoid using the hts_file layer and do all BAM reading via the lower level bgzf_open/bgzf_read layer. (And similarly with a different code path for CRAM.) Probably not the answer you wanted. James -- James Bonfield ([email protected]) | Hora aderat briligi. Nunc et Slythia Tova | Plurima gyrabant gymbolitare vabo; A Staden Package developer: | Et Borogovorum mimzebant undique formae, https://sf.net/projects/staden/ | Momiferique omnes exgrabure Rathi. -- The Wellcome Trust 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. ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Samtools-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/samtools-help
