Skip to content

Commit bffe350

Browse files
authored
Make SequenceIntegrationTests work across-workbooks (#365)
* Make SequenceIntegrationTests work across-workbooks
1 parent 2d1f04d commit bffe350

File tree

4 files changed

+319
-400
lines changed

4 files changed

+319
-400
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static class VariantProcessingTest extends SequenceIntegrationTests.Abstr
6262
private static final String PROJECT_NAME = "VariantProcessingTestProject";
6363

6464
@BeforeClass
65-
public static void initialSetUp() throws Exception
65+
public static void initialSetUp()
6666
{
6767
doInitialSetUp(PROJECT_NAME);
6868
}
@@ -90,12 +90,12 @@ public void testVariantProcessing() throws Exception
9090

9191
//create VCF, import as outputfile
9292
String basename = "TestFile_" + FileUtil.getTimestamp();
93-
File vcf = new File(_pipelineRoot, basename + ".vcf.gz");
93+
File vcf = FileUtil.appendName(getPipelineRoot(_project), basename + ".vcf.gz");
9494
Integer outputFileId = createTestVcf(genomeId, vcf);
9595

9696
//make job params
9797
String jobName = "TestVariantProcessing";
98-
JSONObject config = substituteParams(new File(_sampleData, VARIANT_JOB), jobName);
98+
JSONObject config = substituteParams(FileUtil.appendName(_sampleData, VARIANT_JOB), jobName);
9999
Set<Integer> outputFileIds = Collections.singleton(outputFileId);
100100

101101
TableInfo ti = QueryService.get().getUserSchema(TestContext.get().getUser(), _project, SequenceAnalysisSchema.SCHEMA_NAME).getTable(SequenceAnalysisSchema.TABLE_OUTPUTFILES, null);
@@ -110,13 +110,13 @@ public void testVariantProcessing() throws Exception
110110
SequenceOutputHandlerJob job = (SequenceOutputHandlerJob)j;
111111

112112
Set<File> extraFiles = new HashSet<>();
113-
extraFiles.add(new File(job.getAnalysisDirectory(), jobName + "." + outputFileId + ".log"));
114-
extraFiles.add(new File(job.getAnalysisDirectory(), "sequenceOutput.json"));
115-
extraFiles.add(new File(job.getAnalysisDirectory(), "sequenceSupport.json.gz"));
113+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), jobName + "." + outputFileId + ".log"));
114+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), "sequenceOutput.json"));
115+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), "sequenceSupport.json.gz"));
116116
extraFiles.add(ProcessVariantsHandler.getPedigreeFile(job.getAnalysisDirectory(), "laboratory.subjects"));
117-
extraFiles.add(new File(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz"));
118-
extraFiles.add(new File(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz.tbi"));
119-
extraFiles.add(new File(job.getAnalysisDirectory(), job.getBaseName() + ".pipe.xar.xml"));
117+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz"));
118+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz.tbi"));
119+
extraFiles.add(FileUtil.appendName(job.getAnalysisDirectory(), job.getBaseName() + ".pipe.xar.xml"));
120120

121121
verifyFileOutputs(job.getAnalysisDirectory(), extraFiles);
122122

@@ -128,7 +128,7 @@ public void testVariantProcessing() throws Exception
128128
}
129129
}
130130

131-
protected Set<PipelineJob> createOutputHandlerJob(String jobName, JSONObject config, Class handlerClass, Set<Integer> outputFileIDs) throws Exception
131+
protected Set<PipelineJob> createOutputHandlerJob(String jobName, JSONObject config, Class<?> handlerClass, Set<Integer> outputFileIDs) throws Exception
132132
{
133133
Map<String, Object> headers = new HashMap<>();
134134
headers.put("Content-Type", "application/json");
@@ -199,7 +199,7 @@ private int createTestVcf(int genomeId, File vcf)
199199
Integer dataId = new TableSelector(SequenceAnalysisSchema.getTable(SequenceAnalysisSchema.TABLE_REF_LIBRARIES), PageFlowUtil.set("fasta_file"), new SimpleFilter(FieldKey.fromString("rowid"), genomeId), null).getObject(Integer.class);
200200
ExpData data = ExperimentService.get().getExpData(dataId);
201201

202-
File dictFile = new File(data.getFile().getParent(), FileUtil.getBaseName(data.getFile().getName()) + ".dict");
202+
File dictFile = FileUtil.appendName(data.getFile().getParentFile(), FileUtil.getBaseName(data.getFile().getName()) + ".dict");
203203
if (dictFile.exists())
204204
{
205205
SAMSequenceDictionary dict = SAMSequenceDictionaryExtractor.extractDictionary(dictFile.toPath());
@@ -221,7 +221,7 @@ private int createTestVcf(int genomeId, File vcf)
221221
writer.add(vcb.make());
222222
}
223223

224-
ExpData d = createExpData(vcf);
224+
ExpData d = createExpData(vcf, _project);
225225
Map<String, Object> params = new CaseInsensitiveHashMap<>();
226226
params.put("name", "TestVcf");
227227
params.put("description", "Description");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ else if (o.has("relPath") || o.has("fileName"))
19241924

19251925
if (f == null || !f.exists())
19261926
{
1927-
throw new PipelineValidationException("Unknown file: " + o.getString("relPath") + " / " + o.getString("fileName"));
1927+
throw new PipelineValidationException("Unknown file: " + o.optString("relPath") + " / " + o.optString("fileName"));
19281928
}
19291929

19301930
ret.add(f.toNioPathForRead().toFile());

0 commit comments

Comments
 (0)