This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Getting the GT field from a vcf for all samples for a selected list of positions

Hi,

Trying to do something simple and not getting the desired output: I have a vcf file and a file with a list of positions in the format <chr>\t<position>. I'm trying to use vcftools to filter the vcf file keeping only the positions in the file I have.

I thought this ought to do it: vcftools --gzvcf <vcf.gz> --out <out_file> --positions <positions_file>

The output message indicates it's running and selecting these positions:

VCFtools - v0.1.12b (C) Adam Auton and Anthony Marcketta 2009

Parameters as interpreted:

        --gzvcf <vcf.gz>

        --out <out_file>

        --positions <positions_file>

Using zlib version: 1.2.8 After filtering, kept 110 out of 110 Individuals After filtering, kept 20000 out of a possible 434842 Sites Run Time = 12.00 seconds

But there's no output file. Replacing --out <out_file> with --stdout doesn't change much other than the output message.

Once I get that done, is it possible to get vcftools to output only the GT field for the selected positions?

Thanks

vcf

1 answer

This seems to work fine: vcftools --gzvcf <vcf.gz> --out <out_file> --positions <positions_file> --extract-FORMAT-info GT

Log in to answer this question.