Search in sources :

Example 1 with Population

use of cz1.simulation.model.Population in project polyGembler by c-zhou.

the class PopulationSimulator method setParameters.

@Override
public void setParameters(String[] args) {
    // TODO Auto-generated method stub
    if (args.length == 0) {
        printUsage();
        throw new IllegalArgumentException("\n\nPlease use the above arguments/options.\n\n");
    }
    if (myArgsEngine == null) {
        myArgsEngine = new ArgsEngine();
        myArgsEngine.add("-r", "--reference", true);
        myArgsEngine.add("-n", "--pop-size", true);
        myArgsEngine.add("-p", "--ploidy", true);
        myArgsEngine.add("-c", "--centimorgan", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-s", "--run-id", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.parse(args);
    }
    String reference, id = "Sc1", output = "./";
    int f1 = 94, ploidy = 2;
    double cM = -1.0;
    if (myArgsEngine.getBoolean("-r")) {
        reference = myArgsEngine.getString("-r");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the reference FASTA file.");
    }
    if (myArgsEngine.getBoolean("-n")) {
        f1 = Integer.parseInt(myArgsEngine.getString("-n")) - 2;
    }
    if (myArgsEngine.getBoolean("-p")) {
        ploidy = Integer.parseInt(myArgsEngine.getString("-p"));
    }
    if (myArgsEngine.getBoolean("-c")) {
        cM = Double.parseDouble(myArgsEngine.getString("-c"));
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
    if (myArgsEngine.getBoolean("-s")) {
        id = myArgsEngine.getString("-s");
    }
    if (myArgsEngine.getBoolean("-o")) {
        output = myArgsEngine.getString("-o");
    }
    pop = new Population(reference, f1, ploidy, cM, id, output);
}
Also used : Population(cz1.simulation.model.Population) ArgsEngine(cz1.util.ArgsEngine)

Aggregations

Population (cz1.simulation.model.Population)1 ArgsEngine (cz1.util.ArgsEngine)1