This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there any method to convert a text file to VCF format?

Hello, I want to convert a text file into vcf format, is there any script or any method to convert it into vcf? It is a snp data, which is not in any format. Following are the headers of my text file.

Chromosome Position RefBase AltBase MAF RefBaseNum AltBaseNum Sample 1 Sample2 Sample3

Highly appreciated, if anyone can enlighten me about it.

snp r gene next-gen

1 answer

Create one more text file with 1.txt:

##fileformat=VCFv4.0

#CHROM Position RefBase AltBase MAF RefBaseNum AltBaseNum Sample 1

save it and remove header from my text file and save as 2.txt and concatenate them

cat 1.txt 2.txt > your_vcf.vcf

Thanks for your response, and it is highly appreciated. Sorry to say, I want a vcf file for genome wide association. This way it will create only a text file. In my genotype data the snps are not coded as numerical. It is coded in alphabets such as GG, TT, NN etc. As in vcf, snps are coded as 0, 1 or 2. I think, this method doesn't seems to apply on my data.

Hello Please have you found a solution to convert a txt file to vcf?

There is no "converting" a "txt" file to VCF format. VCF is a highly specific format while "txt" is a common file extension for plain text files. What is your data format (what do the first 10 lines look like, for example) and do you have all the information you need to build VCF entries?

Log in to answer this question.