I'm trying to upload a sorted bam file on the IGV browser and I get the following error message:
Fasta file has uneven line lengths in contig
Any ideas how to fix that?
Thanks
I'm trying to upload a sorted bam file on the IGV browser and I get the following error message:
Fasta file has uneven line lengths in contig
Any ideas how to fix that?
Thanks
The BAM file isn't the problem. It seems that you're trying to use a custom fasta file where the sequences are on lines of variable length (this commonly occurs if each chromosome/contig is on its own line). The simplest way to fix that is to simply run:
fold -w 80 foo.fa > bar.fa
and then import bar.fa
. This will work as long as you don't have any really long chromosome/contig descriptors (just check those with grep ">" foo.fa
).
Looked at their code that is throwing this error (search for the error message) seems the index file (fai) is giving issues for the fasta file you are using as a reference
//We loop through, generating a new FastaSequenceIndexEntry
//every time we see a new header line, or when the file ends.
//The last line can have a different number of bases/bytes
To troubleshoot you can try loading the bam file with a standard reference sequence (hg19/18).
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
The developers of IVG don't have the user in mind at all. IVG can't parse FASTA files unless you line break them at 80 characters. So that's equivalent to saying IVG doesn't support the FASTA standard.
I wouldn't say that and this isn't just IGV. You can't easily index random text files with multiple line lengths. That's what IGV and most other tools fail if you use inconsistent line lengths (they don't usually have to be 80 characters wide, but that's been the convention for a few decades).