Skip to content

Commit 617b14e

Browse files
committed
Support new RIRA RunScGateWithRhesusModels function
1 parent c906c3c commit 617b14e

File tree

5 files changed

+61
-4
lines changed

5 files changed

+61
-4
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
for (datasetId in names(seuratObjects)) {
2+
printName(datasetId)
3+
seuratObj <- readRDS(seuratObjects[[datasetId]])
4+
5+
for (assayName in assayNames) {
6+
if (assayName %in% names(seuratObj@assays)) {
7+
seuratObj@assays[[assayName]] <- NULL
8+
} else {
9+
print(paste0('Assay not found, skipping: ', assayName))
10+
}
11+
}
12+
13+
saveData(seuratObj, datasetId)
14+
}

singlecell/resources/chunks/RunScGate.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ for (datasetId in names(seuratObjects)) {
22
printName(datasetId)
33
seuratObj <- readRDS(seuratObjects[[datasetId]])
44

5-
seuratObj <- RIRA::RunScGateForModels(seuratObj, modelNames = modelNames, labelRename = list(Tcell = 'T_NK', NK = 'T_NK'), dropAmbiguousConsensusValues = dropAmbiguousConsensusValues, consensusModels = consensusModels)
5+
if (useRhesusDefaults) {
6+
seuratObj <- RIRA::RunScGateWithRhesusModels(seuratObj, dropAmbiguousConsensusValues = dropAmbiguousConsensusValues)
7+
} else {
8+
seuratObj <- RIRA::RunScGateForModels(seuratObj, modelNames = modelNames, labelRename = list(Tcell = 'T_NK', NK = 'T_NK'), dropAmbiguousConsensusValues = dropAmbiguousConsensusValues, consensusModels = consensusModels)
9+
}
610

711
saveData(seuratObj, datasetId)
812
}

singlecell/src/org/labkey/singlecell/SingleCellModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public static void registerPipelineSteps()
169169
SequencePipelineService.get().registerPipelineStep(new CiteSeqWnn.Provider());
170170
SequencePipelineService.get().registerPipelineStep(new AvgExpression.Provider());
171171
SequencePipelineService.get().registerPipelineStep(new DimPlots.Provider());
172+
SequencePipelineService.get().registerPipelineStep(new DropAssays.Provider());
172173
SequencePipelineService.get().registerPipelineStep(new FeaturePlots.Provider());
173174
SequencePipelineService.get().registerPipelineStep(new CiteSeqDimReduxPca.Provider());
174175
SequencePipelineService.get().registerPipelineStep(new CiteSeqPlots.Provider());
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.labkey.singlecell.pipeline.singlecell;
2+
3+
import org.json.JSONObject;
4+
import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider;
5+
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
6+
import org.labkey.api.singlecell.pipeline.SeuratToolParameter;
7+
import org.labkey.api.singlecell.pipeline.SingleCellStep;
8+
9+
import java.util.Arrays;
10+
11+
public class DropAssays extends AbstractRiraStep
12+
{
13+
public DropAssays(PipelineContext ctx, DropAssays.Provider provider)
14+
{
15+
super(provider, ctx);
16+
}
17+
18+
public static class Provider extends AbstractPipelineStepProvider<SingleCellStep>
19+
{
20+
public Provider()
21+
{
22+
super("DropAssays", "Assay(s) to Drop", "Seurat", "This will drop the selected assays from your Seurat object(s)", Arrays.asList(
23+
SeuratToolParameter.create("assayNames", "Assay(s)", "The names of assays to drop, such as: RNA.orig, ADT, or RNA", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
24+
put("allowBlank", false);
25+
put("height", 150);
26+
put("delimiter", ",");
27+
}}, null).delimiter(",")
28+
), Arrays.asList("/sequenceanalysis/field/TrimmingTextArea.js"), null);
29+
}
30+
31+
@Override
32+
public DropAssays create(PipelineContext ctx)
33+
{
34+
return new DropAssays(ctx, this);
35+
}
36+
}
37+
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
2020
public Provider()
2121
{
2222
super("RunScGate", "Run scGate", "scGate", "This will run scGate with the default built-in models and create a consensus call.", Arrays.asList(
23+
SeuratToolParameter.create("useRhesusDefaults", "Use Rhesus Default", "If checked, this will use the rhesus defaults, RIRA::RunScGateWithRhesusModels, and ignore the selections below", "checkbox", new JSONObject(){{
24+
put("checked", true);
25+
}}, true),
2326
SeuratToolParameter.create("modelNames", "Model(s)", "The set of scGate modules to test.", "ldk-simplecombo", new JSONObject()
2427
{{
2528
put("multiSelect", true);
26-
put("allowBlank", false);
2729
put("storeValues", "Bcell;Tcell;NK;Myeloid;Stromal;pDC;Erythrocyte;Epithelial;Platelet_MK");
2830
put("initialValues", "Bcell;Tcell;NK;Myeloid;Stromal;pDC;Epithelial;Epithelial;Platelet_MK");
2931
put("delimiter", ";");
@@ -32,7 +34,6 @@ public Provider()
3234
SeuratToolParameter.create("consensusModels", "Models for Consensus", "The subset of models to be considered for the consensus call.", "ldk-simplecombo", new JSONObject()
3335
{{
3436
put("multiSelect", true);
35-
put("allowBlank", false);
3637
put("storeValues", "Bcell;Tcell;NK;Myeloid;Stromal;pDC;Erythrocyte;Epithelial;Platelet_MK");
3738
put("initialValues", "Bcell;Tcell;NK;Myeloid;Stromal;pDC;Epithelial");
3839
put("delimiter", ";");
@@ -41,7 +42,7 @@ public Provider()
4142
SeuratToolParameter.create("dropAmbiguousConsensusValues", "Drop Ambiguous Consensus Values", "If checked, any consensus calls that are ambiguous will be set to NA", "checkbox", new JSONObject(){{
4243
put("checked", true);
4344
}}, true)
44-
), null, null);
45+
), null, null);
4546
}
4647

4748
@Override

0 commit comments

Comments
 (0)