Skip to content

Commit fbe3efa

Browse files
committed
Add step for custom gene sets and ssGSEA
1 parent c4dc67c commit fbe3efa

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
for (datasetId in names(seuratObjects)) {
2+
printName(datasetId)
3+
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
4+
5+
toCalculate <- list()
6+
for (geneSet in geneSets) {
7+
vals <- unlist(strsplit(geneSet, split = ':'))
8+
if (length(vals) != 2) {
9+
stop(paste0('Improper gene set: ', geneSet))
10+
}
11+
12+
toCalculate[[vals[1]]] <- unlist(strsplit(vals[2], split = ','))
13+
}
14+
15+
seuratObj <- CellMembrane::RunEscape(seuratObj, customGeneSets = toCalculate, outputAssayName = outputAssayName, doPlot = TRUE, msigdbGeneSets = NULL)
16+
17+
saveData(seuratObj, datasetId)
18+
19+
# Cleanup
20+
rm(seuratObj)
21+
gc()
22+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public static void registerPipelineSteps()
228228
SequencePipelineService.get().registerPipelineStep(new PredictScTour.Provider());
229229
SequencePipelineService.get().registerPipelineStep(new RunEscape.Provider());
230230
SequencePipelineService.get().registerPipelineStep(new RunCsCore.Provider());
231+
SequencePipelineService.get().registerPipelineStep(new CustomGSEA.Provider());
231232

232233
SequenceAnalysisService.get().registerReadsetListener(new SingleCellReadsetListener());
233234
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
import java.util.List;
11+
12+
public class CustomGSEA extends AbstractCellMembraneStep
13+
{
14+
final static String DELIM = "<>";
15+
16+
public CustomGSEA(PipelineContext ctx, CustomGSEA.Provider provider)
17+
{
18+
super(provider, ctx);
19+
}
20+
21+
public static class Provider extends AbstractPipelineStepProvider<SingleCellStep>
22+
{
23+
public Provider()
24+
{
25+
super("CustomUCell", "ssGSEA (Custom)", "escape/ssGSEA", "The seurat object will be subset based on the expression below, which is passed directly to Seurat's subset(subset = X).", Arrays.asList(
26+
SeuratToolParameter.create("geneSets", "Gene Sets(s)", "This should contain one gene module per line, where the module is in the format (no spaces): SetName:Gene1,Gene2,Gene3. The first token is the name given to the score and the second is a comma-delimited list of gene names.", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
27+
put("allowBlank", false);
28+
put("replaceAllWhitespace", true);
29+
put("height", 150);
30+
put("width", 600);
31+
put("delimiter", DELIM);
32+
put("stripCharsRe", "/['\"]/g");
33+
}}, null).delimiter(DELIM),
34+
SeuratToolParameter.create("assayName", "Input Assay Name", "The assay holding the source data.", "textfield", new JSONObject(){{
35+
put("allowBlank", false);
36+
}}, "RNA"),
37+
SeuratToolParameter.create("outputAssayName", "Output Assay Name", "The assay to hold the resulting scores.", "textfield", new JSONObject(){{
38+
put("allowBlank", false);
39+
}}, "escape.ssGSEA")
40+
), List.of("/sequenceanalysis/field/TrimmingTextArea.js"), null);
41+
}
42+
43+
44+
@Override
45+
public CustomGSEA create(PipelineContext ctx)
46+
{
47+
return new CustomGSEA(ctx, this);
48+
}
49+
}
50+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
2323
{
2424
public Provider()
2525
{
26-
super("CustomUCell", "UCell (Custom)", "UCell/RIRA", "The seurat object will be subset based on the expression below, which is passed directly to Seurat's subset(subset = X).", Arrays.asList(
26+
super("CustomUCell", "UCell (Custom)", "UCell/RIRA", "UCell scores will be calculated, based on the custom gene list below", Arrays.asList(
2727
SeuratToolParameter.create("geneSets", "Gene Sets(s)", "This should contain one UCell module per line, where the module is in the format (no spaces): SetName:Gene1,Gene2,Gene3. The first token is the name given to UCell and the second is a comma-delimited list of gene names.", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
2828
put("allowBlank", false);
2929
put("replaceAllWhitespace", true);

0 commit comments

Comments
 (0)