88import org .apache .commons .lang3 .StringUtils ;
99import org .apache .logging .log4j .Logger ;
1010import org .json .JSONObject ;
11+ import org .labkey .api .data .CompareType ;
1112import org .labkey .api .data .Container ;
1213import org .labkey .api .data .SimpleFilter ;
1314import org .labkey .api .data .TableSelector ;
@@ -201,6 +202,7 @@ public void init(PipelineJob job, SequenceAnalysisJobSupport support, List<Seque
201202 getPipelineCtx ().getLogger ().info ("Writing Sample Map" );
202203 for (SequenceOutputFile so : inputFiles )
203204 {
205+ Set <String > duplicates = new HashSet <>();
204206 try (VCFFileReader reader = new VCFFileReader (so .getFile ()))
205207 {
206208 VCFHeader header = reader .getFileHeader ();
@@ -213,17 +215,22 @@ public void init(PipelineJob job, SequenceAnalysisJobSupport support, List<Seque
213215 {
214216 // Find readset:
215217 Container targetContainer = getPipelineCtx ().getJob ().getContainer ().isWorkbook () ? getPipelineCtx ().getJob ().getContainer ().getParent () : getPipelineCtx ().getJob ().getContainer ();
216- Set <String > applications = new HashSet <>(new TableSelector (QueryService .get ().getUserSchema (getPipelineCtx ().getJob ().getUser (), targetContainer , SequenceAnalysisSchema .SCHEMA_NAME ).getTable (SequenceAnalysisSchema .TABLE_READSETS ), PageFlowUtil .set ("application" ), new SimpleFilter (FieldKey .fromString ("name" ), sample ), null ).getArrayList (String .class ));
218+ Set <String > applications = new HashSet <>(new TableSelector (QueryService .get ().getUserSchema (getPipelineCtx ().getJob ().getUser (), targetContainer , SequenceAnalysisSchema .SCHEMA_NAME ).getTable (SequenceAnalysisSchema .TABLE_READSETS ), PageFlowUtil .set ("application" ), new SimpleFilter (FieldKey .fromString ("name" ), sample ). addCondition ( FieldKey . fromString ( "status" ), null , CompareType . ISBLANK ) , null ).getArrayList (String .class ));
217219 if (applications .size () == 1 )
218220 {
219221 writer .println (sample + "\t " + applications .iterator ().next ());
220222 }
221223 else
222224 {
223- throw new PipelineJobException ( "More than one readset found with name: " + sample );
225+ duplicates . add ( sample );
224226 }
225227 }
226228 }
229+
230+ if (!duplicates .isEmpty ())
231+ {
232+ throw new PipelineJobException ("More than one readset with the given name found for the following samples: " + StringUtils .join (duplicates , "," ));
233+ }
227234 }
228235 }
229236 catch (IOException e )
0 commit comments