Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading CRAM files failed with release 2.16.0 #1286

Closed
antonylebechec opened this issue Feb 16, 2023 · 7 comments · Fixed by #1290
Closed

Loading CRAM files failed with release 2.16.0 #1286

antonylebechec opened this issue Feb 16, 2023 · 7 comments · Fixed by #1290
Assignees

Comments

@antonylebechec
Copy link

antonylebechec commented Feb 16, 2023

Dear IGVTeam,

Dealing with CRAM files, I used to open them with IGV (release 2.12.13). However, IGV release 2.16.0 doesn't open correctly CRAM files.

These CRAM files were generated using samtools (1.15.1) and these parameters: "version=3.0,level=9,no_ref" (version 3.0, compression level 9 and include references, i.e. all bases, no need reference genome)
and are indexed in crai

OS: Mac (intel)
IGV: MacApp 2.16.0 (with Java)

I tried also releases 2.13.2, 2.14.0, 2.15.4, and they failed too.

Do you have more information about this issue?

IGV [2.16.0]
image

IGV [2.12.13]
image

@jrobinso
Copy link
Contributor

It's hard to say what the problem is with screenshots, and this is the first report of this we have had. All crams that I have tried load without error. Could you share your igv.log file, it should have some diagnostic information. Its located in an "igv" folder under your home directory, and will have a name like. "igv0.log" or similiar. There could be several, we just need the log for the time you experienced the issue. You can zip and attach here, or if you'd rather not have it public email to igvteam (at) broadinstitute.org

@antonylebechec
Copy link
Author

Dear @jrobinso,

Sure, screenshots were just to illustrate, in case you already had this issue.

So, here is the log file (IGV 2.16.0):

INFO [févr. 17,2023 12:20] [Main] Startup  IGV Version 2.16.0 01/25/2023 01:50 PM
INFO [févr. 17,2023 12:20] [Main] Java 11.0.13 (build 11.0.13+8) 2021-10-19
INFO [févr. 17,2023 12:20] [Main] Java Vendor: Eclipse Adoptium https://adoptium.net/
INFO [févr. 17,2023 12:20] [Main] JVM: OpenJDK 64-Bit Server VM Temurin-11.0.13+8
INFO [févr. 17,2023 12:20] [Main] OS: Mac OS X 13.1 x86_64
INFO [févr. 17,2023 12:20] [Main] IGV Directory: /Users/lebechea/igv
INFO [févr. 17,2023 12:20] [CommandListener] Listening on port 60151
INFO [févr. 17,2023 12:20] [GenomeManager] Loading genome: https://s3.amazonaws.com/igv.org.genomes/hg19/hg19.json
INFO [févr. 17,2023 12:20] [TrackLoader] Loading resource:  https://s3.amazonaws.com/igv.org.genomes/hg19/ncbiRefSeq.sorted.txt.gz
INFO [févr. 17,2023 12:21] [TrackLoader] Loading resource:  /Users/lebechea/STARK/output/repository/SOMATIC/SOLIDTUMOR/RUN_TEST_920/Sample4/STARK/Sample4.archive.cram
SEVERE [févr. 17,2023 12:21] [TrackLoader] null
SEVERE [févr. 17,2023 12:21] [TrackLoader] java.lang.NullPointerException
        at htsjdk@3.0.0/htsjdk.samtools.cram.structure.CRAMRecordReadFeatures.getByteOrDefault(CRAMRecordReadFeatures.java:498)
        at htsjdk@3.0.0/htsjdk.samtools.cram.structure.CRAMRecordReadFeatures.restoreReadBases(CRAMRecordReadFeatures.java:419)
        at htsjdk@3.0.0/htsjdk.samtools.cram.structure.CRAMCompressionRecord.restoreReadBases(CRAMCompressionRecord.java:468)
        at htsjdk@3.0.0/htsjdk.samtools.cram.structure.Slice.normalizeCRAMRecords(Slice.java:507)
        at htsjdk@3.0.0/htsjdk.samtools.cram.structure.Container.getSAMRecords(Container.java:322)
        at htsjdk@3.0.0/htsjdk.samtools.CRAMIterator.nextContainer(CRAMIterator.java:112)
        at htsjdk@3.0.0/htsjdk.samtools.CRAMIterator.hasNext(CRAMIterator.java:204)
        at htsjdk@3.0.0/htsjdk.samtools.SamReader$AssertingIterator.hasNext(SamReader.java:608)
        at org.igv/org.broad.igv.sam.reader.WrappedIterator.hasNext(WrappedIterator.java:49)
        at org.igv/org.broad.igv.sam.AlignmentUtils.firstAlignments(AlignmentUtils.java:243)
        at org.igv/org.broad.igv.sam.AlignmentDataManager.inferType(AlignmentDataManager.java:400)
        at org.igv/org.broad.igv.sam.AlignmentTrack.init(AlignmentTrack.java:352)
        at org.igv/org.broad.igv.track.TrackLoader.loadAlignmentsTrack(TrackLoader.java:966)
        at org.igv/org.broad.igv.track.TrackLoader.load(TrackLoader.java:161)
        at org.igv/org.broad.igv.ui.IGV.load(IGV.java:1249)
        at org.igv/org.broad.igv.ui.IGV.loadResources(IGV.java:1179)
        at org.igv/org.broad.igv.ui.IGV$2.run(IGV.java:409)
        at org.igv/org.broad.igv.util.LongRunningTask.call(LongRunningTask.java:72)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

