Replace heterozygous GT to missing in vcf file using bcftools
1
0
Entering edit mode
11 months ago
User000 ▴ 460

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 • 626 views
ADD COMMENT
1
Entering edit mode
11 months ago
microfuge ★ 1.9k

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

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

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

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 REPLY

Login before adding your answer.

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