This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert text file to VCF file ?

I tried to parse a few VCF files and always ended up with a txt file as an output, which by itself is not an issue. The problem comes when I need to annotate those txt files, as many tools require the input files to be in "VCF" format.

Not sure how I could convert a txt file to VCF format?

Any idea will be appreciated. Thanks a lot.

vcf

Iam sorry its too late to give you a solution, but hope it helps some one in the future. A vcf, txt files can be changed easily by changing the extensions by editing the name of the file. eg, "backup.txt" rename it to "backup.vcf". Thats it no need to find any softwares. It worked for me fr.

2 answers

If the file is formatted properly and contains what you want then the .txt file should be arbitrary. If you are used to the terminal then just:

mv my_vcf_file.txt my_vcf_file.vcf

Otherwise open it in any text editor and select Save As, save it as filename.vcf. If you are on windows you will need to change the file type on the bottom of the file browser window to All Files. It should have a drop down but will default to *.txt (Text Files) or something like that

Protip: On Windows, quote the entire name (with extension) to prevent the dialog from adding any further extensions. Save as --> "myVariants.vcf"

Greetings of the day! I was facing the same issue some times ago and after a deep research I came across a blog post i.e., How To Convert .txt File to vCard. Trust me, the solution mentioned here provided me very absolute results. So, you can also give it a try to convert text file to VCF file format.

Log in to answer this question.