NESCent / popgenInfo

Vignettes for Population Genetics in R
http://popgen.nescent.org
MIT License
20 stars 50 forks source link

How to convert a VCF file to a this format? #219

Open guojingfang123 opened 4 years ago

guojingfang123 commented 4 years ago

Hi, I only have VCF files now, how can I change it to the format "master_pinus_data_genotype.txt"? Are there tools or scripts? Thank you.

zkamvar commented 4 years ago

Hello,

If you have VCF data, {pegas} can import it with read.vcf: https://www.rdocumentation.org/packages/pegas/versions/0.12/topics/read.vcf, which gets stored as a "loci" object. You can also use {vcfR} with read.vcrR: https://www.rdocumentation.org/packages/vcfR/versions/1.8.0/topics/VCF%20input%20and%20output and then you can use vcfr2genind to import your data to genind format: https://knausb.github.io/vcfR_documentation/export_genind_genclone.html