This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to remove homozygous reference genotypes from multi-sample vcf file based on a threshold

I have two question about homozygous reference genotypes in multi-sample vcf file.

  1. when I see 0/0 genotype for one or several samples in a multi-sample vcf file, does that mean there is no variant identified for that sample/samples?

  2. How can I remove a CNV (outputted from CNVcaller in vcf format) if more than or equal to 50% of the samples have genotype 0/0 for that position?

cnv vcf genotype

1 answer

bcftools may be able to help https://samtools.github.io/bcftools/bcftools.html

it has the "F_PASS" filter expression, and you can filter based on different variant types. they list a couple

they list some examples of what you can filter on in their docs

sample genotype: reference (haploid or diploid), alternate (hom or het, haploid or diploid), missing genotype, homozygous, heterozygous, haploid, ref-ref hom, alt-alt hom, ref-alt het, alt-alt het, haploid ref, haploid alt (case-insensitive)

GT="ref"
GT="alt"
GT="mis"
GT="hom"
GT="het"
GT="hap"
GT="RR"
GT="AA"
GT="RA" or GT="AR"
GT="Aa" or GT="aA"
GT="R"
GT="A"

possibly this command can filter based on fraction

bcftools view -i 'F_PASS(GT="ref")<0.5'  in.vcf

https://samtools.github.io/bcftools/bcftools.html

when I see 0/0 genotype for one or several samples in a multi-sample vcf file, does that mean there is no variant identified for that sample/samples?

0/0 means both alleles match the 'reference', so yes, no variant identified for that sample/samples. 0/1 would be that one allele had the variant matching the first entry from ALT. 0/2 would be one allele had a variant match the second entry from ALT.

Format of My VCF file

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  180 181 182 183 184 185 186 187 188 189
Chr1    801 NC_009849.1:801-16000   A   CNH .   .   END=16000;SVTYPE=DUP;SILHOUETTESCORE=nan;CALINSKIHARABAZESCORE=nan;LOGLIKELIHOOD=2.594363252834099  GT:CP   1/1:214.78  1/1:107.98  1/1:450.5   1/1:99.74   1/1:339.06  1/1:193.58  1/1:56.78   1/1:337.92  1/1:373.86  1/1:411.36

Chr1    337601  NC_044511.1:337601-339600   A   CN0 .   .   END=339600;SVTYPE=DEL;SILHOUETTESCORE=0.20963770717029737;CALINSKIHARABAZESCORE=539.874999999999;LOGLIKELIHOOD=3.26433913622163 GT:CP   1/1:0.5 0/1:1.24    0/1:0.96    0/1:0.66    0/0:1.56    0/1:1.44    0/1:1.4 0/0:1.8 0/0:2.28    0/0:2.36

is there anything about this you want me to check?

Yes, dear cmdcolin; Does the command you suggested work on this file or does it need to be modified? Sorry if my questions are elementary

Thanks

as far as I can tell, should be fine. i am not a bcftools expert but I'd just try it out and experiment, the filtering expressions are quite powerful with it

Log in to answer this question.