Skip to content

Commit c9fe580

Browse files
committed
Improve genome validation
1 parent d573556 commit c9fe580

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/SequenceOutputHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ default boolean requiresSingleGenome()
7575
return true;
7676
}
7777

78+
/**
79+
* @return Whether this handler requires each input to be associated with a genome
80+
*/
81+
default boolean requiresGenome()
82+
{
83+
return true;
84+
}
85+
7886
public boolean canProcess(SequenceOutputFile o);
7987

8088
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,23 +4062,23 @@ public ApiResponse execute(RunSequenceHandlerForm form, BindException errors) th
40624062

40634063
protected PipelineJob createOutputJob(RunSequenceHandlerForm form, Container targetContainer, String jobName, PipeRoot pr1, SequenceOutputHandler handler, List<SequenceOutputFile> inputs, JSONObject json) throws IOException, PipelineJobException
40644064
{
4065-
validateGenomes(inputs);
4065+
validateGenomes(inputs, handler);
40664066
return new SequenceOutputHandlerJob(targetContainer, getUser(), jobName, pr1, handler, inputs, json);
40674067
}
40684068

4069-
protected void validateGenomes(List<SequenceOutputFile> inputs) throws IllegalArgumentException
4069+
protected void validateGenomes(List<SequenceOutputFile> inputs, SequenceOutputHandler<?> handler) throws IllegalArgumentException
40704070
{
40714071
Set<Integer> genomes = new HashSet<>();
40724072
inputs.forEach(x -> {
4073-
if (x.getLibrary_id() == null)
4073+
if (x.getLibrary_id() == null && (handler.requiresGenome() || handler.requiresSingleGenome()))
40744074
{
40754075
throw new IllegalArgumentException("Input missing genome: " + x.getRowid());
40764076
}
40774077

40784078
genomes.add(x.getLibrary_id());
40794079
});
40804080

4081-
if (genomes.size() > 1)
4081+
if (genomes.size() > 1 && handler.requiresSingleGenome())
40824082
{
40834083
throw new IllegalArgumentException("All inputs must use the same base genome");
40844084
}
@@ -4108,7 +4108,7 @@ protected PipelineJob createOutputJob(RunSequenceHandlerForm form, Container tar
41084108
String method = json.getString("scatterGatherMethod");
41094109
try
41104110
{
4111-
validateGenomes(inputs);
4111+
validateGenomes(inputs, handler);
41124112
VariantProcessingStep.ScatterGatherMethod scatterMethod = VariantProcessingStep.ScatterGatherMethod.valueOf(method);
41134113

41144114
return new VariantProcessingJob(targetContainer, getUser(), jobName, pr1, handler, inputs, json, scatterMethod);

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/RnaSeqcHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
193193
so.setFile(indexHtml);
194194
so.setContainer(job.getContainerId());
195195
so.setName(params.getString("name"));
196+
so.setLibrary_id(g.getGenomeId());
196197
ctx.addSequenceOutput(so);
197198

198199
action.setEndTime(new Date());

0 commit comments

Comments
 (0)