Regions file parsing broken
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the issue with bcftools view -R and -T using the one- and two-column regions_test.txt examples, then inspect the regions-file parsing path in the bcftools source. Done means the documented input format is parsed correctly and the commands return the expected records, with the behavior covered by an appropriate test.
Written by the indexing model from the issue text.
Description
$ bcftools --version
bcftools 1.10.2
Using htslib 1.10.2
Copyright (C) 2019 Genome Research Ltd.
$ cat regions_test.txt
NC_000001.11 1
$ cat -A regions_test.txt
NC_000001.11^I1$
$ bcftools view -H -R regions_test.txt freq.vcf.gz
No output produced at all but if I use -r option instead it works as expected:
$ bcftools view -H -r NC_000001.11 latest_release/freq.vcf.gz | head -2
NC_000001.11 10498 rs1338146081 G A,T . . . AN:AC 2072:0,0 6:0,0 2:0,0 76:0,0 0:0,00:0,0 2:0,0 4:0,0 26:0,0 82:0,0 4:0,0 2188:0,0
NC_000001.11 10509 rs1262211809 G A . . . AN:AC 2072:0 6:0 2:0 76:0 0:0 0:0 2:0 4:0 26:0 82:0 4:0 2188:0
Same issue if I use -T option, tab-separated file is not parsed properly. If I omit '1' start coordinate from the file then I get the following error:
$ bcftools view -H -R regions_test.txt latest_release/freq.vcf.gz
[E::bcf_sr_regions_init] Could not parse the file regions_test.txt, using the columns 1,2[,-1]
Failed to read the regions: regions_test.txt
The only way to make it work is to use arbitrary large dummy end coordinate in the file:
$ cat regions_test.txt
NC_000001.11 1 999000000000
$ bcftools view -H -R regions_test.txt latest_release/freq.vcf.gz | head -2
NC_000001.11 10498 rs1338146081 G A,T . . . AN:AC 2072:0,0 6:0,0 2:0,0 76:0,0 0:0,00:0,0 2:0,0 4:0,0 26:0,0 82:0,0 4:0,0 2188:0,0
NC_000001.11 10509 rs1262211809 G A . . . AN:AC 2072:0 6:0 2:0 76:0 0:0 0:0 2:0 4:0 26:0 82:0 4:0 2188:0
Unfortunately, description of regions file format in the documentation is overly concise and not very helpful. It is possible I am doing something wrong but I have ran out of ideas to try.
- 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