str2act.RSTRucture to Allele CounTs
Many population genomic analyzes require data in the form of population allele counts. Bayenv2 is one example. This is an R script which needs external packages 'Adegenet 2.0.0' and 'Poppr'. While obtaining allele count data is trivial with these packages, doing this for hundreds or thousands of input files at once (e.g. simulated data) can be tedious. This script will make your life easier in such cases.
The script can be run with the
source('str2act.R') command in a folder containing the input file, which needs to be formatted for Structure software (not fastStructure which has several additional empty columns).
Acknowledgements: Thanks to users of #FREENODE R channel, particularly "MrFlick" for help with the code.
str2maf.RSTRucture to Minor Allele Frequency
For many population genomic applications, minor allele frequency tables for multiple populations are needed on a per locus basis. Doing this for a file or two is easy enough, but when you are dealing with tens or hundreds of Structure data sets (for example: simulations etc.), you need a way to do this automatically.
The str2maf R code will help with this. You will need to install Adegenet 2.0.0 package by Thibaut Jombart available at github.com/thibautjombart/adegenet/.
Acknowledgements: Thanks to Freenode #R users 'cygnet', 'umgrosscol', 'fendur' and Karl Fetter of University of Vermont for help with the code.
*All code is provided as-is. No warranty, expressed or otherwise implied. Author is not responsible for any damages.