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
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!
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).
filter vcf by genotype using bcftools. Manual here: https://samtools.github.io/bcftools/bcftools.html
Log in to answer this question.