bcftools --targets-file fails to read the targets
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- c
- Domain
- bioinformatics, cli
Research direction
Reproduce the commands with test.vcf, test.vcf.gz, and test.bcf, then trace the --targets-file handling and the index-loading path implicated by the tbx_index_load2 and bcf_sr_regions_init errors. Compare the BCF and compressed-VCF cases and add a regression test showing that a BCF targets file is handled correctly.
Written by the indexing model from the issue text.
Description
Let's say I generate a minimal VCF file:
echo -e "##fileformat=VCFv4.2
##contig=<ID=20,length=63025520>
#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO
20\t1\t.\tA\tC\t0\t.\t." > test.vcf
And let's say I create a compressed/index version of it:
bcftools view --no-version test.vcf -Oz -o test.vcf.gz
bcftools index test.vcf.gz
Then everything seems to work just fine:
$ bcftools view --no-version test.vcf --targets-file test.vcf.gz
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=20,length=63025520>
#CHROM POS ID REF ALT QUAL FILTER INFO
20 1 . A C 0 . .
However, if I create a binary compressed version:
bcftools view --no-version test.vcf -Ob -o test.bcf
bcftools index test.bcf
I get the following error:
$ bcftools view --no-version test.vcf --targets-file test.bcf
[E::tbx_index_load2] Invalid index header for test.bcf
[E::bcf_sr_regions_init] Could not parse the file test.bcf, using the columns 1,2[,-1]
Failed to read the targets: test.bcf
The error is reproducible with version:
1.6-9-g46f17f5-dirty (using htslib 1.6-3-g75decb8)
- Dominant language
- C
- Stars
- 891
- Forks
- 277
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from samtools/bcftools
-
needs-feedback
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
htslib-dependent P2: Desirable
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
needs-feedback requires-test-case
Difficulty 3/5 1-2 days Newbie friendliness 55/100
All issues in samtools/bcftools
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100