Question: Replace heterozygous GT to missing in vcf file using bcftools
0
gravatar for User000
6 weeks ago by
User000380
User000380 wrote:

Hello,

I would like to replace all het GT 0/1 or 1/0to missing data ./. ? Is there any way to do it with bcftools? If no how could I do it.

bcftools vcf • 158 views
ADD COMMENTlink modified 6 weeks ago • written 6 weeks ago by User000380
1
gravatar for microfuge
6 weeks ago by
microfuge1.8k
microfuge1.8k wrote:

Not tested it but this comes to mind bcftools filter -S . -e 'GT=="het"' yourFile.vcf.gz

ADD COMMENTlink written 6 weeks ago by microfuge1.8k

You mean -i 'GT=="het"' and not -e. OP wants to set all HETs (not all non-HETs) to ./..

ADD REPLYlink modified 5 weeks ago • written 6 weeks ago by RamRS28k

-i doesnt work, -e seems to be working, is it normal?

ADD REPLYlink written 5 weeks ago by User000380

Sorry, I'd made a typo that led to a formatting error - I've edited that now. What is the full command you're using?

ADD REPLYlink written 5 weeks ago by RamRS28k

Hi, I'm using this command line: /DATA/Tools/bcftools-1.10.2/bcftools filter -S . -e 'GT=="het"' {input.f1} > {output.f2} It seems to be working...it that OK? because I expect -e to exclude, no? Should I run something like /DATA/Tools/bcftools-1.10.2/bcftools filter -i 'GT=="het"' {input.f1} > {output.f2} ?

ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by User000380

If the command you're using works and gives you what you expect, then you're all set. The thing to fix is the gap in my understanding - either I'm misunderstanding how bcftools functions or I'm misunderstanding your requirement. Either way, glad it worked for you.

I've moved micofuge's comment to an answer. Go ahead and accept it (using the green check mark on the left side panel).

ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by RamRS28k
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: 696 users visited in the last hour