Пример #1
0
  /** {@inheritDoc} */
  @Override
  public String get_syntax() {
    StringBuffer ReturnString =
        new StringBuffer(
            "Module to srf2fastq: Generate a fastq compatible with a particular aligner, directly from a SRF"
                + System.getProperty("line.separator")
                + System.getProperty("line.separator"));

    // Parse relevant parameters
    ReturnString.append(
        "Example: srf2fastq -a bfast -s illumina [-e 2] [-n 2] -i input.srf [-o outputPrefix]");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append("Required Parameters:");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-i, --input              {String}    Specifies the SRF file that will be read in to produce a fastq");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append("\t-b, --bin                {String}    Specifies the srf2fastq binary");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-f, --filter             {String}    Specifies that the quality filter for srf2fastq should be used");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-s, --sequencer          {String}    See below for currently supported sequencers");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-a, --aligner            {String}    See below for currently supported aligners");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(System.getProperty("line.separator"));

    ReturnString.append("Optional Parameters:");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-e, --ends               {int}       Specifies the number of ends in this SRF. Default: 1 (single-end)");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-n, --num-output-files   {int}       Specifies the number of output files to split normal output files into. Default: 1");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(
        "\t-o, --output-prefix      {String}    Specifies the name to be prepend to each output file. Default: use the name of the input file, truncating '.srf'");
    ReturnString.append(System.getProperty("line.separator"));
    ReturnString.append(System.getProperty("line.separator"));

    ReturnString.append("Supported Aligners (for -a argument):");
    ReturnString.append(System.getProperty("line.separator"));

    for (int i = 0; i < SRF2Fastq.getAligners().length; i++) {
      ReturnString.append("\t" + SRF2Fastq.getAligners(i));
      ReturnString.append(System.getProperty("line.separator"));
    }
    ReturnString.append(System.getProperty("line.separator"));

    ReturnString.append("Supported Sequencers (for -s argument):");
    ReturnString.append(System.getProperty("line.separator"));

    for (int i = 0; i < SRF2Fastq.getSequencers().length; i++) {
      ReturnString.append("\t" + SRF2Fastq.getSequencers(i));
      ReturnString.append(System.getProperty("line.separator"));
    }

    // Return as string
    return ReturnString.toString();
  }
Пример #2
0
  /** {@inheritDoc} */
  @Override
  public ReturnValue do_verify_parameters() {
    // Aligner: Look at each supported method to make sure there is a match
    boolean valid = false;
    for (int j = 0; j < SRF2Fastq.getAligners().length; j++) {
      if (aligner != null && aligner.compareTo(SRF2Fastq.getAligners(j).toLowerCase()) == 0) {
        valid = true;
        break;
      }
    }

    if (!valid)
      return new ReturnValue(
          null,
          "srf2fastq requires a valid -a or --aligner argument, followed by a supported aligner\n\n"
              + get_syntax(),
          1);

    // Sequencer: make sure a valid sequencer was specified
    valid = false;
    for (int j = 0; j < SRF2Fastq.getSequencers().length; j++) {
      if (sequencer != null && sequencer.compareTo(SRF2Fastq.getSequencers(j).toLowerCase()) == 0) {
        valid = true;
        break;
      }
    }
    if (!valid)
      return new ReturnValue(
          null,
          "srf2fastq requires a valid -s or --sequencer argument, followed by a supported sequencer\n\n"
              + sequencer
              + " \n\n"
              + get_syntax(),
          1);

    // ends and numout must be greater than zero
    if (ends <= 0 || numOut <= 0) {
      return new ReturnValue(
          null,
          "When specifying -e or -n, they must be followed by an integer\n\n" + get_syntax(),
          1);
    }

    // Input
    if (input == null || !input.endsWith(".srf")) {
      return new ReturnValue(
          null,
          "srf2fastq requires a -i or --input file which is a .srf file\n\n" + get_syntax(),
          1);
    }

    if (FileTools.fileExistsAndExecutable(new File(srf2FastqPath)).getExitStatus()
        != ReturnValue.SUCCESS) {
      return new ReturnValue(
          null,
          "srf2fastq requires a -b or --bin file which is the srf2fastq executable\n\n"
              + get_syntax(),
          1);
    }

    // Return object
    return new ReturnValue();
  }