You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> rm *.gzi
> ls
toy_bam.bam toy_cram.cram toy_ref.fasta.gz toy_ref.fasta.gz.fai
Run samtools view on the cram, should fail with file not found:
> samtools view --no-PG --reference toy_ref.fasta.gz toy_cram.cram --verbosity 10
[I::hts_idx_check_local] Using alignment file 'toy_ref.fasta.gz'
[E::bgzf_index_load] Error opening toy_ref.fasta.gz.gzi : No such file or directory
[E::bgzf_open_ref] Unable to load .gzi index 'toy_ref.fasta.gz.gzi'
[E::refs_load_fai] Failed to open reference file 'toy_ref.fasta.gz'
[E::hts_open_format] Failed to open file "toy_cram.cram" : No such file or directory
samtools view: failed to open "toy_cram.cram" for reading: No such file or directory
This issue only occurs when only .fai is present without .gzi. Removing the .fai file as well allows samtools view to execute successfully:
This is similar to an issue found in the past with samtools faidx not running correctly if the .fai file exists but the .gzi file does not: samtools/samtools#804
I think the issue is caused by samtools only checking for .fai existence to determine whether to regenerate index files, rather than validating that both .fai and .gzi exists for bgzipped compressed references.
Are you using the latest version of samtools and HTSlib? If not, please specify.
(run
samtools --version
)Please describe your environment.
uname -sr
on Linux/Mac OS orwmic os get Caption, Version
on Windows)Darwin 23.2.0
uname -m
on Linux/Mac OS orwmic os get OSArchitecture
on Windows)arm64
gcc --version
orclang --version
)Please specify the steps taken to generate the issue, the command you are running and the relevant output.
toy_ref.fasta
and bam filetoy_bam.bam
toy_ref.fasta.gz
This issue only occurs when only .fai is present without .gzi. Removing the .fai file as well allows samtools view to execute successfully:
This is similar to an issue found in the past with samtools faidx not running correctly if the .fai file exists but the .gzi file does not: samtools/samtools#804
I think the issue is caused by samtools only checking for .fai existence to determine whether to regenerate index files, rather than validating that both .fai and .gzi exists for bgzipped compressed references.
Code reference:
htslib/faidx.c
Line 1000 in 65ae574
The text was updated successfully, but these errors were encountered: