Biostar Beta. Not for public use.
filter my vcf for heterozygous
1
Entering edit mode
2.9 years ago
Spain

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 • 3.8k views
ADD COMMENTlink
3
Entering edit mode
16 months ago
Brice Sarver ♦ 2.6k
United States

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 COMMENTlink
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 REPLYlink
2
Entering edit mode

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

ADD REPLYlink
2
Entering edit mode
2.7 years ago
ssv.bio • 180

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

ADD COMMENTlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.3.1