SEVERE [févr. 17,2023 12:21] [IGV] Error loading track
SEVERE [févr. 17,2023 12:21] [IGV] java.lang.NullPointerException
        at org.igv/org.broad.igv.exceptions.DataLoadException.<init>(DataLoadException.java:38)
        at org.igv/org.broad.igv.track.TrackLoader.load(TrackLoader.java:272)
        at org.igv/org.broad.igv.ui.IGV.load(IGV.java:1249)
        at org.igv/org.broad.igv.ui.IGV.loadResources(IGV.java:1179)
        at org.igv/org.broad.igv.ui.IGV$2.run(IGV.java:409)
        at org.igv/org.broad.igv.util.LongRunningTask.call(LongRunningTask.java:72)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

Here are also the CRAM and CRAI files I used (just a test sample for devel):
Sample4.archive.cram.zip
Sample4.archive.cram.crai.zip

Thanks for your help!

@antonylebechec
Copy link
Author

I just test release 2.16.0 on a Windows system. It seems that the same issue append.

igv0.log

@antonylebechec
Copy link
Author

antonylebechec commented Feb 17, 2023

Another test with Samtools shoxs that the CRAM file can be view:

$ samtools view Sample4.archive.cram | head -n2
M01656:13:000000000-D02HD:1:1101:23237:26068	163	chr1	111984608	60	8S212M10S	=	111984608	212	CCGTATCTCCCTTCCCTGATTCCCAAAGGATTCCACTTCACACTTACAACTCAGAAAGGCTTGAGTCCAGCACAGCAAGTGAGCAGTCTTCACTGAGAGAGGCCAGGAAGGGAACACTATCAGATGGAGGAGAGGGTTGTGAAAGGTCCAGCCTGGATCCCAAGACAAAACCTTAACTGGGCCGGCCCTGCCGCCACTGTAAAGTGACCCAGGAGAGGCACGTCAGTGTG	<<;;;=?>?<<>>?==?@>=>?==@@@@???@?=<??@???@??=;?@>><>;?><2<>??@@;?>?=@@???@@=?=?>?>@=@?>??@?@??B?@?@>?>==@@??@@>>?@?@??<=?@?>?B??@>;?>;0;;=<>@?@@??<?<@@?=>B????<=@@@;>@@@@?<?@<@??B??==:>===?B<=:==<?<B><>>?>@>?==@?>>?>?>=@?:>?2;<?<2	BC:Z:CCGTAGTT-ACTTGAGT	MC:Z:8S212M10S	MD:Z:212	NM:i:0	MQ:i:60	OQ:Z:BBAAAFFFFFFFGGGGGGGGGGHHHHHHHHHHHH6GHHHFHHHHFBGGGFCGEGFB3BFHHHGEGHHHHHHFHGHGFFFGFFHGGFGFHHGHHHHHHHHGGGGGHHHHHHGGHHGHHHHGHHGGHHHHHGEFGE/E<FDGGHHHFHDGFHHHGFHHHHHGHGHHEHHHHHHGHHHHHHHHHGHGGGGGHHGHGGG@GBHGGGGGGGGGGGGGGGGFGGFGGGFG.ABFB/	AS:i:212	XS:i:21	RG:Z:1-371D323C
M01656:13:000000000-D02HD:1:1101:23237:26068	83	chr1	111984608	60	8S212M10S	=	111984608	-212	CCGTATCTCCCTTCCCTGATTCCCAAAGGATTCCACTTCACACTTACAACTCAGAAAGGCTTGAGTCCAGCACAGCAAGTGAGCAGTCTTCACTGAGAGAGGCCAGGAAGGGAACACTATCAGATGGAGGAGAGGGTTGTGAAAGGTCCAGCCTGGATCCCAAGAAAAAACCTTAACTGGGCCGGCCCTGCCGCCACTGTAAAGTGACCCAGGAGAGGCACGTCAGTGTG	>;>==<;2>>?>;>>???=<;>>2>>?=?=>>>@;;>>?>B>@@<<=@>?<???@@?=?@@@?????????=?>=<>??<?>=???????B>@@;???>?==???=<@?=<?@>B>@<??B????=??=???>==;@??@?@@?=?>>????@@=?=:>><@<?;0>@=<??==>>?0==;;9;;>>??;;:=?B>@@?<@@??@?>>>@?=????===<;>>?><<<<<	BC:Z:CCGTAGTT-ACTTGAGT	MC:Z:8S212M10S	MD:Z:157C54	NM:i:1	MQ:i:60	OQ:Z:FFFFGDE.GGGGEGGGFFGFAGF0GGGGGFGFGG;;GGFGHHHHGCCHGGCFHHHHGGHHHGHHHHHFGHFHFFGDGHGDFFGFHHHFHHHHHHBHHHGGHGHFGHCHGHHHHHHHHHHHHHHHFHGGHHHHFGGEHGHHFHHHHHGGFHHHHHHFF?GGDHDF>1GHF@HFFFGFF1GGEEEEAGGFFEEGGHHGHHHHHHHHHHHGGGGGGGGGGGCCCFFFFCCCCC	AS:i:207	XS:i:21	RG:Z:1-371D323C

