Ejemplo n.º 1
0
  @Override
  protected String[] getCommand(FileBuffer inputBuffer) throws OperationFailedException {
    if (cutAdaptPath == null) {
      cutAdaptPath = this.getPipelineProperty(CUTADAPT_PATH);
      if (cutAdaptPath == null)
        throw new OperationFailedException("No path to cutadapt found", this);
    }

    if (!(inputBuffer instanceof FastQFile)) {
      return null;
    }

    if (adapterString == null) {
      try {
        FileBuffer adapterBuf = this.getInputBufferForClass(TextBuffer.class);
        if (adapterBuf == null)
          throw new OperationFailedException(
              "No adapter file specified, cannot cut adapters", this);
        BufferedReader reader = new BufferedReader(new FileReader(adapterBuf.getFile()));
        StringBuffer adapterStr = new StringBuffer();
        String line = reader.readLine();
        while (line != null) {
          adapterStr.append(" -a " + line.trim());
          line = reader.readLine();
        }
        reader.close();
        adapterString = adapterStr.toString();
      } catch (IOException ex) {
        throw new OperationFailedException(
            "Error reading adapter sequences : " + ex.getMessage(), this);
      }
    }

    String outputFilename = "adaptercut-" + inputBuffer.getFilename();
    FastQFile outputFile = new FastQFile(new File(getProjectHome() + outputFilename));
    super.addOutputFile(outputFile);
    String command =
        cutAdaptPath
            + adapterString
            + " -o "
            + outputFile.getAbsolutePath()
            + " "
            + inputBuffer.getAbsolutePath();

    return new String[] {command};
  }
Ejemplo n.º 2
0
  protected void parseOptions() {
    FileBuffer inputBEDfb = this.getInputBufferForClass(BEDFile.class);
    if (inputBEDfb != null) {
      inputBED = (BEDFile) inputBEDfb;
      bedFileOpt = " -t " + inputBED.getAbsolutePath();
    } else {
      bedFileOpt = "";
    }

    List<FileBuffer> inputBAMBuffers = this.getAllInputBuffersForClass(BAMFile.class);
    for (FileBuffer bamBuffer : inputBAMBuffers) {
      inputBAMs = inputBAMs + " -b " + bamBuffer.getAbsolutePath();
    }

    if (extraOptions == null || extraOptions.equals("null")) {
      extraOptions = "";
    }
    inputBuffers = this.getAllInputBuffersForClass(BAMFile.class);
    refBuf = (ReferenceFile) this.getInputBufferForClass(ReferenceFile.class);
    outputVCF = (VCFFile) this.getOutputBufferForClass(VCFFile.class);
  }