This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to create a new VCF file with subsetted data

Hello! So, lets say I have a sorted, indexed (tabix) VCF file, and wanted to make a new subsetted VCF file out of the that contains only a specific region from chr1. In that case, I know that tabix chr1.vcf.gz:<start>-<end> will give you the raw subsetted genotype data. How do I create a valid VCF file out of this? Thanks!

vcf tabix subset

2 answers

tabix --print-header in.vcf.gz "chr1:234-567"

should output a valid VCF.

but bcftools remains the tool of choice.

vcftools is deprecated.

Would the Site Filtering Options in the vcftools manual work?

Actually I just used bcftools view and subset the specified chromosome. I'd imagine subsetting via vcftools would be equivalently good.

Please accept their answer to mark the post as solved.

Log in to answer this question.