Skip to content

Commit a7afd88

Browse files
committed
Separate CITE-seq dist() and PCA reduction steps
1 parent a415993 commit a7afd88

File tree

6 files changed

+79
-4
lines changed

6 files changed

+79
-4
lines changed

singlecell/resources/chunks/CiteSeqDimRedux.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ for (datasetId in names(seuratObjects)) {
22
seuratObj <- seuratObjects[[datasetId]]
33
seuratObjects[[datasetId]] <- NULL
44

5-
#TODO: what if not used?
6-
seuratObj <- bindArgs(CellMembrane::CiteSeqDimRedux, seuratObj)()
5+
if (!(assayName %in% names(seuratObj@assays))) {
6+
print('ADT assay not present, skipping')
7+
} else {
8+
tryCatch({
9+
seuratObj <- bindArgs(CellMembrane::CiteSeqDimRedux, seuratObj)()
10+
}, error = function(e){
11+
conditionMessage(e)
12+
print(paste0('Error running CiteSeqDimRedux'))
13+
print(conditionMessage(e))
14+
traceback()
15+
})
16+
}
717

818
newSeuratObjects[[datasetId]] <- seuratObj
919

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
for (datasetId in names(seuratObjects)) {
2+
seuratObj <- seuratObjects[[datasetId]]
3+
seuratObjects[[datasetId]] <- NULL
4+
5+
if (!(assayName %in% names(seuratObj@assays))) {
6+
print('ADT assay not present, skipping')
7+
} else {
8+
seuratObj <- bindArgs(CellMembrane::RunAdtPca, seuratObj)()
9+
}
10+
11+
newSeuratObjects[[datasetId]] <- seuratObj
12+
13+
# Cleanup
14+
rm(seuratObj)
15+
gc()
16+
}

singlecell/resources/chunks/CiteSeqWnn.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
seuratObj <- seuratObjects[[datasetId]]
33
seuratObjects[[datasetId]] <- NULL
44

5-
seuratObj <- CellMembrane::RunSeuratWnn(seuratObj)
5+
if (!(assayName %in% names(seuratObj@assays))) {
6+
print('ADT assay not present, skipping')
7+
} else {
8+
seuratObj <- bindArgs(CellMembrane::RunSeuratWnn, seuratObj)()
9+
}
610

711
newSeuratObjects[[datasetId]] <- seuratObj
812

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
import org.labkey.singlecell.pipeline.singlecell.AppendCiteSeq;
3939
import org.labkey.singlecell.pipeline.singlecell.AvgExpression;
4040
import org.labkey.singlecell.pipeline.singlecell.CiteSeqDimRedux;
41+
import org.labkey.singlecell.pipeline.singlecell.CiteSeqPca;
4142
import org.labkey.singlecell.pipeline.singlecell.CiteSeqWnn;
43+
import org.labkey.singlecell.pipeline.singlecell.DimPlots;
4244
import org.labkey.singlecell.pipeline.singlecell.DoubletFinder;
4345
import org.labkey.singlecell.pipeline.singlecell.Downsample;
4446
import org.labkey.singlecell.pipeline.singlecell.FilterRawCounts;
@@ -169,6 +171,8 @@ public static void registerPipelineSteps()
169171
SequencePipelineService.get().registerPipelineStep(new CiteSeqDimRedux.Provider());
170172
SequencePipelineService.get().registerPipelineStep(new CiteSeqWnn.Provider());
171173
SequencePipelineService.get().registerPipelineStep(new AvgExpression.Provider());
174+
SequencePipelineService.get().registerPipelineStep(new DimPlots.Provider());
175+
SequencePipelineService.get().registerPipelineStep(new CiteSeqPca.Provider());
172176
}
173177

174178
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
1919
{
2020
public Provider()
2121
{
22-
super("CiteSeqDimRedux", "CiteSeq DimRedux", "CellMembrane/Seurat", "This will run DimRedux steps on the ADT data.", Arrays.asList(
22+
super("CiteSeqDimRedux", "CiteSeq DimRedux (distance)", "CellMembrane/Seurat", "This will run DimRedux steps on the ADT data.", Arrays.asList(
2323
SeuratToolParameter.create("performClrNormalization", "Perform CLR Normalization", "If true, Seurat CLR normalization will be performed. Otherwise any pre-existing normalization is used.", "checkbox", new JSONObject(){{
2424
put("checked", true);
2525
}}, true, "performClrNormalization", true)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 CiteSeqPca extends AbstractCellMembraneStep
12+
{
13+
public CiteSeqPca(PipelineContext ctx, CiteSeqPca.Provider provider)
14+
{
15+
super(provider, ctx);
16+
}
17+
18+
public static class Provider extends AbstractPipelineStepProvider<SingleCellStep>
19+
{
20+
public Provider()
21+
{
22+
super("CiteSeqPca", "CiteSeq/ADT PCA", "CellMembrane/Seurat", "This will run PCA on the ADT data.", Arrays.asList(
23+
SeuratToolParameter.create("performClrNormalization", "Perform CLR Normalization", "If true, Seurat CLR normalization will be performed. Otherwise any pre-existing normalization is used.", "checkbox", new JSONObject(){{
24+
put("checked", true);
25+
}}, true, "performClrNormalization", true)
26+
), null, null);
27+
}
28+
29+
@Override
30+
public CiteSeqPca create(PipelineContext ctx)
31+
{
32+
return new CiteSeqPca(ctx, this);
33+
}
34+
}
35+
36+
@Override
37+
public String getFileSuffix()
38+
{
39+
return "cite-pca";
40+
}
41+
}

0 commit comments

Comments
 (0)