Skip to content

Commit 2a8c676

Browse files
committed
Add validation
1 parent 59b2682 commit 2a8c676

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

singlecell/api-src/org/labkey/api/singlecell/CellHashingService.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import au.com.bytecode.opencsv.CSVReader;
44
import org.apache.commons.lang3.StringUtils;
55
import org.apache.logging.log4j.Logger;
6+
import org.jetbrains.annotations.NotNull;
67
import org.jetbrains.annotations.Nullable;
7-
import org.json.JSONArray;
88
import org.json.JSONObject;
99
import org.labkey.api.pipeline.PipelineJob;
1010
import org.labkey.api.pipeline.PipelineJobException;
@@ -112,6 +112,11 @@ public static CellHashingService.CellHashingParameters createFromStep(SequenceOu
112112
ret.htoOrCiteseqBarcodesFile = htoOrCiteseqBarcodesFile == null ? new File(ctx.getSourceDirectory(), type.getAllBarcodeFileName()) : htoOrCiteseqBarcodesFile;
113113
ret.methods = extractMethods(step.getProvider().getParameterByName("methods").extractValue(ctx.getJob(), step.getProvider(), step.getStepIdx(), String.class));
114114

115+
if (type == BARCODE_TYPE.hashing && ret.methods.isEmpty())
116+
{
117+
throw new IllegalArgumentException("Must provide at least one calling method");
118+
}
119+
115120
return ret;
116121
}
117122

@@ -127,10 +132,15 @@ public static CellHashingParameters createFromJson(BARCODE_TYPE type, File webse
127132
ret.htoOrCiteseqBarcodesFile = htoOrCiteseqBarcodesFile == null ? new File(webserverDir, type.getAllBarcodeFileName()) : htoOrCiteseqBarcodesFile;
128133
ret.methods = extractMethods(params.optString("methods"));
129134

135+
if (type == BARCODE_TYPE.hashing && ret.methods.isEmpty())
136+
{
137+
throw new IllegalArgumentException("Must provide at least one calling method");
138+
}
139+
130140
return ret;
131141
}
132142

133-
public static List<CALLING_METHOD> extractMethods(String methodsStr) throws PipelineJobException
143+
private static @NotNull List<CALLING_METHOD> extractMethods(String methodsStr) throws PipelineJobException
134144
{
135145
if (methodsStr != null)
136146
{
@@ -158,7 +168,7 @@ public static List<CALLING_METHOD> extractMethods(String methodsStr) throws Pipe
158168
}
159169
}
160170

161-
return null;
171+
return Collections.emptyList();
162172
}
163173

164174
public int getEffectiveReadsetId()

singlecell/api-src/org/labkey/api/singlecell/pipeline/AbstractSingleCellPipelineStep.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ public Output execute(SequenceOutputHandler.JobContext ctx, List<SeuratObjectWra
4040
SingleCellOutput output = new SingleCellOutput();
4141

4242
File rmd = createRmd(output, ctx, inputObjects, outputPrefix);
43-
executeR(ctx, rmd, outputPrefix);
43+
if (hasCompleted())
44+
{
45+
ctx.getLogger().info("Step has already completed, skipping R");
46+
}
47+
else
48+
{
49+
executeR(ctx, rmd, outputPrefix);
50+
}
4451

4552
ctx.getFileManager().addIntermediateFile(rmd);
4653

@@ -207,6 +214,11 @@ public List<String> getDefaultHeader()
207214
}
208215
}
209216

217+
protected boolean hasCompleted()
218+
{
219+
return false;
220+
}
221+
210222
protected void executeR(SequenceOutputHandler.JobContext ctx, File rmd, String outputPrefix) throws PipelineJobException
211223
{
212224
List<String> lines = new ArrayList<>();

0 commit comments

Comments
 (0)