示例#1
0
 @Override
 public void flushStream() {
   try {
     // close the input stream
     reads1.getSTDINWriter().flush();
     if (isPaired) reads2.getSTDINWriter().flush();
   } catch (IOException ex) {
     Logger.EXCEPTION(ex);
   }
 }
示例#2
0
  private void closeBWAAln() throws InterruptedException {
    try {
      // close the input stream
      reads1.getSTDINWriter().flush();
      reads1.getSTDINWriter().close();
      fastqFile1.close();
      if (isPaired) {
        fastqFile2.close();
        if (threads > 1) {
          reads2.getSTDINWriter().flush();
          reads2.getSTDINWriter().close();
        }
      }
    } catch (IOException ex) {
      Logger.EXCEPTION(ex);
      throw new ProcessException("BWA aln", -1);
    }

    int error = reads1.waitForCompletion();
    if (error != 0) throw new ProcessException("BWA aln", error);
    context.getCounter(HalvadeCounters.TIME_BWA_ALN).increment(reads1.getExecutionTime());
    if (isPaired) {
      if (threads == 1) {
        String[] command2 =
            CommandGenerator.bwaAln(
                bin,
                ref,
                getFileName(tmpdir, taskId, false, 2),
                getFileName(tmpdir, taskId, true, 2),
                threads,
                alnCustomArgs);
        reads2 = new ProcessBuilderWrapper(command2, bin);
        reads2.setThreads(threads);
        reads2.startProcess(null, System.err);
        if (!reads2.isAlive()) throw new ProcessException("BWA aln", reads2.getExitState());
      }
      error = reads2.waitForCompletion();
      if (error != 0) throw new ProcessException("BWA aln", error);
      context.getCounter(HalvadeCounters.TIME_BWA_ALN).increment(reads2.getExecutionTime());
    }
  }