brentp / slivar

genetic variant expressions, annotation, and filtering for great good.
MIT License
248 stars 23 forks source link

Slivar for VCF Filtering #35

Closed nroak closed 5 years ago

nroak commented 5 years ago

Can Slivar be used for just VCF filtering without using any expressions or gnotate options? Given the speed and ease in filtering on the INFO fields, it might be useful to just use a command like,

~/resources/slivar/slivar expr \ --vcf input.vcf \ --out-vcf out.vcf \ --pass-only \ --info 'variant.call_rate > 0.9 && INFO.gnomAD_genome_ALL < 0.01 && (INFO["ExonicFunc.refGene"]=="nonsynonymous_SNV" || INFO["ExonicFunc.refGene"]=="stopgain" || INFO["ExonicFunc.refGene"]=="frameshift_insertion" || INFO["ExonicFunc.refGene"]=="frameshift_deletion")'

brentp commented 5 years ago

this should be possible if not, it's a bug.

brentp commented 5 years ago

might be only in latest release.

nroak commented 5 years ago

I will pull the latest release and test. The last error I got was it required either a ped or an alias file. I didn't have either so had to create a fake alias file.

brentp commented 5 years ago

Yeah, I think that was fixed in v0.1.3.

nroak commented 5 years ago

Yes, it works now. I just needed the newer version. Off topic, do you know a way to exclude samples from a multi-sample vcf where all the variants are homozygous reference?

brentp commented 5 years ago

glad to hear it. you can exclude all hom-ref variants with:

bcftools view -c 1

or with slivar using variant.num_het + variant.num_hom_alt > 0

nroak commented 5 years ago

Both these commands along with GATK SelectVariants filter out variants where none of the samples have an alternate allele. What I need to do is exclude samples where none of the variants is alternate allele. Something along these lines, https://gatkforums.broadinstitute.org/gatk/discussion/6500/how-to-get-sample-names-based-on-genotype-from-multi-sample-vcf-file

brentp commented 5 years ago

oh. I would just write a script to do that.

nroak commented 5 years ago

Yeah processed in R. Thanks Brent.