Skip to content

Commit a2cc248

Browse files
committed
Allow R params to be skipped
1 parent 83db461 commit a2cc248

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,11 @@ protected Chunk createParamChunk(List<SeuratObjectWrapper> inputObjects, String
337337
{
338338
if (pd instanceof SeuratToolParameter)
339339
{
340-
body.add(((SeuratToolParameter) pd).getVariableName() + " <- " + prepareValueForR((SeuratToolParameter)pd));
340+
SeuratToolParameter stp = (SeuratToolParameter)pd;
341+
if (stp.shouldIncludeInMarkdown(getPipelineCtx().getJob(), getProvider(), getStepIdx()))
342+
{
343+
body.add(((SeuratToolParameter) pd).getVariableName() + " <- " + prepareValueForR(stp));
344+
}
341345
}
342346
}
343347
body.add("");
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
11
package org.labkey.api.singlecell.pipeline;
22

3+
import org.apache.commons.lang3.StringUtils;
34
import org.jetbrains.annotations.Nullable;
45
import org.json.JSONObject;
6+
import org.labkey.api.pipeline.PipelineJob;
7+
import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider;
58
import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor;
69

710
public class SeuratToolParameter extends ToolParameterDescriptor
811
{
912
private String _rName;
13+
private boolean _includeIfEmptyOrNull;
1014

11-
public SeuratToolParameter(String name, String label, String description, String fieldXtype, @Nullable Object defaultValue, @Nullable JSONObject additionalExtConfig, String rName)
15+
public SeuratToolParameter(String name, String label, String description, String fieldXtype, @Nullable Object defaultValue, @Nullable JSONObject additionalExtConfig, String rName, boolean includeIfEmptyOrNull)
1216
{
1317
super(null, name, label, description, fieldXtype, defaultValue, additionalExtConfig);
1418

1519
_rName = rName;
20+
_includeIfEmptyOrNull = includeIfEmptyOrNull;
1621
}
1722

1823
public static SeuratToolParameter create(String name, String label, String description, String fieldXtype, @Nullable JSONObject additionalExtConfig, @Nullable Object defaultValue)
1924
{
20-
return new SeuratToolParameter(name, label, description, fieldXtype, defaultValue, additionalExtConfig, null);
25+
return new SeuratToolParameter(name, label, description, fieldXtype, defaultValue, additionalExtConfig, null, true);
2126
}
2227

23-
public static SeuratToolParameter create(String name, String label, String description, String fieldXtype, @Nullable JSONObject additionalExtConfig, @Nullable Object defaultValue, String rName)
28+
public static SeuratToolParameter create(String name, String label, String description, String fieldXtype, @Nullable JSONObject additionalExtConfig, @Nullable Object defaultValue, String rName, boolean includeIfEmptyOrNull)
2429
{
25-
return new SeuratToolParameter(name, label, description, fieldXtype, defaultValue, additionalExtConfig, rName);
30+
return new SeuratToolParameter(name, label, description, fieldXtype, defaultValue, additionalExtConfig, rName, includeIfEmptyOrNull);
2631
}
2732

2833
public String getVariableName()
2934
{
3035
return _rName == null ? getName() : _rName;
3136
}
37+
38+
public boolean shouldIncludeInMarkdown(PipelineJob job, PipelineStepProvider provider, int stepIdx)
39+
{
40+
if (!_includeIfEmptyOrNull)
41+
{
42+
return StringUtils.trimToNull(extractValue(job, provider, stepIdx)) != null;
43+
}
44+
45+
return true;
46+
}
3247
}

singlecell/src/org/labkey/singlecell/pipeline/singlecell/FilterRawCounts.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ public Provider()
2222
super("FilterRawCounts", "Filter Raw Counts", "Seurat/OOSAP", "This will use OOSAP/Seurat to perform basic filtering on cells based on UMI count, feature count, etc.", Arrays.asList(
2323
SeuratToolParameter.create("nCountRnaLow", "Min UMI Count", "Cells with UMI counts below this value will be discarded", "ldk-integerfield", new JSONObject(){{
2424
put("minValue", 0);
25-
}}, 0, "nCount_RNA.low"),
25+
}}, 0, "nCount_RNA.low", false),
2626
SeuratToolParameter.create("nCountRnaHigh", "Max UMI Count", "Cells with UMI counts above this value will be discarded", "ldk-integerfield", new JSONObject(){{
2727
put("minValue", 0);
28-
}}, 20000, "nCount_RNA.high"),
28+
}}, 20000, "nCount_RNA.high", false),
2929
SeuratToolParameter.create("nCountFeatureLow", "Min Feature Count", "Cells with unique feature totals below this value will be discarded", "ldk-integerfield", new JSONObject(){{
3030
put("minValue", 0);
31-
}}, 200, "nFeature.low"),
31+
}}, 200, "nFeature.low", false),
3232
SeuratToolParameter.create("nCountFeatureHigh", "Max Feature Count", "Cells with unique feature totals above this value will be discarded", "ldk-integerfield", new JSONObject(){{
3333
put("minValue", 0);
34-
}}, 5000, "nFeature.high"),
34+
}}, 5000, "nFeature.high", false),
3535
SeuratToolParameter.create("pMitoLow", "Min Percent Mito", "Cells percent mitochondrial genes below this value will be discarded", "ldk-numberfield", new JSONObject(){{
3636
put("minValue", 0);
3737
put("maxValue", 1);
38-
}}, 0, "pMito.low"),
38+
}}, 0, "pMito.low", false),
3939
SeuratToolParameter.create("pMitoHigh", "Max Percent Mito", "Cells percent mitochondrial genes above this value will be discarded", "ldk-numberfield", new JSONObject(){{
4040
put("minValue", 0);
4141
put("maxValue", 1);
42-
}}, 0.15, "pMito.high")
42+
}}, 0.15, "pMito.high", false)
4343
), null, null);
4444
}
4545

0 commit comments

Comments
 (0)