bcftools merge does not work
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c
- Domain
- bioinformatics, cli
Research direction
Start by reproducing the merge with the provided bcftools command and the affected VCF inputs, then inspect the records and headers around positions 99689, 100636, and 100730. Done means the developmental version merges these files completely without malformed-record or missing-sample errors.
Written by the indexing model from the issue text.
Description
Hej!
I have found a potential bug in the develomental version. I get an error message when trying to merge several vcf files with bcftools merge. I have tried the the latest source code commit b7b2a32 for the following code. However, version 1.14, 1.16 and 1.17 works fine.
Command:
merge_files=$(echo ./Rasolark_2021_CADDXX010000136.1_HETGAM_95694_hetsex.vcf.gz ./Rasolark_2021_CADDXX010000136.1_HETGAM_TT95866_hetsex.vcf.gz)
bcftools merge $merge_files | bgzip -c > output.vcf.gz
The vcf file is not complete. It stops abruptly and has the following message at the end of the file:
[W::vcf_parse_info] INFO 'C' is not defined in the header, assuming Type=String
[E::bcf_write] Broken VCF record, the number of columns at CADDXX010000136.1:99689 does not match the number of samples (0 vs 2)
[main_vcfview] Error: cannot write to (null)
There is no INFO field called "C". What I do have is:
##INFO=<ID=AC,Number=A,Type=Integer,Description="Total number of alternate alleles in called genotypes">
##INFO=<ID=AF,Number=A,Type=Float,Description="Estimated allele frequency in the range (0,1]">
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
The site in the individual vcf files look like this:
# Rasolark_2021_CADDXX010000136.1_HETGAM_95694_hetsex.vcf.gz
CADDXX010000136.1 99824 . TA T 0 . AC=1;AF=1;AN=1;CM=0.091753;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95866_hetsex.vcf.gz
CADDXX010000136.1 99824 . TA T 0 . AC=1;AF=1;AN=1;CM=0.091753;NS=18 GT 1
However, the problem does not seem to be that site in particular. The site changes depending on if I run more/other samples. For example if I merge 4 other samples the site 99824 is processed and the file instead ends at site 100730 with the message:
[E::bcf_write] Broken VCF record, the number of columns at CADDXX010000136.1:100730 does not match the number of samples (0 vs 4)
[main_vcfview] Error: cannot write to (null)
And if I merge all my 9 files I get the following message:
[E::vcf_parse_format] FORMAT column with no sample columns starting at CADDXX010000136.1:100636
Error: VCF parse error
Neither is there any obvious issue with this site in any of theindividual files:
#Rasolark_2021_CADDXX010000136.1_HETGAM_95694_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95866_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95867_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95871_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95879_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95881_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95884_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95887_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
#Rasolark_2021_CADDXX010000136.1_HETGAM_TT95888_hetsex.vcf.gz
CADDXX010000136.1 100636 . C G 0 . AC=1;AF=0.25;AN=1;CM=0.092565;NS=18 GT 1
Both cases are fixed for the alternate allele, but other site like it are being processed without any issue.
Again, there is none of these problems in previous versions.
- 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