How to combine variants??
Hi,
I have two bi-allelic variant files, My objective is to combine all the genotypes/samples for those sites that are common in both files?
Can someone please mention any tool and steps how to do that??
Thanks
• 3,010 views
•
link
1 answer
I would solve problem one by generating identifiers for your variants (preferably in the smallest file) by concatenating chromosome, position and alternative allele. You can use those identifiers to filter the second file.
e.g.:
#Get the identifiers present in yourfile.vcf
bcftools annotate --set-id '%CHROM\_%POS\_%ALT' yourfile.vcf | cut -f3 > MyIdentifiers.txt
#Give the same type of identifiers to the 1000G data vcf
bcftools annotate --set-id '%CHROM\_%POS\_%ALT' 1000Gdata.vcf > 1000Gdata_withidentifiers.vcf
#Filter the 1000G data to only contain the variants you have in your vcf
java -jar GenomeAnalysisTK.jar -R ref.fasta -T SelectVariants --variant 1000Gdata_withidentifiers.vcf -o 1000G_myvariants.vcf -IDs MyIdentifiers.txt
Problem two can probably easily be solved by using something like vcf-merge from vcftools
• 0 views
•
link
Log in to answer this question.
It's unclear to me what is common between both files. Are the same variants in both files or the same samples?
Hi WouterDeCoster, Given: Two different files 1. 1000G Bi-allelic SNPs 2. My sample Bi-allelic SNPs
Problem:
In short, common variants in start and then the union of all samples. Thanks!