I am trying to format my diploid SNP data to GenAlEx format for downstream analysis using PoppR, but as is often the case, the GenAlEx addon for MSExcel won't work because I have far too many columns. With my small bit of R knowledge I've managed to get this far:
"SNP_ID" "Population" "Locus_1" "Locus_2" Sample_1 1 AG TG Sample_2 1 AT TT
but I need to split the SNPS (AG) into separate columns (A G) where the G is moved to a new column without a header, which will be interpreted by the program as still belonging to locus 1, like so:
"SNP_ID" "Population" "Locus_1" "Locus_2"
Sample_1 1 A G T G
Sample_2 1 A T T T
The way I'd like to do it would be to 1) make new columns after each existing locus and then 2) move the second allele from each pair into the new, empty cell to its right. This should double the number of columns (minus the first 2 ID columns), but the number of loci (and column labels) will remain the same.
Thanks!
Alex