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

Is there any tool available to convert multisample VCF file to Structure file format ? I have tried PGDSpider but it did not seem to work with multisample VCF and I could not figure out the usage of mega2 program.

One alternative way is to make fasta from VCF (FastaAlternateReferenceMaker) and convert it back to structure, but this may include lot of manipulations in between.

vcf structure population-genetics

2 answers

With PLINK 1.9,

plink --vcf [vcf filename] --recode structure

should work.

Ok I will look in to it.

The exact command is

plink --vcf [vcf filename] --recode structure --out <base name>

Hello chrchang523,

I know that it has been quite a while since this post, but I am trying to run this method with my vcf file; however, I keep getting an error:

Error: Invalid bp coordinate on line 1 of .bim file

I removed the logical information from the original vcf file as a means of improving the conversion process. Here is an image of my working vcf file:

The file is tab delimited if that information is helpful. I would appreciate any feedback.

With best regards,
Gio

plink does not allow "." blank POS values. Replace that column with zeroes.

Thank you for the response. I have replaced the "." with zeros within the POS column; however, I am now receiving this error: Error: Line 2 of .vcf file has an invalid GT field.

Looking at the head of the file through the terminal is a bit difficult due to the top row being crunched up, but in a spread sheet the data looks fine. Any recommendations?

https://s33.postimg.cc/j8j6hp3jj/Image479.jpg https://s33.postimg.cc/ij0e5capr/Image479_2.jpg

The problem is the surrounding double-quotes. They're ignored by Excel, but practically every VCF file reader will complain.

Thank you very much! That seemed to do the trick. You have saved me a lot of time and headache. I appreciate your help.

Try to use Mega2, it is freely available can convert from VCF or BCF format to Structure format, as well as to a number of other formats.

Log in to answer this question.