Skip to content

Commit e42f373

Browse files
committed
Ensure we never add pre-existing input as intermediate file
1 parent faa59e5 commit e42f373

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ private File setupConfigDir(File outDir) throws IOException
5757

5858
baseDir.mkdirs();
5959

60+
if (_sampleData == null)
61+
{
62+
throw new IOException("_sampleData was null");
63+
}
64+
6065
File source = new File(_sampleData, "remotePipeline");
66+
if (!source.exists())
67+
{
68+
throw new IOException("Unable to find file: " + source.getPath());
69+
}
70+
6171
FileUtils.copyFile(new File(source, "sequenceanalysisConfig.xml"), new File(baseDir, "sequenceanalysisConfig.xml"));
6272

6373
try (PrintWriter writer = PrintWriters.getPrintWriter(new File(baseDir, "pipelineConfig.xml")); BufferedReader reader = Readers.getReader(new File(source, "pipelineConfig.xml")))
@@ -179,6 +189,7 @@ protected void executeJobRemote(File workDir, @Nullable File jobJson) throws IOE
179189
args.add("org.labkey.bootstrap.ClusterBootstrap");
180190

181191
File webappDir = new File(ModuleLoader.getServletContext().getRealPath(""));
192+
182193
args.add("-modulesdir=" + new File(webappDir.getParentFile(), "modules").getPath());
183194
args.add("-webappdir=" + webappDir.getPath());
184195

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/ProcessVariantsHandler.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package org.labkey.sequenceanalysis.pipeline;
22

3-
import htsjdk.samtools.SAMSequenceDictionary;
43
import htsjdk.samtools.util.Interval;
54
import htsjdk.tribble.AbstractFeatureReader;
65
import htsjdk.tribble.FeatureReader;
7-
import htsjdk.variant.utils.SAMSequenceDictionaryExtractor;
86
import htsjdk.variant.vcf.VCFCodec;
97
import htsjdk.variant.vcf.VCFFileReader;
108
import htsjdk.variant.vcf.VCFHeader;
@@ -38,6 +36,7 @@
3836
import org.labkey.api.sequenceanalysis.run.SimpleScriptWrapper;
3937
import org.labkey.api.util.FileType;
4038
import org.labkey.api.util.FileUtil;
39+
import org.labkey.api.util.URIUtil;
4140
import org.labkey.api.view.ActionURL;
4241
import org.labkey.api.writer.PrintWriters;
4342
import org.labkey.sequenceanalysis.SequenceAnalysisModule;
@@ -403,9 +402,22 @@ public static File processVCF(File input, Integer libraryId, JobContext ctx, Res
403402
action.addInput(vcfIdx, "Input VCF Index");
404403
}
405404

406-
resumer.getFileManager().addIntermediateFile(currentVCF);
407-
resumer.getFileManager().addIntermediateFile(vcfIdx);
408-
405+
if (!currentVCF.equals(input))
406+
{
407+
if (!URIUtil.isDescendant(ctx.getOutputDir().toURI(), currentVCF.toURI()))
408+
{
409+
ctx.getLogger().info("VCF is not a descendent of the output directory, will not add as intermediate file: " + currentVCF.getPath());
410+
}
411+
else
412+
{
413+
resumer.getFileManager().addIntermediateFile(currentVCF);
414+
resumer.getFileManager().addIntermediateFile(vcfIdx);
415+
}
416+
}
417+
else
418+
{
419+
ctx.getLogger().info("ending VCF same as input, will not add as intermediate file: " + input.getPath());
420+
}
409421
ReferenceGenome genome = ctx.getSequenceSupport().getCachedGenome(libraryId);
410422
action.addInput(genome.getSourceFastaFile(), "Reference FASTA");
411423

0 commit comments

Comments
 (0)