Skip to content

Commit 759d8d0

Browse files
committed
Use correct container when updating replaced readsets
1 parent cbcaa77 commit 759d8d0

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ public class FastqcReportAction extends SimpleViewAction<FastqcForm>
221221
public ModelAndView getView(FastqcForm form, BindException errors) throws Exception
222222
{
223223
if (form.getFilenames() == null && form.getDataIds() == null)
224-
errors.reject("Must provide a filename or Exp data Ids");
224+
{
225+
errors.reject(ERROR_MSG, "Must provide a filename or Exp data Ids");
226+
return null;
227+
}
225228

226229
//resolve files
227230
List<File> files = new ArrayList<>();
@@ -597,20 +600,20 @@ public void validateCommand(DeleteForm form, Errors errors)
597600
{
598601
if (form.getSchema() == null)
599602
{
600-
errors.reject("No schema provided");
603+
errors.reject(ERROR_MSG, "No schema provided");
601604
return;
602605
}
603606

604607
if (form.getQueryName() == null)
605608
{
606-
errors.reject("No queryName provided");
609+
errors.reject(ERROR_MSG, "No queryName provided");
607610
return;
608611
}
609612

610613
_table = SequenceAnalysisSchema.getInstance().getSchema().getTable(form.getQueryName());
611614
if (_table == null)
612615
{
613-
errors.reject("Unknown table: " + form.getQueryName());
616+
errors.reject(ERROR_MSG, "Unknown table: " + form.getQueryName());
614617
return;
615618
}
616619

@@ -2220,7 +2223,7 @@ public ApiResponse execute(CreateReferenceLibraryForm form, BindException errors
22202223
String[] coordinates = t.split("-");
22212224
if (coordinates.length != 2)
22222225
{
2223-
errors.reject("Inproper interval: [" + t + "]");
2226+
errors.reject(ERROR_MSG, "Inproper interval: [" + t + "]");
22242227
return null;
22252228
}
22262229

@@ -3143,7 +3146,7 @@ public void exec(ResultSet object) throws SQLException
31433146
String wholeSequence = model.getSequence();
31443147
if (wholeSequence == null)
31453148
{
3146-
errors.reject("Unable to find sequence for: " + rowId);
3149+
errors.reject(ERROR_MSG, "Unable to find sequence for: " + rowId);
31473150
return;
31483151
}
31493152

@@ -3152,21 +3155,21 @@ public void exec(ResultSet object) throws SQLException
31523155
String[] coordinates = t.split("-");
31533156
if (coordinates.length != 2)
31543157
{
3155-
errors.reject("Inproper interval: [" + t + "]");
3158+
errors.reject(ERROR_MSG, "Inproper interval: [" + t + "]");
31563159
return;
31573160
}
31583161

31593162
Integer start = StringUtils.trimToNull(coordinates[0]) == null ? null : ConvertHelper.convert(coordinates[0], Integer.class);
31603163
if (wholeSequence.length() < start)
31613164
{
3162-
errors.reject("Start is beyond the length of the sequence. Length: " + wholeSequence.length());
3165+
errors.reject(ERROR_MSG, "Start is beyond the length of the sequence. Length: " + wholeSequence.length());
31633166
return;
31643167
}
31653168

31663169
Integer stop = StringUtils.trimToNull(coordinates[1]) == null ? null : ConvertHelper.convert(coordinates[1], Integer.class);
31673170
if (wholeSequence.length() < stop)
31683171
{
3169-
errors.reject("Stop is beyond the length of the sequence. Length: " + wholeSequence.length());
3172+
errors.reject(ERROR_MSG, "Stop is beyond the length of the sequence. Length: " + wholeSequence.length());
31703173
return;
31713174
}
31723175

@@ -3274,7 +3277,7 @@ public ApiResponse execute(RecreateReferenceLibraryForm form, BindException erro
32743277
{
32753278
if (form.getLibraryIds() == null || form.getLibraryIds().length == 0)
32763279
{
3277-
errors.reject("Must provide a list of reference genomes to re-process");
3280+
errors.reject(ERROR_MSG, "Must provide a list of reference genomes to re-process");
32783281
return null;
32793282
}
32803283

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/ReadsetCreationTask.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,18 @@ private void importReadsets() throws PipelineJobException
173173
SequenceReadsetImpl r = (SequenceReadsetImpl)rs;
174174
getJob().getLogger().info("Starting readset " + r.getName());
175175

176-
boolean readsetExists = r.getReadsetId() != null && r.getReadsetId() > 0;
177-
List<ReadDataImpl> preexistingReadData;
178-
if (readsetExists)
176+
List<ReadDataImpl> preexistingReadData = ((SequenceReadsetImpl)SequenceAnalysisService.get().getReadset(r.getReadsetId(), getJob().getUser())).getReadDataImpl();
177+
boolean readsetExistsWithData = !preexistingReadData.isEmpty();
178+
if (readsetExistsWithData)
179179
{
180+
getJob().getLogger().info("Readset has existing data: " + r.getName());
181+
180182
readsetsToDeactivate.put(r.getReadsetId(), r.getContainer());
181-
preexistingReadData = ((SequenceReadsetImpl)SequenceAnalysisService.get().getReadset(r.getReadsetId(), getJob().getUser())).getReadDataImpl();
182-
}
183-
else
184-
{
185-
preexistingReadData = Collections.emptyList();
186183
}
187184

188185
SequenceReadsetImpl row;
189-
if (!readsetExists)
186+
boolean readsetWillBeCreated = true;
187+
if (!readsetExistsWithData)
190188
{
191189
row = new SequenceReadsetImpl();
192190

@@ -237,7 +235,10 @@ private void importReadsets() throws PipelineJobException
237235
row.setCreated(new Date());
238236
row.setModifiedBy(getJob().getUser().getUserId());
239237
row.setModified(new Date());
240-
readsetExists = false;
238+
}
239+
else
240+
{
241+
readsetWillBeCreated = false;
241242
}
242243
}
243244

@@ -360,7 +361,7 @@ private void importReadsets() throws PipelineJobException
360361
row.setReadData(readDatasToCreate);
361362

362363
SequenceReadsetImpl newRow;
363-
if (!readsetExists)
364+
if (!readsetWillBeCreated)
364365
{
365366
newRow = Table.insert(getJob().getUser(), readsetTable, row);
366367
getJob().getLogger().info("Created readset: " + newRow.getReadsetId());

0 commit comments

Comments
 (0)