FileData fm = new FileData(); if (output.getName().endsWith(".bam")) { fm.setMimeType(MimeType.APPLICATION_BAM);
@Override public ModuleOutput call() throws Exception { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; List<String> argumentList = new ArrayList<String>(); argumentList.add("--in"); argumentList.add(this.input.getAbsolutePath()); argumentList.add("--out"); argumentList.add(this.output.getAbsolutePath()); argumentList.add("--junctions"); argumentList.add(this.junctions.getAbsolutePath()); try { SpliceJunctionCounter.run(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { exitCode = -1; e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fileData = new FileData(); fileData.setMimeType(MimeType.TEXT_PLAIN); fileData.setName(output.getName()); addFileData(fileData); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add(String.format("TMP_DIR=%s/tmp", System.getenv("MAPSEQ_HOME"))); argumentList.add("REFERENCE=" + referenceSequence.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new ReorderSam().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("TMP_DIR=" + this.tmpDir.getAbsolutePath()); argumentList.add("REFERENCE=" + referenceSequence.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new ReorderSam().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add(String.format("TMP_DIR=%s/tmp", System.getenv("MAPSEQ_HOME"))); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new SamFormatConverter().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + sortOrder); argumentList.add("TMP_DIR=" + tmpDir.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new SortSam().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("TMP_DIR=" + tmpDir.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new SamFormatConverter().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { if (destination.exists()) { FileUtils.forceDelete(destination); } if (!destination.getParentFile().exists()) { destination.getParentFile().mkdirs(); } FileUtils.copyFile(source, destination); if (mimeType != null) { FileData fileData = new FileData(); fileData.setName(destination.getName()); fileData.setMimeType(mimeType); addFileData(fileData); } } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(exitCode); } moduleOutput.setExitCode(exitCode); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + sortOrder); argumentList.add(String.format("TMP_DIR=%s/tmp", System.getenv("MAPSEQ_HOME"))); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new SortSam().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + this.sortOrder); argumentList.add(String.format("TMP_DIR=%s/tmp", System.getenv("MAPSEQ_HOME"))); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new FixMateInformation().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + this.sortOrder); argumentList.add("TMP_DIR=" + this.tmpDir.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new FixMateInformation().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { CommandInput commandInput = new CommandInput(); StringBuilder command = new StringBuilder(); command.append(String.format("$%s_%s", getWorkflowName().toUpperCase(), getModuleClass().getAnnotation(Executable.class).value())); command.append(" -force_config_machine_name"); command.append(" -o ").append(output.getAbsolutePath()); command.append(" ").append(qSeqPath).append(File.separator).append("s_").append(lane.toString()) .append("_*qseq.txt"); commandInput.setCommand(command.toString()); CommandOutput commandOutput; try { Executor executor = BashExecutor.getInstance(); commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc")); } catch (ExecutorException e) { throw new ModuleException(e); } FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_SRF); fm.setName(output.getName()); addFileData(fm); return new ShellModuleOutput(commandOutput); }
@Override public ModuleOutput call() throws ModuleException { CommandInput commandInput = new CommandInput(); StringBuilder command = new StringBuilder(); command.append(getExecutable()); command.append(" -o "); String name = input.getName(); if (name.endsWith(".bam")) { name = StringUtils.removeEnd(name, ".bam"); } command.append(input.getAbsolutePath()).append(" ").append(name).append(" > ").append(output.getAbsolutePath()); commandInput.setCommand(command.toString()); CommandOutput commandOutput; try { Executor executor = BashExecutor.getInstance(); commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc")); } catch (ExecutorException e) { throw new ModuleException(e); } FileData fm = new FileData(); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return new ShellModuleOutput(commandOutput); }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + sortOrder); argumentList.add(String.format("TMP_DIR=%s/tmp", System.getenv("MAPSEQ_HOME"))); argumentList.add("OUTPUT=" + output.getAbsolutePath()); for (File f : input) { argumentList.add("INPUT=" + f.getAbsolutePath()); } int exitCode = 0; try { exitCode = new MergeSamFiles().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new BuildBamIndex().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM_INDEX); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { CommandInput commandInput = new CommandInput(); StringBuilder command = new StringBuilder(); command.append(getExecutable()); command.append(" -o "); String name = input.getName(); if (name.endsWith(".bam")) { name = StringUtils.removeEnd(name, ".bam"); } command.append(input.getAbsolutePath()).append(" ").append(name).append(" > ").append(output.getAbsolutePath()); commandInput.setCommand(command.toString()); CommandOutput commandOutput; try { Executor executor = BashExecutor.getInstance(); commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc")); } catch (ExecutorException e) { throw new ModuleException(e); } FileData fm = new FileData(); fm.setName(output.getName()); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return new ShellModuleOutput(commandOutput); }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); List<String> argumentList = new ArrayList<String>(); argumentList.add("VALIDATION_STRINGENCY=SILENT"); argumentList.add("SORT_ORDER=" + sortOrder); argumentList.add("TMP_DIR=" + tmpDir.getAbsolutePath()); argumentList.add("OUTPUT=" + output.getAbsolutePath()); for (File f : input) { argumentList.add("INPUT=" + f.getAbsolutePath()); } int exitCode = 0; try { exitCode = new MergeSamFiles().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setPath(output.getParentFile().getAbsolutePath()); fm.setName(output.getName()); fm.setMimeType(MimeType.APPLICATION_BAM); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws ModuleException { DefaultModuleOutput moduleOutput = new DefaultModuleOutput(); int exitCode = 0; try { List<String> argumentList = new ArrayList<String>(); argumentList.add("OUTPUT=" + output.getAbsolutePath()); argumentList.add("INPUT=" + input.getAbsolutePath()); exitCode = new BuildBamIndex().instanceMain(argumentList.toArray(new String[argumentList.size()])); } catch (Exception e) { e.printStackTrace(); moduleOutput.setError(new StringBuilder(e.getMessage())); moduleOutput.setExitCode(-1); return moduleOutput; } moduleOutput.setExitCode(exitCode); FileData fm = new FileData(); fm.setMimeType(MimeType.APPLICATION_BAM_INDEX); fm.setName(output.getName()); addFileData(fm); return moduleOutput; }
@Override public ModuleOutput call() throws Exception { CommandInput commandInput = new CommandInput(); StringBuilder command = new StringBuilder(); command.append(getModuleClass().getAnnotation(Executable.class).value()); command.append(" ").append(input.getAbsolutePath()).append(" ").append(output.getAbsolutePath()); commandInput.setCommand(command.toString()); CommandOutput commandOutput; try { Executor executor = BashExecutor.getInstance(); commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc")); } catch (ExecutorException e) { throw new ModuleException(e); } FileData fileData = new FileData(); fileData.setMimeType(MimeType.APPLICATION_PDF); fileData.setName(output.getName()); addFileData(fileData); return new ShellModuleOutput(commandOutput); }
@Override public ModuleOutput call() throws ModuleException { logger.debug("ENTERING call()"); CommandOutput commandOutput; try { StringBuilder command = new StringBuilder(); command.append(getModuleClass().getAnnotation(Executable.class).value()); command.append(" ").append(regularExpression); command.append(" > ").append(outputFile.getAbsolutePath()); CommandInput commandInput = new CommandInput(); commandInput.setWorkDir(directory); commandInput.setCommand(command.toString()); Executor executor = BashExecutor.getInstance(); commandOutput = executor.execute(commandInput, new File(System.getProperty("user.home"), ".mapseqrc")); if (mimeType != null) { FileData fileData = new FileData(); fileData.setName(outputFile.getName()); fileData.setMimeType(mimeType); addFileData(fileData); } } catch (ExecutorException e) { throw new ModuleException(e); } return new ShellModuleOutput(commandOutput); }