Question: How do I use vcftools to filter by variant ID OR variant position?
0
gravatar for jwhite007
5 months ago by
jwhite00710
jwhite00710 wrote:

I'm having a problem obtaining a recoded vcf which contains variants with their IDs in a "snp file" OR their positions in a "position file." The following gives only variants with their IDs in the "snp file" AND their positions in the "position file."

vcftools --vcf <input vcf file> --snps <variant IDs file> --positions <variant positions file> --recode --out <output vcf file>

Is there any way that I can obtain that which I desire without having to do each separately, concatenating, and then getting rid of duplicates?

Thanks in advance.

vcftools • 391 views
ADD COMMENTlink modified 5 months ago by Pierre Lindenbaum119k • written 5 months ago by jwhite00710
1

Please use the format bar to indicate code. I did it for you this time.

bar

ADD REPLYlink written 5 months ago by ATpoint15k
2
gravatar for Pierre Lindenbaum
5 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:

not vcftools

using vcffilterjdk: http://lindenb.github.io/jvarkit/VcfFilterJdk.html

ADD COMMENTlink written 5 months ago by Pierre Lindenbaum119k
1

Pierre,

I just realized that you are the creator of jvarkit. Thank you for your hard work in getting that code going and making it freely available and open source.

Cheers, James

ADD REPLYlink written 5 months ago by jwhite00710

Pierre,

I'd definitely like this in an easy-to-use tool like vcftools or bcftools, but what you've provided seems to work. Thank you for posting this. I will interrogate further later, however...

vcftools --vcf <input vcf file> --snps <variant IDs file> --recode --out <output vcf file>

gives 1695 variants

vcftools --vcf <input vcf file> --positions <variant positions file> --recode --out <output vcf file>

gives 483 variants

vcftools --vcf <input vcf file> --snps <variant IDs file> --positions <variant positions file> --recode --out <output vcf file>

gives 60 variants

java -jar dist/vcffilterjdk.jar --body -f biostar347173.code <input vcf file> > <output vcf file>

gives 2118 variants

1695 + 483 - 60 = 2118 = Yay!!

ADD REPLYlink written 5 months ago by jwhite00710

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.

Upvote|Bookmark|Accept

ADD REPLYlink written 5 months ago by Pierre Lindenbaum119k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1648 users visited in the last hour