Skip to content

Commit

Permalink
Create experiment wrapper for TargetedMS run (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-jeckels authored Dec 30, 2024
1 parent 690b326 commit 396e8d7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions nextflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ dependencies {

BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "experiment"), depProjectConfig: "published", depExtension: "module")
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "pipeline"), depProjectConfig: "published", depExtension: "module")

BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:targetedms", depProjectConfig: "apiJarFile")
BuildUtils.addLabKeyDependency(project: project, config: "jspImplementation", depProjectPath: ":server:modules:targetedms", depProjectConfig: "apiJarFile")
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:targetedms", depProjectConfig: "published", depExtension: "module")
}
24 changes: 20 additions & 4 deletions nextflow/src/org/labkey/nextflow/pipeline/NextFlowRunTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.exp.XarFormatException;
import org.labkey.api.pipeline.AbstractTaskFactory;
import org.labkey.api.pipeline.AbstractTaskFactorySettings;
import org.labkey.api.pipeline.PipelineJob;
import org.labkey.api.pipeline.PipelineJobException;
import org.labkey.api.pipeline.PipelineValidationException;
import org.labkey.api.pipeline.RecordedAction;
import org.labkey.api.pipeline.RecordedActionSet;
import org.labkey.api.pipeline.WorkDirectoryTask;
import org.labkey.api.security.SecurityManager;
import org.labkey.api.targetedms.TargetedMSService;
import org.labkey.api.util.FileType;
import org.labkey.nextflow.NextFlowConfiguration;
import org.labkey.nextflow.NextFlowManager;
Expand Down Expand Up @@ -79,8 +82,8 @@ public NextFlowRunTask(Factory factory, PipelineJob job)
{
action.addInput(inputFile.toFile(), SPECTRA_INPUT_ROLE);
}
addOutputs(action, getJob().getLogFilePath().getParent().resolve("reports"));
addOutputs(action, getJob().getLogFilePath().getParent().resolve("results"));
addOutputs(action, getJob().getLogFilePath().getParent().resolve("reports"), log);
addOutputs(action, getJob().getLogFilePath().getParent().resolve("results"), log);
return new RecordedActionSet(action);
}
catch (IOException e)
Expand All @@ -96,19 +99,32 @@ public NextFlowRunTask(Factory factory, PipelineJob job)
}
}

private void addOutputs(RecordedAction action, Path path) throws IOException
private void addOutputs(RecordedAction action, Path path, Logger log) throws IOException
{
if (Files.isRegularFile(path))
{
action.addOutput(path.toFile(), "Output", false);
if (path.toString().toLowerCase().endsWith(".sky.zip"))
{
try
{
log.info("Queueing import for {}", path);
// Make sure that the TargetedMS runs get wrapped with their experiment run counterparts
TargetedMSService.get().importSkylineDocument(getJob().getInfo(), path);
}
catch (XarFormatException | PipelineValidationException e)
{
log.error("Error queuing import of Skyline document", e);
}
}
}
else if (Files.isDirectory(path))
{
try (Stream<Path> listing = Files.list(path))
{
for (Path child : listing.toList())
{
addOutputs(action, child);
addOutputs(action, child, log);
}
}
}
Expand Down

0 comments on commit 396e8d7

Please sign in to comment.