This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieval of similar positions from samples in a vcf but different from reference

Hi,

I have a vcf file (for "a" type of samples) a_filtered_ann10.vcf annotated for 10 genes by bcftools and consists of 5 samples and similarly b_filtered_ann10.vcf . I have visualized both the vcf files in IGV and can see the variation with respect to the reference.

Now, I would like to retrieve only those positions from each file which are similar among the samples but different from the reference.

Any guidance would be appreciated.

Thanks!

vcf bcftools variant calling

1 answer

Hi, If you want to get snps where all samples are different from the ref you can use SnpSift filter ( http://snpeff.sourceforge.net/SnpSift.html ) and filter on the genotype field.

Thanks. SnpSift is part of SnpEff distribution and I tried annotating my variants using SnpEff but it showed error: unknown input vcf format and hence, I used bcftools for annotation (where I did not find such issue). Therefore, I want to use non-SnpEff based solution.

Maybe you can just filter all non variant genotypes of your vcf :

cat your_vcf.vcf | grep -v "0/0"

Then you will have only variants with all samples being homozygote or heterozygote.

Would bcftools view work if min alternate allele frequency is set to 1.0 ?

bcftools view --min-af 1 input.vcf.gz

Log in to answer this question.