filter my vcf for heterozygous
2
2
Entering edit mode
8.2 years ago

Hi!

I have been looking to filter my vcf and get another vcf just with the heterozygous snp but as a vcf file

I found this

vcftools --gzvcf file.vcf.gz --extract-FORMAT-info GT | grep "0/1"

I thought maybe with --recode-vcf would keep my vcf format but it just make a text file and it doesn't appear only 0/1 I get something like this

CHROM   POS 3_v1

chr1    68928   ./.

chr1    871334  0/1

chr1    876499  1/1

chr1    883625  1/1

 chr1   884091  1/1

 chr1   887560  1/1

 chr1   887694  0/2...............

Is possible what I want to do?and why I dont get just the 0/1??? O_O

Thanks!

vcf • 11k views
ADD COMMENT
3
Entering edit mode
8.2 years ago
Brice Sarver ★ 3.8k

I would skip the VCFtools step and just grep the file itself. If it's compressed, you can use zcat.

You might also try the GATK's VariantFiltration and select only heterozygous sites (isHet).

ADD COMMENT
0
Entering edit mode

Thanks a lot!!!!

Worked ^^ but just one extra question, is any reason why dissapear the head and info above using grep?

I used grep 0/1 02.vcf > 02out.vcf

ADD REPLY
2
Entering edit mode

because grep gives what you searched for...grep for #...headers will be printed.

ADD REPLY
2
Entering edit mode
8.2 years ago
ssv.bio ▴ 200

filter vcf by genotype using bcftools. Manual here: https://samtools.github.io/bcftools/bcftools.html

ADD COMMENT

Login before adding your answer.

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