This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging VCF files.

Hello all,

I'm trying to merge two VCF files.

file1 has an example sequence

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  unknown
chr2    29415792    .   G   A   1101.66 .   AB=0.494737;ABP=3.03316;AC=1;AF=0.5;AN=2;AO=47;CIGAR=1X;DP=95;DPB=95;DPRA=0;EPP=27.4509;EPPR=33.5919;GTI=0;LEN=1;MEANALT=1;MQM=60;MQMR=60;NS=1;NUMALT=1;ODDS=231.64;PAIRED=0.978723;PAIREDR=0.979167;PAO=0;PQA=0;PQR=0;PRO=0;QA=1807;QR=1719;RO=48;RPL=12;RPP=27.4509;RPPR=33.5919;RPR=35;RUN=1;SAF=47;SAP=105.07;SAR=0;SRF=48;SRP=107.241;SRR=0;TYPE=snp   GT:DP:DPR:RO:QR:AO:QA:GL    0/1:95:95,47:48:1719:47:1807:-134.266,0,-126.33

file2 has an example sequence

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  Sample1
chr2    29415792    .   G   A   .   PASS    ADP=89;WT=0;HET=1;HOM=0;NC=0    GT:GQ:SDP:DP:RD:AD:FREQ:PVAL:RBQ:ABQ:RDF:RDR:ADF:ADR    0/1:163:93:89:45:44:49.44%:4.4109E-17:37:18:45:0:44:0

I ran vcf tool to merge the above files and it resulted in the below:

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  unknown Sample1
chr2    29415792    .   G   A   1101.66 PASS    AB=0.494737;ABP=3.03316;AC=2;ADP=89;AF=0.5;AN=4;AO=47;CIGAR=1X;DP=95;DPB=95;DPRA=0;EPP=27.4509;EPPR=33.5919;GTI=0;HET=1;HOM=0;LEN=1;MEANALT=1;MQM=60;MQMR=60;NC=0;NS=1;NUMALT=1;ODDS=231.64;PAIRED=0.978723;PAIREDR=0.979167;PAO=0;PQA=0;PQR=0;PRO=0;QA=1807;QR=1719;RO=48;RPL=12;RPP=27.4509;RPPR=33.5919;RPR=35;RUN=1;SAF=47;SAP=105.07;SAR=0;SF=0,1;SRF=48;SRP=107.241;SRR=0;TYPE=snp;WT=0   GT:GQ:ABQ:RDR:RBQ:QR:ADR:FREQ:SDP:DP:AO:RD:GL:ADF:PVAL:RDF:AD:RO:QA:DPR 0/1:.:.:.:.:1719:.:.:.:95:47:.:-134.266,0,-126.33:.:.:.:.:48:1807:95    0/1:163:18:0:37:.:0:49.44%:93:89:.:45:.:44:4.4109E-17:45:44

I understood on how the merging has happened, for the #CHROM, POD, ID, REF, ALT, QUAL, FILTER, INFO fields. However, I couldn't understand the reasoning on how the FORMAT field is merged.

If someone can explain it or provide some reference links, it will be of great help

format variant vcf call

Quite interestingly, bcftools gives me the following error

$ bcftools merge --force-samples freebayes_raw.vcf.gz varscan_raw.vcf.gz -o bcftools_out.vcf
[W::bcf_hdr_merge] Trying to combine "GQ" tag definitions of different types
Incorrect number of FORMAT/DPR values at chr2:29415792, cannot merge. The tag is defined as Number=A, but found
2 values and 2 alleles. See also http://samtools.github.io/bcftools/howtos/FAQ.html#incorrect-nfields

Any ideas on how to solve this ?

Use the same modern VCF specification compliant variant caller to create VCF files that you want to merge. In the case that is not possible, remove the attributes that conflict in type from 1 or both files. Removing attributes can be done via e.g. "bcftools annotate -x FMT/DPR".

0 answers

No answers yet.

Log in to answer this question.