Modify PLINK to accept a new organism

06/10/14 Edit: It looks like PLINK is undergoing renewed development; a new version of PLINK (1.90) is in beta and has new flags that render this post unnecessary (see the --chr-set and --autosome-num flags)
By default PLINK has a few different organisms basically hardcoded, but it isn't too much work to add your organism provided you can compile the code from source (note the compiler version issue resolved in this previous post).

Credit goes to this post from the biostars forum.

To modify PLINK to take a different organism, you'll need to modify the files listed below (switching the name of your organism of interest for Sorghum/sorghum). Add the relevant line near the other similar lines (e.g. the ones for dog, human, horse, etc.):

In helper.h, around line 195, add:
void defineSorghumChromosomes();
In helper.cpp, around line 1674,   add:
void defineSorghumChromosomes() {
//copy the function for a relevant species to here (e.g. rice) and change the chromosome number accordingly for your organism.
//in my case I also changed haploid to false.
In options.h, around line 578, add:
static bool species_sorghum;
In options.cpp, around line 467, add:
bool par::species_sorghum = false;
In plink.cpp, around line 167, add:
else if (par::species_sorghum) defineSorghumChromosomes();
In parse.cpp, around line 3536, add:
if (a.find("--sorghum")) par::species_sorghum = true;
After compilation, you can designate your added species when invoking PLINK (e.g. --sorghum) at the command line.


Popular Posts