This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Remove genes that each of a gene with multiple SNVs

I generated a vcf file with snpEff annotation tool . In this file, there are many genes needed to be removed because a gene with multiple SNVs, these are all false positive SNVs that I need to remove. Is there tools can do this? I usually do manually by transferring vcf to a txt format file and then excel file using annovar package. Is there tools can do this by running a script by not by excel table ?

vcf

Please respond quickly and remove other(same) questions of your.

Thanks ! Just don't know what's going on with my cell phone today

1 answer

Say your threshold is one SNP per gene, and you have a file of SNPs called snps.vcf and a BED file containing gene annotations called genes.bed. You could use vcf2bed and bedmap:

$ vcf2bed < snps.vcf > snps.bed
$ bedmap --count --echo --delim '\t' genes.bed snps.bed \
    | awk '$1==1' \
    | cut -f2- \
    > genes_with_one_overlapping_snp.bed

Or as a one-liner:

$ vcf2bed < snps.vcf | bedmap --count --echo --delim '\t' genes.bed - | awk '$1==1' | cut -f2- > genes_with_one_overlapping_snp.bed

Thanks Alex, this is the first time to use vcf2bed,

When i run

$ perl PATH/vcf2bed.pl —keep-header < my_file.vcf

It shows

Cannot open --keep-header at PATH/vcf2bed.pl line 12

my_file.vcf works fine, did I miss something?

Log in to answer this question.