Keep variants with 0% missing in VCF
3
2
Entering edit mode
5.8 years ago

I want to know if there is a way to keep sites with 0% missing a VCF file.

On vcftools I can do:

vcftools --vcf input_file.vcf --max-missing 1.0 --out output_noMissing

Is there a way to do this with BCFTOOLS as it is much faster?

vcf bcftools • 6.2k views
ADD COMMENT
0
Entering edit mode

-g, --genotype [^][hom|het|miss] include only sites with one or more homozygous (hom), heterozygous (het) or missing (miss) genotypes. When prefixed with ^, the logic is reversed; thus ^het excludes sites with heterozygous genotypes.

ADD REPLY
5
Entering edit mode
5.8 years ago
$  bcftools view -e 'GT[*]="mis"' input.vcf

This will exclude (-e) sites where any genotype (GT[*]) is missing (="mis").

ADD COMMENT
4
Entering edit mode
5.8 years ago

not tested:

 bcftools view -g  ^miss input.vcf
ADD COMMENT
3
Entering edit mode
5.8 years ago

Another solution:

bcftools filter --include 'AN=2*N_SAMPLES' [VCF/BCF]

[courtesy finswimmer for N_SAMPLES part]

Pierre's, finswimmer's, and this solution all produce the exact same output (tested with diff)

ADD COMMENT

Login before adding your answer.

Traffic: 2880 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6