Skip to content

Commit

Permalink
Support Rdiscvr SummarizeTCellActivation
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Feb 5, 2024
1 parent 262b703 commit 8b408f7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
21 changes: 21 additions & 0 deletions singlecell/resources/chunks/SummarizeTCellActivation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
if (!file.exists('/homeDir/.netrc')) {
print(list.files('/homeDir'))
stop('Unable to find file: /homeDir/.netrc')
}

invisible(Rlabkey::labkey.setCurlOptions(NETRC_FILE = '/homeDir/.netrc'))
Rdiscvr::SetLabKeyDefaults(baseUrl = serverBaseUrl, defaultFolder = defaultLabKeyFolder)

for (datasetId in names(seuratObjects)) {
printName(datasetId)
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])

outFile <- paste0(outputPrefix, '.', makeLegalFileName(datasetId), '.activation.txt')
seuratObj <- Rdiscvr::SummarizeTNK_Activation(seuratObj, outFile = outFile, xFacetField = xFacetField, groupingFields = groupingFields, activationFieldName = activationFieldName, threshold = threshold)

saveData(seuratObj, datasetId)

# Cleanup
rm(seuratObj)
gc()
}
1 change: 1 addition & 0 deletions singlecell/src/org/labkey/singlecell/SingleCellModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public static void registerPipelineSteps()
SequencePipelineService.get().registerPipelineStep(new RunSDA.Provider());
SequencePipelineService.get().registerPipelineStep(new RunLDA.Provider());
SequencePipelineService.get().registerPipelineStep(new FilterDisallowedClasses.Provider());
SequencePipelineService.get().registerPipelineStep(new SummarizeTCellActivation.Provider());

SequenceAnalysisService.get().registerReadsetListener(new SingleCellReadsetListener());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.labkey.singlecell.pipeline.singlecell;

import org.json.JSONObject;
import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider;
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
import org.labkey.api.singlecell.pipeline.SeuratToolParameter;
import org.labkey.api.singlecell.pipeline.SingleCellStep;

import java.util.Arrays;

public class SummarizeTCellActivation extends AbstractRDiscvrStep
{
public SummarizeTCellActivation(PipelineContext ctx, SummarizeTCellActivation.Provider provider)
{
super(provider, ctx);
}

public static class Provider extends AbstractPipelineStepProvider<SingleCellStep>
{
public Provider()
{
super("SummarizeTCellActivation", "Summarize TCell Activation", "RDiscvr", "This uses Rdiscvr::SummarizeTCellActivation to summarize cells with activation above a threshold.", Arrays.asList(
SeuratToolParameter.create("groupingFields", "Grouping Field(s)", "The fields used to group cells.", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
put("allowBlank", false);
put("height", 200);
put("delimiter", ",");
put("stripCharsRe", "/['\"]/g");
}}, "SampleDate,Stim,Population,AssayType").delimiter(","),
SeuratToolParameter.create("threshold", "Threshold", "Cells with a score greater than or equal to this are considered activated", "ldk-numberfield", new JSONObject(){{
put("allowBlank", false);
put("minValue", 0);
put("maxValue", 1);
put("decimalPrecision", 2);
}}, 0.5),
SeuratToolParameter.create("xFacetField", "X Facet Field", "A field used to facet the resulting plot", "textfield", new JSONObject(){{
put("allowBlank", false);
}}, "Population"),
SeuratToolParameter.create("activationFieldName", "Activation Field Name", "The name of the field holding the score used to activation thresholding", "textfield", new JSONObject(){{
put("allowBlank", false);
}}, "TandNK_Activation_UCell")
), null, null);
}

@Override
public SummarizeTCellActivation create(PipelineContext ctx)
{
return new SummarizeTCellActivation(ctx, this);
}
}

@Override
public String getFileSuffix()
{
return "activation";
}
}

0 comments on commit 8b408f7

Please sign in to comment.