This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract mutations for a specific gene from a vcf file

I downloaded more than 4000+ VCF files from TCGA but I am only interested in mutations of one gene, IDH1. I am wondering what is the best way to extract the mutations of this gene from these VCF files. Desired output would be a data matrix. Is there a vcf tools can realize this?

vcf

I think you can use bedtools intersect here where the option -a would be a bed file for the coordinate of your interest gene and -b would be the vcf files

If you're working with somatic mutations, you should download MAF file of each cohort rather than vcf for each patient/sample.

2 answers

tabix is the best tool to extract regions of interest from vcf files

bgzip my.vcf # tabix works on block compressed data only (output my.vcf.gz)
tabix -p vcf my.vcf.gz # index vcf file 
tabix my.vcf.gz chr1:1-1000000

See other options of tabix http://www.htslib.org/doc/tabix.html

If you know the coordinates of the gene, you could use awk or bedtools to get all mutations in a specific genomic interval.

Log in to answer this question.