Search in sources :

Example 26 with ArgsEngine

use of cz1.util.ArgsEngine in project polyGembler by c-zhou.

the class ZipDataCollection 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("-i", "--vcf", true);
        myArgsEngine.add("-s", "--id", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i")) {
        vcf_in = myArgsEngine.getString("-i");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your VCF file.");
    }
    if (myArgsEngine.getBoolean("-s")) {
        id = myArgsEngine.getString("-s");
    } else {
        id = new File(vcf_in).getName().replaceAll(".vcf.gz$", "").replaceAll(".vcf$", "");
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_file = myArgsEngine.getString("-o");
    } else {
        out_file = new File(vcf_in).getParent();
    }
}
Also used : File(java.io.File) ArgsEngine(cz1.util.ArgsEngine)

Example 27 with ArgsEngine

use of cz1.util.ArgsEngine in project polyGembler by c-zhou.

the class GenomeAssemblyTiling 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("-d", "--rdot-plot", true);
        myArgsEngine.add("-s", "--size", true);
        myArgsEngine.add("-f", "--rf", true);
        myArgsEngine.add("-r", "--reference", true);
        myArgsEngine.add("-q", "--query", true);
        myArgsEngine.add("-l", "--colinear-thres", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-o", "--out-prefix", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-d")) {
        rdot_file = myArgsEngine.getString("-d");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the location of the Rdor-plot files.");
    }
    if (myArgsEngine.getBoolean("-s")) {
        size_file = myArgsEngine.getString("-s");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the chromosome/scaffold/contig size file.");
    }
    if (myArgsEngine.getBoolean("-f")) {
        rf_file = myArgsEngine.getString("-f");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the recombination frequency file.");
    }
    if (myArgsEngine.getBoolean("-r")) {
        refAssembly = myArgsEngine.getString("-r");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the reference id.");
    }
    if (myArgsEngine.getBoolean("-q")) {
        qryAssembly = myArgsEngine.getString("-q");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the query id.");
    }
    if (myArgsEngine.getBoolean("-l")) {
        cl_thres = Double.parseDouble(myArgsEngine.getString("-l"));
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_prefix = myArgsEngine.getString("-o");
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
}
Also used : ArgsEngine(cz1.util.ArgsEngine)

Example 28 with ArgsEngine

use of cz1.util.ArgsEngine in project polyGembler by c-zhou.

the class AssemblyError 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("-ex", "--experiment-id", true);
        myArgsEngine.add("-i", "--hap-file", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.add("-f", "--parent", true);
        myArgsEngine.add("-p", "--ploidy", true);
        myArgsEngine.add("-nb", "--best", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-phi", "--skew-phi", true);
        myArgsEngine.add("-nd", "--drop", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i")) {
        in_haps = myArgsEngine.getString("-i");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your input zip file.");
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_prefix = myArgsEngine.getString("-o");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your output file prefix.");
    }
    if (myArgsEngine.getBoolean("-ex")) {
        expr_id = myArgsEngine.getString("-ex");
    } else {
        expr_id = guessExperimentId();
        myLogger.warn("No experiment prefix provided, I guess it's " + expr_id + ". Please\n" + "specify it with -ex/--experiment-id option if it's incorrect.");
    }
    if (myArgsEngine.getBoolean("-f")) {
        founder_haps = myArgsEngine.getString("-f").split(":");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the parent samples (seperated by a \":\").");
    }
    if (myArgsEngine.getBoolean("-p")) {
        int ploidy = Integer.parseInt(myArgsEngine.getString("-p"));
        Constants.ploidy(ploidy);
        Constants._haplotype_z = ploidy * 2;
        probs_uniform = new double[ploidy * 2];
        Arrays.fill(probs_uniform, .5 / ploidy);
    }
    if (myArgsEngine.getBoolean("-nb")) {
        best_n = Integer.parseInt(myArgsEngine.getString("-nb"));
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
    if (myArgsEngine.getBoolean("-phi")) {
        skew_phi = Integer.parseInt(myArgsEngine.getString("-phi"));
    }
    if (myArgsEngine.getBoolean("-nd")) {
        drop_thres = Integer.parseInt(myArgsEngine.getString("-nd"));
    }
}
Also used : MathIllegalArgumentException(org.apache.commons.math3.exception.MathIllegalArgumentException) ArgsEngine(cz1.util.ArgsEngine)

Example 29 with ArgsEngine

use of cz1.util.ArgsEngine in project polyGembler by c-zhou.

the class DataPreparation method setParameters.

@Override
public void setParameters(String[] args) {
    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("-i", "--vcf", true);
        myArgsEngine.add("-s", "--id", true);
        myArgsEngine.add("-l", "--min-depth", true);
        myArgsEngine.add("-p", "--ploidy", true);
        myArgsEngine.add("-u", "--max-depth", true);
        myArgsEngine.add("-q", "--min-qual", true);
        myArgsEngine.add("-f", "--min-maf", true);
        myArgsEngine.add("-m", "--max-missing", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i")) {
        vcf_in = myArgsEngine.getString("-i");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your VCF file.");
    }
    if (myArgsEngine.getBoolean("-s")) {
        id = myArgsEngine.getString("-s");
    } else {
        id = new File(vcf_in).getName().replaceAll(".vcf.gz$", "").replaceAll(".vcf$", "") + ".recode";
    }
    if (myArgsEngine.getBoolean("-p")) {
        ploidy = Integer.parseInt(myArgsEngine.getString("-p"));
    }
    if (myArgsEngine.getBoolean("-l")) {
        min_depth = Integer.parseInt(myArgsEngine.getString("-l"));
    }
    if (myArgsEngine.getBoolean("-u")) {
        max_depth = Integer.parseInt(myArgsEngine.getString("-u"));
    }
    if (myArgsEngine.getBoolean("-q")) {
        min_qual = Integer.parseInt(myArgsEngine.getString("-q"));
    }
    if (myArgsEngine.getBoolean("-f")) {
        min_maf = Double.parseDouble(myArgsEngine.getString("-f"));
    }
    if (myArgsEngine.getBoolean("-m")) {
        max_missing = Double.parseDouble(myArgsEngine.getString("-m"));
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_file = myArgsEngine.getString("-o");
    } else {
        out_file = new File(vcf_in).getParent();
        if (out_file == null)
            out_file = "./";
    }
}
Also used : File(java.io.File) ArgsEngine(cz1.util.ArgsEngine)

Example 30 with ArgsEngine

use of cz1.util.ArgsEngine in project polyGembler by c-zhou.

the class SAMtools method setParameters.

@Override
public void setParameters(String[] args) {
    // TODO Auto-generated method stub
    if (myArgsEngine == null) {
        myArgsEngine = new ArgsEngine();
        myArgsEngine.add("-i", "--sam-file", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i")) {
        mySamFile = myArgsEngine.getString("-i");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your SAM/BAM file.");
    }
    if (myArgsEngine.getBoolean("-o")) {
        myOutput = myArgsEngine.getString("-o");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your output file.");
    }
}
Also used : ArgsEngine(cz1.util.ArgsEngine)

Aggregations

ArgsEngine (cz1.util.ArgsEngine)43 File (java.io.File)10 MathIllegalArgumentException (org.apache.commons.math3.exception.MathIllegalArgumentException)5 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 GBS (cz1.simulation.model.GBS)1 Population (cz1.simulation.model.Population)1 SAMRecord (htsjdk.samtools.SAMRecord)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1