This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert association data from gwas catalog to vcf format

Hi there, I have a tsv file from GWAS-Catalog like this one in tsv format: ftp://ftp.ebi.ac.uk/pub/databases/gwas/releases/2018/11/05/gwas-catalog-associations_ontology-annotated.tsv

However, for many annotation tools, they require input data as vcf format. Therefore, I would like to convert those SNPs into vcf format. Is there any tools I can use to directly do that ?

gwas vcf gwas-catalog snp

1 answer

use awk to generate a header and create the VCF field. Here is a basic script.

 wget -q -O - "ftp://ftp.ebi.ac.uk/pub/databases/gwas/releases/2018/11/05/gwas-catalog-associations_ontology-annotated.tsv" | awk -F '     ' 'BEGIN{printf("##fileformat=VCFv4.2\n#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n");}/^DATE ADDED/{next}{printf("%s\t%s\t%s\tN\t.\t.\t.\t.\n",$12,$13,$37);}'

##fileformat=VCFv4.2
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO
6   32251212    GCST001156  N   .   .   .   .
6   32441753    GCST001156  N   .   .   .   .
6   33075103    GCST001156  N   .   .   .   .
6   32623148    GCST001156  N   .   .   .   .
6   31039078    GCST001181  N   .   .   .   .
6   31125810    GCST001181  N   .   .   .   .
6   31168676    GCST001181  N   .   .   .   .
6   31440051    GCST001181  N   .   .   .   .

Log in to answer this question.