Failure getting reference bases
inadequately describes the missing index error
#1732
Labels
Failure getting reference bases
inadequately describes the missing index error
#1732
Description of the issue:
When a CRAM is used as input to
htsjdk.samtools.cram.build.CRAMReferenceRegion.fetchReferenceBasesByRegion
, and the reference file is missing its index, the error is confusing and doesn't accurately describe the issue. Currently it says something likejava.lang.IllegalArgumentException: Failure getting reference bases for sequence chr1
.Your environment:
4.1.1
Steps to reproduce
This error came up when using GATK, so my reproduction example involves the command line. I'm sure it's easy to convert this to a pure Java example however. The reason I am reporting it here is that the error comes from
htsjdk
and I would like to see it improved in all tools that use it.Assume that there are only the CRAM and the fasta file in the working directory:
Next, run
gatk CollectQualityYieldMetrics -I GTEX-111CU-0003-SM-6WBUD.cram -R Homo_sapiens_assembly38.fasta -O yield_metrics.txt
Expected behaviour
The function should fail with a message specifically saying
fasta reference file Homo_sapiens_assembly38.fasta is missing its .fai index. Please run samtools faidx on it
.Actual behaviour
It fails with:
The text was updated successfully, but these errors were encountered: