Search in sources :

Example 41 with ArgsEngine

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

the class GBSSimulator 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("-f", "--fasta-file", true);
        myArgsEngine.add("-e", "--enzyme", true);
        myArgsEngine.add("-l", "--library", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-b", "--barcode-file", true);
        myArgsEngine.add("-m", "--avg-depth", true);
        myArgsEngine.add("-s", "--sdev", true);
        myArgsEngine.add("-S", "--random-seed", true);
        myArgsEngine.add("-q", "--quality-file", true);
        myArgsEngine.add("-o", "--output-file", true);
        myArgsEngine.parse(args);
    }
    String fastaFileDir, enzymeName = "PstI", libPrepFilePath = null, barcodeFilePath = null, params = null, outputDir = "./";
    double avg = 5, sd = 5;
    long RANDOM_SEED = System.nanoTime();
    if (myArgsEngine.getBoolean("-f")) {
        fastaFileDir = myArgsEngine.getString("-f");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify the FASTA files.");
    }
    if (myArgsEngine.getBoolean("-e")) {
        enzymeName = myArgsEngine.getString("-e");
    }
    if (myArgsEngine.getBoolean("-l")) {
        libPrepFilePath = myArgsEngine.getString("-l");
    }
    if (myArgsEngine.getBoolean("-b")) {
        barcodeFilePath = myArgsEngine.getString("-b");
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
    if (myArgsEngine.getBoolean("-m")) {
        avg = Double.parseDouble(myArgsEngine.getString("-m"));
    }
    if (myArgsEngine.getBoolean("-s")) {
        sd = Double.parseDouble(myArgsEngine.getString("-s"));
    }
    if (myArgsEngine.getBoolean("-S")) {
        RANDOM_SEED = Long.parseLong(myArgsEngine.getString("-S"));
    }
    if (myArgsEngine.getBoolean("-q")) {
        params = myArgsEngine.getString("-q");
    }
    if (myArgsEngine.getBoolean("-o")) {
        outputDir = myArgsEngine.getString("-o");
    }
    gbs = new GBS(fastaFileDir, enzymeName, avg, sd, params, libPrepFilePath, barcodeFilePath, outputDir, RANDOM_SEED);
}
Also used : GBS(cz1.simulation.model.GBS) ArgsEngine(cz1.util.ArgsEngine)

Example 42 with ArgsEngine

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

the class GenomeComparison 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("-i1", "--input-bam-1", true);
        myArgsEngine.add("-i2", "--input-bam-2", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-o", "--prefix", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i1")) {
        in_bam1 = myArgsEngine.getString("-i1");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your FASTQ files.");
    }
    if (myArgsEngine.getBoolean("-i2")) {
        in_bam2 = myArgsEngine.getString("-i2");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your FASTQ files.");
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_f = myArgsEngine.getString("-o");
    }
}
Also used : ArgsEngine(cz1.util.ArgsEngine)

Example 43 with ArgsEngine

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

the class TenXMoleculeStats 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", "--input-bam", true);
        myArgsEngine.add("-f", "--input-vcf", true);
        myArgsEngine.add("-s", "--call-snps", false);
        myArgsEngine.add("-d", "--min-depth", true);
        myArgsEngine.add("-t", "--threads", true);
        myArgsEngine.add("-o", "--output-stats", true);
        myArgsEngine.parse(args);
    }
    if (myArgsEngine.getBoolean("-i")) {
        in_bam = myArgsEngine.getString("-i");
    } else {
        printUsage();
        throw new IllegalArgumentException("Please specify your BAM file.");
    }
    if (myArgsEngine.getBoolean("-s")) {
        call_snps = true;
    }
    if (myArgsEngine.getBoolean("-f")) {
        in_vcf = myArgsEngine.getString("-f");
    } else if (call_snps) {
        printUsage();
        throw new IllegalArgumentException("Please specify your VCF file.");
    }
    if (myArgsEngine.getBoolean("-d")) {
        min_depth = Integer.parseInt(myArgsEngine.getString("-d"));
    }
    if (myArgsEngine.getBoolean("-t")) {
        THREADS = Integer.parseInt(myArgsEngine.getString("-t"));
    }
    if (myArgsEngine.getBoolean("-o")) {
        out_stats = myArgsEngine.getString("-o");
    }
}
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