Question: IGV error: Error loading SAM header: For sequence 34711, text and binary have different lengths in file.
0
gravatar for EVR
2.9 years ago by
EVR570
Earth
EVR570 wrote:

HI,

I have sam file and I converted into a bam and later sorted it. I also created bam index for the sorted_bam file. When I am trying to load the bam files into IGV, I am getting the following error:

Error loading SAM header: For sequence 34711, text and binary have different lengths in file.

Can I anyone guide me why the error is popping out.

Thanks in advance

igv rna-seq bam • 1.8k views
ADD COMMENTlink modified 2.9 years ago by dyollluap300 • written 2.9 years ago by EVR570
1

error is here: https://github.com/samtools/htsjdk/blob/master/src/main/java/htsjdk/samtools/BAMFileReader.java#L686

it happens when you have a difference between the chromosome/contig associated to your read, and what was defined in the SAM header. Did you re-header something ?

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by Pierre Lindenbaum128k

All i did was mapping the reads onto transcriptome and obtained a sam file which is later converted into bam as I shown below. Is there any way to look which transcript_Id/Contig_Id got corrupted? or should I have to remap

ADD REPLYlink written 2.9 years ago by EVR570

I have sam file and I converted into a bam and later sorted it. I also created bam index for the sorted_bam file.

Please be as complete as possible and add the following:

  • the commands you used for sam -> bam, sorting and indexing
  • Your version of samtools and igv
ADD REPLYlink written 2.9 years ago by WouterDeCoster43k
My samtools version : 1.3
My IGV version: 2.3.97

Command for converting sam to bam file:

samtools view --threads 40 -F 4 -bS -o mySample.bam -O bam mySample.sam

Command for sorting:

samtools sort --threads 40 -o Sorted_mySamlpe.bam -O bam mySample.bam

Command for indexing:

samtools index mySample.bam

ADD REPLYlink written 2.9 years ago by EVR570
1
gravatar for dyollluap
2.9 years ago by
dyollluap300
USA, California, Bay Area
dyollluap300 wrote:

Usually I see that different lengths in file error when different versions of the reference assembly have been used in whatever process is being performed. In this case, if the reference.fa you used for building a bam index is different from the original sam alignment, you get this error.

ADD COMMENTlink written 2.9 years ago by dyollluap300
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 986 users visited in the last hour