There are multiple questions in your post but I'll make some answers that I believe will answer all of them.
Firstly, I recommend that you normalise your VCFs so that everything else that you do will work as planned. 'Normalising' a VCF usally means splitting multi-allelic calls, left-aligning indels, and ensuring that the alleles specified as REF in your VCF are also present in the reference genome. You can do this with (for each VCF file):
#1st pipe, splits multi-allelic calls into separate variant calls
#2nd pipe, left-aligns indels and issues warnings when the REF base in your VCF does not match the base in the supplied FASTA reference genome
bcftools norm -m-any MyVariants1.VCF | bcftools norm -Ob --check-ref w -f /ReferenceMaterial/1000Genomes/human_g1k_v37.fasta > MyVariants1.norm.bcf ;
bcftools norm -m-any MyVariants2.VCF | bcftools norm -Ob --check-ref w -f /ReferenceMaterial/1000Genomes/human_g1k_v37.fasta > MyVariants2.norm.bcf ;
bcftools index MyVariants1.norm.bcf ;
bcftools index MyVariants2.norm.bcf ;
You can then merge these together with:
bcftools merge -Ob -m none MyVariants1.norm.bcf MyVariants2.norm.bcf > MyVariants.norm.merge.bcf ;
--------------------------------------------
For the intersection, etc, you may additionally consider setting a unique value for each variant in the ID column. The following line will eliminate whatever is already set for the ID field and then set a new value:
bcftools annotate -Ob -x 'ID' -I +'%CHROM:%POS:%REF:%ALT'
You can then do various operations using bcftools isec. There are examples given in the program when you just type bcftools isec:
-------------------------------------------
Hope that this helps.
I have done intersections and other complex joins before, but by using AWK indexed arrays (can use Python, too) after having set the ID field to a unique value, like I did in the code above. Sometimes, BCFtools, VCFtools, etc., do not behave as you expect.
Kevin
hello kevin,
Genotype calls:
0: A1A1
1: A1A2 or A2A1
2: A2A2
5: missing
i use plink and my file is .csv format. i can do send my file if yes
Hello, you may consider opening up a new question for this, and make sure that you add the
plinktag.Hi kevin i open a new question
Yes, but there was no need to delete that post :-)