This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert matrix in numeric format to genotype format

Hi All,

I want to convert a matrix in numeric format, 0 for homozygous reference allele, 1 for heterozygous and 2 for homozygous alternative to a genotype matrix, if it is possible to a vcf file. Do you know any tool to do it?

Best Wishes,

Eric

snp

1 answer

If your matrix is variant-major (i.e. each line has one variant, each column has one sample), it shouldn't take too much work to manipulate it into a form that plink 2.0 --import-dosage (see http://zzz.bwh.harvard.edu/plink/dosage.shtml for a description of the expected format, and http://www.cog-genomics.org/plink/2.0/input#import_dosage for --import-dosage syntax) can read; adding "--export vcf" to the same command line will then give you your VCF.

If it's sample-major, you'll probably need to transpose it first.

Log in to answer this question.