22
33import org .apache .logging .log4j .Logger ;
44import org .jetbrains .annotations .NotNull ;
5+ import org .labkey .api .exp .XarFormatException ;
56import org .labkey .api .pipeline .AbstractTaskFactory ;
67import org .labkey .api .pipeline .AbstractTaskFactorySettings ;
78import org .labkey .api .pipeline .PipelineJob ;
89import org .labkey .api .pipeline .PipelineJobException ;
10+ import org .labkey .api .pipeline .PipelineValidationException ;
911import org .labkey .api .pipeline .RecordedAction ;
1012import org .labkey .api .pipeline .RecordedActionSet ;
1113import org .labkey .api .pipeline .WorkDirectoryTask ;
1214import org .labkey .api .security .SecurityManager ;
15+ import org .labkey .api .targetedms .TargetedMSService ;
1316import org .labkey .api .util .FileType ;
1417import org .labkey .nextflow .NextFlowConfiguration ;
1518import org .labkey .nextflow .NextFlowManager ;
@@ -79,8 +82,8 @@ public NextFlowRunTask(Factory factory, PipelineJob job)
7982 {
8083 action .addInput (inputFile .toFile (), SPECTRA_INPUT_ROLE );
8184 }
82- addOutputs (action , getJob ().getLogFilePath ().getParent ().resolve ("reports" ));
83- addOutputs (action , getJob ().getLogFilePath ().getParent ().resolve ("results" ));
85+ addOutputs (action , getJob ().getLogFilePath ().getParent ().resolve ("reports" ), log );
86+ addOutputs (action , getJob ().getLogFilePath ().getParent ().resolve ("results" ), log );
8487 return new RecordedActionSet (action );
8588 }
8689 catch (IOException e )
@@ -96,19 +99,32 @@ public NextFlowRunTask(Factory factory, PipelineJob job)
9699 }
97100 }
98101
99- private void addOutputs (RecordedAction action , Path path ) throws IOException
102+ private void addOutputs (RecordedAction action , Path path , Logger log ) throws IOException
100103 {
101104 if (Files .isRegularFile (path ))
102105 {
103106 action .addOutput (path .toFile (), "Output" , false );
107+ if (path .toString ().toLowerCase ().endsWith (".sky.zip" ))
108+ {
109+ try
110+ {
111+ log .info ("Queueing import for {}" , path );
112+ // Make sure that the TargetedMS runs get wrapped with their experiment run counterparts
113+ TargetedMSService .get ().importSkylineDocument (getJob ().getInfo (), path );
114+ }
115+ catch (XarFormatException | PipelineValidationException e )
116+ {
117+ log .error ("Error queuing import of Skyline document" , e );
118+ }
119+ }
104120 }
105121 else if (Files .isDirectory (path ))
106122 {
107123 try (Stream <Path > listing = Files .list (path ))
108124 {
109125 for (Path child : listing .toList ())
110126 {
111- addOutputs (action , child );
127+ addOutputs (action , child , log );
112128 }
113129 }
114130 }
0 commit comments