private void startBWASamXe() throws InterruptedException { String customArgs = HalvadeConf.getCustomArgs(context.getConfiguration(), "bwa", "sampe"); String[] command = CommandGenerator.bwaSamXe( bin, ref, getFileName(tmpdir, taskId, true, 1), getFileName(tmpdir, taskId, false, 1), getFileName(tmpdir, taskId, true, 2), getFileName(tmpdir, taskId, false, 2), isPaired, threads, customArgs); samxe = new ProcessBuilderWrapper(command, bin); samxe.startProcess(null, System.err); if (!samxe.isAlive()) throw new ProcessException("BWA samXe", samxe.getExitState()); // make a SAMstream handler ssh = new SAMStreamHandler(instance, context, false); ssh.start(); }
@Override public void closeAligner() throws InterruptedException { // close last BWA aln closeBWAAln(); // but now start sampe/samse startBWASamXe(); ssh.join(); int error = samxe.waitForCompletion(); if (error != 0) throw new ProcessException("BWA samXe", error); context.getCounter(HalvadeCounters.TIME_BWA_SAMPE).increment(samxe.getExecutionTime()); // remove all temporary fastq/sai files HalvadeFileUtils.removeLocalFile( keep, getFileName(tmpdir, taskId, true, 1), context, HalvadeCounters.FOUT_BWA_TMP); HalvadeFileUtils.removeLocalFile( keep, getFileName(tmpdir, taskId, false, 1), context, HalvadeCounters.FOUT_BWA_TMP); HalvadeFileUtils.removeLocalFile( keep, getFileName(tmpdir, taskId, true, 2), context, HalvadeCounters.FOUT_BWA_TMP); HalvadeFileUtils.removeLocalFile( keep, getFileName(tmpdir, taskId, false, 2), context, HalvadeCounters.FOUT_BWA_TMP); instance = null; }