Trouble with bwasw BAM files

102 views
Skip to first unread message

Rod Docking

unread,
Aug 12, 2011, 5:05:24 PM8/12/11
to igv-...@googlegroups.com
Hi there:

I'm having some issues viewing BAM files generated by bwa bwasw and samtools (versions 0.5.9-r16 and 0.1.17, respectively). I generated them the usual way, e.g.:

bwa bwasw speciesA.hap_1.fa assembla_1.flanks.fa | samtools view -bS - | samtools sort - assembla_1.flanks.fa_hap1

When I load them in IGV (2.0.7), I'm able to view a few alignments, but then I repeatedly get an error dialog, with messages like this to the console:

ERROR [2011-08-12 13:57:54,675] [AlignmentDataManager.java:355] [pool-2-thread-2] Error loading alignments
org.broad.igv.exceptions.DataLoadException: <html>An error occurred while accessing: Error: java.lang.IllegalArgumentException: Bad byte passed to charToCompressedBase: -92<br>
at org.broad.igv.sam.CachingQueryReader.loadTiles(CachingQueryReader.java:341)
at org.broad.igv.sam.CachingQueryReader.getTiles(CachingQueryReader.java:182)
at org.broad.igv.sam.CachingQueryReader.query(CachingQueryReader.java:122)
at org.broad.igv.sam.AlignmentDataManager$2.run(AlignmentDataManager.java:330)
at org.broad.igv.util.LongRunningTask.call(LongRunningTask.java:74)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
ERROR [2011-08-12 13:57:55,525] [CachingQueryReader.java:340] [pool-2-thread-1] Error loading alignment data
java.lang.IllegalArgumentException: Bad byte passed to charToCompressedBase: -92
at net.sf.samtools.SAMUtils.compressedBaseToByteHigh(SAMUtils.java:199)
at net.sf.samtools.SAMUtils.compressedBasesToBytes(SAMUtils.java:85)
at net.sf.samtools.BAMRecord.decodeReadBases(BAMRecord.java:333)
at net.sf.samtools.BAMRecord.getReadBases(BAMRecord.java:263)
at net.sf.samtools.SAMRecord.getReadString(SAMRecord.java:194)
at org.broad.igv.sam.SamAlignment.<init>(SamAlignment.java:115)
at org.broad.igv.sam.reader.WrappedIterator.next(WrappedIterator.java:50)
at org.broad.igv.sam.reader.WrappedIterator.next(WrappedIterator.java:33)
at org.broad.igv.sam.CachingQueryReader.loadTiles(CachingQueryReader.java:236)
at org.broad.igv.sam.CachingQueryReader.getTiles(CachingQueryReader.java:182)
at org.broad.igv.sam.CachingQueryReader.query(CachingQueryReader.java:122)
at org.broad.igv.sam.AlignmentDataManager$2.run(AlignmentDataManager.java:330)
at org.broad.igv.util.LongRunningTask.call(LongRunningTask.java:74)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)


Thanks for any info you might be able to provide!

Rod

James Robinson

unread,
Aug 12, 2011, 6:09:39 PM8/12/11
to igv-...@googlegroups.com
Rod,   could you send me the entire igv.log file?  You can email it to me offline or to the "old" address,  igv-...@broadinstitute.org.    Is this repeatable at the same locus,  or random?  If its repeatable and you could send me a sample bam I'll send you an ftp address to send it to.

-- Jim

James Robinson

unread,
Aug 12, 2011, 6:13:41 PM8/12/11
to igv-...@googlegroups.com
Rod,

One more suggestion.  The error is being thrown from "Picard", and normally this indicates a problem with the BAM file itself.   The important bit of the stack trace is here, you might post this to the samtools list and see if they have suggestions.


Error loading alignment data
java.lang.IllegalArgumentException: Bad  byte passed to charToCompressedBase: -92
       at net.sf.samtools.SAMUtils.compressedBaseToByteHigh(SAMUtils.java:199)
       at net.sf.samtools.SAMUtils.compressedBasesToBytes(SAMUtils.java:85)
       at net.sf.samtools.BAMRecord.decodeReadBases(BAMRecord.java:333)


Jim



On Fri, Aug 12, 2011 at 5:05 PM, Rod Docking <rdoc...@bcgsc.ca> wrote:

Rod Docking

unread,
Aug 12, 2011, 6:38:06 PM8/12/11
to igv-...@googlegroups.com
Hi Jim:

Thanks for the quick response, and the suggestion to look at Picard.  It turns out this issue has been reported to samtools-devel before (embarrassingly, by Shaun Jackman, who sits just down the hall from me!).  It looks like Picard doesn't like ambiguity codes in contigs - I'll try permuting them all to N characters and loading it back into IGV.

Cheers,
Rod

James Robinson

unread,
Aug 12, 2011, 6:42:07 PM8/12/11
to igv-...@googlegroups.com
Oh right,  I remember now.  Embarrassingly I think Shaun reported this to me some time ago.  I'm surprised that's not fixed yet.

I will see if I can parse the message in this exception from Picard and popup a more helpful message.  How do I simulate this situation in a SAM file,  change some bases in the read sequence or reference to some special character?

Jim

Rod Docking

unread,
Aug 12, 2011, 6:53:33 PM8/12/11
to igv-...@googlegroups.com
Hi Jim:

Converting the ambiguous bases to 'N' characters and re-aligning worked for me.  You should indeed be able to duplicate this by permuting a few query bases in a SAM file to IUPAC ambiguity code letters like "R" or "Y":


Here's an example SAM record:

229708_7 16 chr0_1 1913739 144 400M * 0 0 TCAGACCTGCCGCATAGTGTAAAGTGGGCTTGCCACTGTATGTATAGGTCCTTCTTTAAATCACGCAGTCCGAAGTAAGGTGCAAAATCCTGGAGAACAGAATTTCTTTCTTTTATATGGTCAACTCACATGCCTTAAGAGATAAGAGGAAACCAGTTTAAGATCACAAATTCAAATGTCTAAGAACGAATCTTGAACCCGATCTGTGCTACTTTTCCATTGAACTTTTCAAATACAATTTATCTGTTCTGAGGGCTTATCTTATCTCAATAGCGTGGTGCCCTGCCCCCTATCTATTTATTCTATCAAGTGTTTAATGAGTTGAGGAACTTAGTRAAGAATAGAATAGACTTTAACATTCATATTATTTTGAATGTTGAGATATTCTTGTTAATTGTCC * AS:i:388 XS:i:175 XF:i:0 XE:i:9 XN:i:0

Cheers,
Rod
Reply all
Reply to author
Forward
0 new messages