BGZP file has invalid uncompressed length: -1478510311

2,019 views
Skip to first unread message

Allen Blancett

unread,
Mar 19, 2016, 3:07:28 PM3/19/16
to igv-help
1.  Using IGV Version 2.3.69 (98)
2.  I opened 4 BAM files for comparison, then entered a ChrY position, then Go.
3.  I expected to see the results for each of the four BAM files to allow comparisons.
4.  I got this error message:  Error encountered querying alignments:  htsjdk.samtools.util.RuntimeIOException: BGZF file has invalid uncompressed length: -1478510311.
     Also see the attached screen shot and the igv.log file.

IGV Screen Shot.pdf
igv.log

Jim Robinson

unread,
Mar 19, 2016, 4:40:49 PM3/19/16
to igv-...@googlegroups.com
That usually indexed a bad or out-of-date index.   Try recomputing the index for the bams, or if you want to confirm this try extracting the same region you are trying to view with "samtools view".
--

---
You received this message because you are subscribed to the Google Groups "igv-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to igv-help+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/igv-help/de3d51cc-a976-463e-9014-75de6dc314ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Allen Blancett

unread,
Mar 19, 2016, 5:03:47 PM3/19/16
to igv-help
Thanks, Jim.  I need some more help.  I had unzipped the problematic BAM file in the same way I unzipped the three that worked right, so I'm puzzled.  Now I've downloaded and unzipped samtools-1.3, but I haven't been clever enough to figure out how to use samtools view.  And how would I recompute the index?  

Jim Robinson

unread,
Mar 19, 2016, 5:07:01 PM3/19/16
to igv-...@googlegroups.com
Hi, if you unzipped the file that is the problem,  you won't be able to view an unzipped bam file in any tool.   There are block-gzipped with a specific tool,  and I'm not sure you can recover them easily.   It might be enough to use "bgzip" to block-gzip the tool again,  then use samtools to index.   Check the samtools website (google "samtools alignments") for details.

Jim Robinson

unread,
Mar 19, 2016, 5:56:00 PM3/19/16
to igv-...@googlegroups.com
Allen,

Sorry I didn't answer your question exactly, let me try again.   I was thrown and a little confused by your reference to "unzipping" the file.   If 3 of them worked then whatever you did was o.k.

You'll need to refer to the samtools page for explicit instructions,  I don't do this often myself,  but from memory here are the steps.   You will need a linux or Mac to do this.   If you are on a PC reply and we'll try to figure something else out

(1) build samtools, unless you downloaded a pre-built version.   You should be able to just type "make" from the samtools directory
(2) after building, locate the "samtools" executable. 
(3) run the executable with the "index" command.   Refer to the samtools documentation for details here: http://www.htslib.org/doc/samtools.html
(4) to verify,  run the "view" command, again details are here: http://www.htslib.org/doc/samtools.html

Jim





On 3/19/16 5:03 PM, Allen Blancett wrote:

Allen Blancett

unread,
Mar 19, 2016, 7:06:18 PM3/19/16
to igv-help
Jim,
Thanks again.  I take some comfort in your saying I need a linux or Mac--I use a PC.  So where can we go next?  I have a samtools-1.3.tar compressed folder, but I'm at a loss regarding how to use it. 

Jim Robinson

unread,
Mar 19, 2016, 7:18:30 PM3/19/16
to igv-...@googlegroups.com
If you have a PC "Picard" might work:  http://broadinstitute.github.io/picard/.  See the command "BuildBamIndex" http://broadinstitute.github.io/picard/command-line-overview.html

Another option is to ask the source of this bam file to rebuild the index for you, if that's possible.

Jim

Allen Blancett

unread,
Mar 19, 2016, 8:40:37 PM3/19/16
to igv-help
Jim,
Picard did the trick!  Thanks a bunch for your help.  I've been lazy with Windows for so long that I had to think back many years to remember how to use the command prompt and type in the exact command.  But it worked.  I appreciate your help!
Allen
Reply all
Reply to author
Forward
0 new messages