Do you think there is a problem with the format? With tags on this file?

When I create a BAM file from the CRAM file, it can be loaded in IGV:

$ samtools view -h Sample4.archive.cram -o Sample4.archive.bam
$ samtools index Sample4.archive.bam

@jrobinso
Copy link
Contributor

Thanks for the sample data, we will look into it.

lbergelson added a commit to samtools/htsjdk that referenced this issue Feb 17, 2023
@lbergelson
Copy link
Contributor

@antonylebechec Thank you so much for the helpful bug report and the test data.

It's a simple bug in the underlying htsjdk library. I just built and tested a patch that should fix it. I'll have to release a new htsjdk and then incorporate that into IGV.

@antonylebechec
Copy link
Author

Thanks a lot IGV Team!!!

lbergelson added a commit to samtools/htsjdk that referenced this issue Feb 21, 2023
* Fix an NPE in CRAMRecordReadFeatures.restoreReadBases() when reading crams with embedded references.
* Fix for igvteam/igv#1286
lbergelson added a commit that referenced this issue Feb 22, 2023
* This includes a fix for #1286
lbergelson added a commit that referenced this issue Feb 22, 2023
* This includes a fix for #1286
jrobinso pushed a commit that referenced this issue Apr 5, 2023
* This includes a fix for #1286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants