diff --git a/primeseq/src/org/labkey/primeseq/PrimeseqModule.java b/primeseq/src/org/labkey/primeseq/PrimeseqModule.java index c8c3539ae..a50f4f915 100644 --- a/primeseq/src/org/labkey/primeseq/PrimeseqModule.java +++ b/primeseq/src/org/labkey/primeseq/PrimeseqModule.java @@ -32,8 +32,6 @@ import org.labkey.api.view.WebPartFactory; import org.labkey.primeseq.analysis.CombineMethylationRatesHandler; import org.labkey.primeseq.analysis.MethylationRateComparisonHandler; -import org.labkey.primeseq.pipeline.BisSnpGenotyperAnalysis; -import org.labkey.primeseq.pipeline.BisSnpIndelRealignerStep; import org.labkey.primeseq.pipeline.BismarkWrapper; import org.labkey.primeseq.pipeline.BlastPipelineJobResourceAllocator; import org.labkey.primeseq.pipeline.ClusterMaintenanceTask; @@ -114,9 +112,6 @@ public PipelineStartup() SequencePipelineService.get().registerPipelineStep(new BismarkWrapper.Provider()); SequencePipelineService.get().registerPipelineStep(new BismarkWrapper.MethylationExtractorProvider()); - SequencePipelineService.get().registerPipelineStep(new BisSnpIndelRealignerStep.Provider()); - SequencePipelineService.get().registerPipelineStep(new BisSnpGenotyperAnalysis.Provider()); - SequenceAnalysisService.get().registerFileHandler(new MethylationRateComparisonHandler()); SequenceAnalysisService.get().registerFileHandler(new CombineMethylationRatesHandler()); diff --git a/primeseq/src/org/labkey/primeseq/pipeline/AbstractBisSnpWrapper.java b/primeseq/src/org/labkey/primeseq/pipeline/AbstractBisSnpWrapper.java deleted file mode 100644 index a2e7c12d5..000000000 --- a/primeseq/src/org/labkey/primeseq/pipeline/AbstractBisSnpWrapper.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.labkey.primeseq.pipeline; - -import org.apache.logging.log4j.Logger; -import org.labkey.api.pipeline.PipelineJobException; -import org.labkey.api.pipeline.PipelineJobService; -import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; -import org.labkey.api.sequenceanalysis.run.AbstractCommandWrapper; -import org.labkey.api.sequenceanalysis.run.CreateSequenceDictionaryWrapper; - -import java.io.File; - -/** - * Created by bimber on 8/14/2016. - */ -public class AbstractBisSnpWrapper extends AbstractCommandWrapper -{ - public AbstractBisSnpWrapper(Logger log) - { - super(log); - } - - protected File getJAR() - { - String path = PipelineJobService.get().getConfigProperties().getSoftwarePackagePath("BISSNPPATH"); - if (path != null) - { - return new File(path); - } - - path = PipelineJobService.get().getConfigProperties().getSoftwarePackagePath(SequencePipelineService.SEQUENCE_TOOLS_PARAM); - if (path == null) - { - path = PipelineJobService.get().getAppProperties().getToolsDirectory(); - } - - return path == null ? new File("BisSNP.jar") : new File(path, "BisSNP.jar"); - } - - public boolean jarExists() - { - return getJAR() == null || !getJAR().exists(); - } - - protected void ensureDictionary(File referenceFasta) throws PipelineJobException - { - getLogger().info("\tensure dictionary exists"); - new CreateSequenceDictionaryWrapper(getLogger()).execute(referenceFasta, false); - } - - protected String getJava6Filepath() - { - String javaDir = PipelineJobService.get().getConfigProperties().getSoftwarePackagePath("JAVA_HOME_6"); - if (javaDir != null) - { - File ret = new File(javaDir, "bin"); - ret = new File(ret, "java"); - return ret.getPath(); - } - - //if not explicitly found, try the default - javaDir = PipelineJobService.get().getConfigProperties().getSoftwarePackagePath("JAVA_HOME"); - if (javaDir != null) - { - File ret = new File(javaDir, "bin"); - ret = new File(ret, "java"); - return ret.getPath(); - } - - return "java"; - } -} diff --git a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpGenotyperAnalysis.java b/primeseq/src/org/labkey/primeseq/pipeline/BisSnpGenotyperAnalysis.java deleted file mode 100644 index 1f700a1d0..000000000 --- a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpGenotyperAnalysis.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.labkey.primeseq.pipeline; - -import org.labkey.api.pipeline.PipelineJobException; -import org.labkey.api.sequenceanalysis.model.AnalysisModel; -import org.labkey.api.sequenceanalysis.model.Readset; -import org.labkey.api.sequenceanalysis.pipeline.AbstractAnalysisStepProvider; -import org.labkey.api.sequenceanalysis.pipeline.AnalysisOutputImpl; -import org.labkey.api.sequenceanalysis.pipeline.AnalysisStep; -import org.labkey.api.sequenceanalysis.pipeline.CommandLineParam; -import org.labkey.api.sequenceanalysis.pipeline.PipelineContext; -import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider; -import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; -import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; -import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor; -import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep; -import org.labkey.api.util.FileUtil; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * User: bimber - * Date: 7/3/2014 - * Time: 11:29 AM - */ -public class BisSnpGenotyperAnalysis extends AbstractCommandPipelineStep implements AnalysisStep -{ - public BisSnpGenotyperAnalysis(PipelineStepProvider provider, PipelineContext ctx) - { - super(provider, ctx, new BisulfiteGenotyperWrapper(ctx.getLogger())); - } - - public static class Provider extends AbstractAnalysisStepProvider - { - public Provider() - { - super("BisulfiteGenotyperAnalysis", "BisSNP BisulfiteGenotyper", "BisSNP", "This will run BisSNP's BisulfiteGenotyper on the selected data.", getToolDescriptors(), null, null); - } - - @Override - public BisSnpGenotyperAnalysis create(PipelineContext ctx) - { - return new BisSnpGenotyperAnalysis(this, ctx); - } - } - - public static List getToolDescriptors() - { - return Arrays.asList( - ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("-stand_call_conf"), "stand_call_conf", "Threshold For Calling Variants", "The minimum phred-scaled confidence threshold at which variants should be called", "ldk-numberfield", null, 20), - ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("-stand_emit_conf"), "stand_emit_conf", "Threshold For Emitting Variants", "The minimum phred-scaled confidence threshold at which variants should be emitted (and filtered with LowQual if less than the calling threshold)", "ldk-numberfield", null, 20) - ); - } - - @Override - public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, ReferenceGenome referenceGenome, File outputDir) throws PipelineJobException - { - AnalysisOutputImpl output = new AnalysisOutputImpl(); - output.addInput(inputBam, "Input BAM File"); - - File snpOutputFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".snp.vcf"); - File cpgOutputFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".cpg.vcf"); - - getWrapper().setOutputDir(outputDir); - - List args = new ArrayList<>(); - args.addAll(getClientCommandArgs()); - - Integer maxThreads = SequencePipelineService.get().getMaxThreads(getPipelineCtx().getJob().getLogger()); - getWrapper().execute(inputBam, referenceGenome.getWorkingFastaFile(), cpgOutputFile, snpOutputFile, maxThreads, args); - - //sort, which will also create indexes - File dict = new File(referenceGenome.getWorkingFastaFile().getParent(), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile()) + ".dict"); - cpgOutputFile = SequencePipelineService.get().sortVcf(cpgOutputFile, new File(cpgOutputFile.getPath() + ".gz"), dict, getPipelineCtx().getLogger()); - snpOutputFile = SequencePipelineService.get().sortVcf(snpOutputFile, new File(snpOutputFile.getPath() + ".gz"), dict, getPipelineCtx().getLogger()); - - (new File(outputDir, FileUtil.getBaseName(inputBam) + ".snp.vcf")).delete(); - (new File(outputDir, FileUtil.getBaseName(inputBam) + ".cpg.vcf")).delete(); - (new File(outputDir, FileUtil.getBaseName(inputBam) + ".snp.vcf.idx")).delete(); - (new File(outputDir, FileUtil.getBaseName(inputBam) + ".cpg.vcf.idx")).delete(); - - File snpIdxFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".snp.vcf.gz.tbi"); - File cpgIdxFile = new File(outputDir, FileUtil.getBaseName(inputBam) + ".cpg.vcf.gz.tbi"); - - output.addOutput(cpgOutputFile, "Bisulfite VCF File"); - output.addSequenceOutput(cpgOutputFile, cpgOutputFile.getName(), "Bisulfite VCF File", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null); - if (cpgIdxFile.exists()) - { - output.addOutput(cpgIdxFile, "Bisulfite VCF Index"); - } - else - { - getPipelineCtx().getLogger().warn("expected index not found: " + cpgIdxFile.getName()); - } - output.addOutput(getWrapper().getFilterSummary(cpgOutputFile), "Bisulfite Filter Summary"); - - output.addOutput(snpOutputFile, "VCF File"); - output.addSequenceOutput(snpOutputFile, snpOutputFile.getName(), "VCF File", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null); - if (snpIdxFile.exists()) - { - output.addOutput(snpIdxFile, "Bisulfite VCF Index"); - } - else - { - getPipelineCtx().getLogger().warn("expected index not found: " + snpIdxFile.getName()); - } - output.addOutput(getWrapper().getFilterSummary(snpOutputFile), "Bisulfite Filter Summary"); - - return output; - } - - @Override - public Output performAnalysisPerSampleLocal(AnalysisModel model, File inputBam, File referenceFasta, File outDir) throws PipelineJobException - { - return null; - } -} diff --git a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerStep.java b/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerStep.java deleted file mode 100644 index 424459262..000000000 --- a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerStep.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.labkey.primeseq.pipeline; - -import org.labkey.api.pipeline.PipelineJobException; -import org.labkey.api.sequenceanalysis.model.Readset; -import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider; -import org.labkey.api.sequenceanalysis.pipeline.BamProcessingOutputImpl; -import org.labkey.api.sequenceanalysis.pipeline.BamProcessingStep; -import org.labkey.api.sequenceanalysis.pipeline.PipelineContext; -import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider; -import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; -import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; -import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep; -import org.labkey.api.util.FileUtil; - -import java.io.File; -import java.util.List; - -/** - * User: bimber - * Date: 6/15/2014 - * Time: 4:59 PM - */ -public class BisSnpIndelRealignerStep extends AbstractCommandPipelineStep implements BamProcessingStep -{ - public BisSnpIndelRealignerStep(PipelineStepProvider provider, PipelineContext ctx) - { - super(provider, ctx, new BisSnpIndelRealignerWrapper(ctx.getLogger())); - } - - public static class Provider extends AbstractPipelineStepProvider - { - public Provider() - { - super("BisSnpIndelRealigner", "BisSNP Indel Realigner", "BisSNP", "The step runs BisSNP's IndelRealigner tool. It is similar to GATK's, except adapted for bisulfite data.", List.of(), null, "https://sourceforge.net/projects/bissnp/"); - } - - @Override - public BisSnpIndelRealignerStep create(PipelineContext ctx) - { - return new BisSnpIndelRealignerStep(this, ctx); - } - } - - @Override - public Output processBam(Readset rs, File inputBam, ReferenceGenome referenceGenome, File outputDirectory) throws PipelineJobException - { - BamProcessingOutputImpl output = new BamProcessingOutputImpl(); - getWrapper().setOutputDir(outputDirectory); - - File dictionary = new File(referenceGenome.getWorkingFastaFile().getParentFile(), FileUtil.getBaseName(referenceGenome.getWorkingFastaFile().getName()) + ".dict"); - boolean dictionaryExists = dictionary.exists(); - getPipelineCtx().getLogger().debug("dict exists: " + dictionaryExists + ", " + dictionary.getPath()); - - File outputBam = new File(outputDirectory, FileUtil.getBaseName(inputBam) + ".bissnp-realigned.bam"); - Integer maxThreads = SequencePipelineService.get().getMaxThreads(getPipelineCtx().getJob().getLogger()); - output.setBAM(getWrapper().execute(inputBam, outputBam, referenceGenome.getWorkingFastaFile(), null, maxThreads)); - - output.addIntermediateFile(outputBam); - output.addIntermediateFile(getWrapper().getExpectedIntervalsFile(inputBam), "Realigner Intervals File"); - - if (!dictionaryExists) - { - if (dictionary.exists()) - { - output.addIntermediateFile(dictionary); - } - else - { - getPipelineCtx().getLogger().debug("dict file not found: " + dictionary.getPath()); - } - } - - //note: we might sort the input - File sortedBam = new File(inputBam.getParentFile(), FileUtil.getBaseName(inputBam) + ".sorted.bam"); - if (sortedBam.exists()) - { - getPipelineCtx().getLogger().debug("sorted file exists: " + sortedBam.getPath()); - output.addIntermediateFile(sortedBam); - output.addIntermediateFile(new File(outputDirectory, FileUtil.getBaseName(inputBam) + ".bissnp-realigned.bai")); - } - else - { - getPipelineCtx().getLogger().debug("sorted file does not exist: " + sortedBam.getPath()); - output.addIntermediateFile(new File(outputDirectory, FileUtil.getBaseName(inputBam) + ".bissnp-realigned.bai")); - } - - return output; - } -} diff --git a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerWrapper.java b/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerWrapper.java deleted file mode 100644 index 0390442d6..000000000 --- a/primeseq/src/org/labkey/primeseq/pipeline/BisSnpIndelRealignerWrapper.java +++ /dev/null @@ -1,199 +0,0 @@ -package org.labkey.primeseq.pipeline; - -import htsjdk.samtools.SAMFileHeader; -import org.apache.commons.io.FileUtils; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.Nullable; -import org.labkey.api.pipeline.PipelineJobException; -import org.labkey.api.sequenceanalysis.pipeline.SamSorter; -import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; -import org.labkey.api.util.FileUtil; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * User: bimber - * Date: 7/1/2014 - * Time: 2:40 PM - */ -public class BisSnpIndelRealignerWrapper extends AbstractBisSnpWrapper -{ - public BisSnpIndelRealignerWrapper(Logger log) - { - super(log); - } - - public File execute(File inputBam, @Nullable File outputBam, File referenceFasta, @Nullable File knownIndelsVcf, @Nullable Integer maxThreads) throws PipelineJobException - { - getLogger().info("Running BisSNP IndelRealigner for: " + inputBam.getName()); - - List tempFiles = new ArrayList<>(); - File workingBam = performSharedWork(inputBam, outputBam, referenceFasta, tempFiles); - if (!workingBam.equals(inputBam)) - { - tempFiles.add(workingBam); - } - - List extraArgs = new ArrayList<>(); - if (maxThreads != null) - { - extraArgs.add("-nt"); - extraArgs.add(maxThreads.toString()); - } - - File intervalsFile = buildTargetIntervals(referenceFasta, workingBam, knownIndelsVcf, getExpectedIntervalsFile(inputBam), extraArgs); - - //then run realigner - getLogger().info("\trunning BisSNP IndelRealigner"); - List realignerArgs = new ArrayList<>(); - realignerArgs.add(getJava6Filepath()); - realignerArgs.addAll(SequencePipelineService.get().getJavaOpts()); - realignerArgs.add("-jar"); - realignerArgs.add(getJAR().getPath()); - realignerArgs.add("-T"); - realignerArgs.add("IndelRealigner"); - realignerArgs.add("-R"); - realignerArgs.add(referenceFasta.getPath()); - realignerArgs.add("-I"); - realignerArgs.add(workingBam.getPath()); - realignerArgs.add("-o"); - - File realignedBam = outputBam == null ? new File(getOutputDir(inputBam), FileUtil.getBaseName(inputBam) + ".realigned.bam") : outputBam; - realignerArgs.add(realignedBam.getPath()); - realignerArgs.add("-targetIntervals"); - realignerArgs.add(intervalsFile.getPath()); - realignerArgs.add("--bam_compression"); - realignerArgs.add("9"); - if (knownIndelsVcf != null) - { - realignerArgs.add("--known"); - realignerArgs.add(knownIndelsVcf.getPath()); - } - - execute(realignerArgs); - if (!realignedBam.exists()) - { - throw new PipelineJobException("Expected BAM not found: " + realignedBam.getPath()); - } - - return processOutput(tempFiles, inputBam, outputBam, realignedBam); - } - - private File processOutput(List tempFiles, File inputBam, File outputBam, File realignedBam) throws PipelineJobException - { - if (!tempFiles.isEmpty()) - { - for (File f : tempFiles) - { - getLogger().debug("\tdeleting temp file: " + f.getPath()); - f.delete(); - } - } - - try - { - if (outputBam == null) - { - getLogger().debug("replacing input BAM with realigned"); - inputBam.delete(); - FileUtils.moveFile(realignedBam, inputBam); - - return inputBam; - } - else - { - return realignedBam; - } - } - catch (IOException e) - { - throw new PipelineJobException(e); - } - } - - private File buildTargetIntervals(File referenceFasta, File inputBam, File knownIndelsVcf, File intervalsFile, @Nullable List extraArgs) throws PipelineJobException - { - getLogger().info("building target intervals"); - List args = new ArrayList<>(); - args.add(getJava6Filepath()); - args.addAll(SequencePipelineService.get().getJavaOpts()); - args.add("-jar"); - args.add(getJAR().getPath()); - args.add("-T"); - args.add("BisulfiteRealignerTargetCreator"); - args.add("-R"); - args.add(referenceFasta.getPath()); - args.add("-I"); - args.add(inputBam.getPath()); - args.add("-o"); - - args.add(intervalsFile.getPath()); - - if (knownIndelsVcf != null) - { - args.add("--known"); - args.add(knownIndelsVcf.getPath()); - } - - if (extraArgs != null) - { - args.addAll(extraArgs); - } - - execute(args); - - //log the intervals - long lineCount = SequencePipelineService.get().getLineCount(intervalsFile); - getLogger().info("\ttarget intervals to realign: " + lineCount); - - return intervalsFile; - } - - private File performSharedWork(File inputBam, File outputBam, File referenceFasta, List tempFiles) throws PipelineJobException - { - //ensure BAM sorted - try - { - SAMFileHeader.SortOrder order = SequencePipelineService.get().getBamSortOrder(inputBam); - - if (SAMFileHeader.SortOrder.coordinate != order) - { - getLogger().info("coordinate sorting BAM, order was: " + (order == null ? "not provided" : order.name())); - File sorted = new File(inputBam.getParentFile(), FileUtil.getBaseName(inputBam) + ".sorted.bam"); - new SamSorter(getLogger()).execute(inputBam, sorted, SAMFileHeader.SortOrder.coordinate); - - //this indicates we expect to replace the original in place, in which case we should delete the unsorted BAM - if (outputBam == null) - { - tempFiles.add(inputBam); - } - - inputBam = sorted; - } - else - { - getLogger().info("bam is already in coordinate sort order"); - } - } - catch (IOException e) - { - throw new PipelineJobException(e); - } - - ensureDictionary(referenceFasta); - - File idx = SequencePipelineService.get().ensureBamIndex(inputBam, getLogger(), true); - if (idx != null) - tempFiles.add(idx); - - return inputBam; - } - - public File getExpectedIntervalsFile(File inputBam) - { - return new File(getOutputDir(inputBam), FileUtil.getBaseName(inputBam) + ".intervals"); - } -} diff --git a/primeseq/src/org/labkey/primeseq/pipeline/BisulfiteGenotyperWrapper.java b/primeseq/src/org/labkey/primeseq/pipeline/BisulfiteGenotyperWrapper.java deleted file mode 100644 index 85f4627cf..000000000 --- a/primeseq/src/org/labkey/primeseq/pipeline/BisulfiteGenotyperWrapper.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.labkey.primeseq.pipeline; - -import org.apache.logging.log4j.Logger; -import org.labkey.api.pipeline.PipelineJobException; -import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by bimber on 8/8/2014. - */ -public class BisulfiteGenotyperWrapper extends AbstractBisSnpWrapper -{ - public BisulfiteGenotyperWrapper(Logger log) - { - super(log); - } - - public void execute(File inputBam, File referenceFasta, File cpgOutputFile, File snpOutputFile, Integer maxThreads, List options) throws PipelineJobException - { - getLogger().info("Running BisSNP BisulfiteGenotyper for: " + inputBam.getName()); - - if (cpgOutputFile.getName().toLowerCase().endsWith(".gz") || snpOutputFile.getName().toLowerCase().endsWith(".gz")) - { - throw new PipelineJobException("BisulfiteGenotyper is built using an old GATK version and does not work properly with gzipped files"); - } - - ensureDictionary(referenceFasta); - - File createdIndex = SequencePipelineService.get().ensureBamIndex(inputBam, getLogger(), false); - if (createdIndex == null) - { - getLogger().debug("\tusing existing BAM index"); - } - - File rawCpgOutput = new File(getOutputDir(cpgOutputFile), SequencePipelineService.get().getUnzippedBaseName(cpgOutputFile.getName()) + ".cpg-raw.vcf"); - File rawSnpOutput = new File(getOutputDir(snpOutputFile), SequencePipelineService.get().getUnzippedBaseName(snpOutputFile.getName()) + ".snp-raw.vcf"); - - List args = new ArrayList<>(); - args.add(getJava6Filepath()); - args.addAll(SequencePipelineService.get().getJavaOpts()); - args.add("-jar"); - args.add(getJAR().getPath()); - args.add("-T"); - args.add("BisulfiteGenotyper"); - args.add("-R"); - args.add(referenceFasta.getPath()); - args.add("-I"); - args.add(inputBam.getPath()); - args.add("-vfn1"); - args.add(rawCpgOutput.getPath()); - args.add("-vfn2"); - args.add(rawSnpOutput.getPath()); - - if (options != null) - { - args.addAll(options); - } - - if (maxThreads != null) - { - args.add("-nt"); - args.add(maxThreads.toString()); - } - else - { - getLogger().debug("max threads not set"); - } - - execute(args); - if (!rawCpgOutput.exists()) - { - throw new PipelineJobException("Expected output not found: " + rawCpgOutput.getPath()); - } - - try - { - SequencePipelineService.get().sortROD(rawCpgOutput, getLogger(), 2); - SequencePipelineService.get().sortROD(rawSnpOutput, getLogger(), 2); - } - catch (IOException e) - { - throw new PipelineJobException(e); - } - - //then filter - getLogger().info("filtering CpG VCF"); - List filterArgs1 = new ArrayList<>(); - filterArgs1.add(getJava6Filepath()); - filterArgs1.addAll(SequencePipelineService.get().getJavaOpts()); - filterArgs1.add("-jar"); - filterArgs1.add(getJAR().getPath()); - filterArgs1.add("-T"); - filterArgs1.add("VCFpostprocess"); - filterArgs1.add("-R"); - filterArgs1.add(referenceFasta.getPath()); - filterArgs1.add("-oldVcf"); - filterArgs1.add(rawCpgOutput.getPath()); - filterArgs1.add("-newVcf"); - filterArgs1.add(cpgOutputFile.getPath()); - filterArgs1.add("-snpVcf"); - filterArgs1.add(rawCpgOutput.getPath()); - filterArgs1.add("-o"); - filterArgs1.add(getFilterSummary(cpgOutputFile).getPath()); - execute(filterArgs1); - - (new File(rawCpgOutput.getPath() + ".idx")).delete(); - rawCpgOutput.delete(); - - getLogger().info("filtering CpG VCF"); - List filterArgs2 = new ArrayList<>(); - filterArgs2.add(getJava6Filepath()); - filterArgs2.addAll(SequencePipelineService.get().getJavaOpts()); - filterArgs2.add("-jar"); - filterArgs2.add(getJAR().getPath()); - filterArgs2.add("-T"); - filterArgs2.add("VCFpostprocess"); - filterArgs2.add("-R"); - filterArgs2.add(referenceFasta.getPath()); - filterArgs2.add("-oldVcf"); - filterArgs2.add(rawSnpOutput.getPath()); - filterArgs2.add("-newVcf"); - filterArgs2.add(snpOutputFile.getPath()); - filterArgs2.add("-snpVcf"); - filterArgs2.add(rawSnpOutput.getPath()); - filterArgs2.add("-o"); - filterArgs2.add(getFilterSummary(snpOutputFile).getPath()); - execute(filterArgs2); - - (new File(rawSnpOutput.getPath() + ".idx")).delete(); - rawSnpOutput.delete(); - - if (createdIndex != null) - { - getLogger().debug("\tdeleting temp BAM index: " + createdIndex.getPath()); - createdIndex.delete(); - } - } - - public File getFilterSummary(File vcf) - { - return new File(getOutputDir(vcf), SequencePipelineService.get().getUnzippedBaseName(vcf.getName()) + ".summary.txt"); - } -}