How do I use vcftools to filter by variant ID OR variant position?
1
0
Entering edit mode
6.1 years ago
jwhite007 ▴ 10

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 • 4.8k views
ADD COMMENT
1
Entering edit mode

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

bar

ADD REPLY
2
Entering edit mode
6.1 years ago

not vcftools

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

ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
1
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 2353 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