Skip to content

Commit 9f9ba2d

Browse files
committed
Expand UpdateSeuratPrototype
1 parent 2a00a36 commit 9f9ba2d

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

singlecell/resources/chunks/CalculateTcrRepertoireStats.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Rdiscvr::SetLabKeyDefaults(baseUrl = serverBaseUrl, defaultFolder = defaultLabKe
1010
for (datasetId in names(seuratObjects)) {
1111
printName(datasetId)
1212
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
13-
df <- Rdiscvr::CalculateAndStoreTcrRepertoireStats(seuratObj)
13+
14+
outputFile <- gsub(seuratObjects[[datasetId]], pattern = '.rds', replacement = '.tcrStats.txt')
15+
df <- Rdiscvr::CalculateAndStoreTcrRepertoireStats(seuratObj, outputFile = outputFile)
1416

1517
# Cleanup
1618
rm(seuratObj)

singlecell/resources/chunks/UpdateSeuratPrototype.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ if (!file.exists(netRc)) {
77
invisible(Rlabkey::labkey.setCurlOptions(NETRC_FILE = netRc))
88
Rdiscvr::SetLabKeyDefaults(baseUrl = serverBaseUrl, defaultFolder = defaultLabKeyFolder)
99

10+
if (Sys.getenv('SEURAT_MAX_THREADS') != '') {
11+
nCores <- Sys.getenv('SEURAT_MAX_THREADS')
12+
} else {
13+
nCores <- 1
14+
}
15+
1016
for (datasetId in names(seuratObjects)) {
1117
printName(datasetId)
1218
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
@@ -34,6 +40,20 @@ for (datasetId in names(seuratObjects)) {
3440
seuratObj <- Rdiscvr::ClassifyTNKByExpression(seuratObj)
3541
}
3642

43+
if (saveRepertoireStats) {
44+
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
45+
outputFile <- gsub(seuratObjects[[datasetId]], pattern = '.rds', replacement = '.tcrStats.txt')
46+
df <- Rdiscvr::CalculateAndStoreTcrRepertoireStats(seuratObj, outputFile = outFile)
47+
}
48+
49+
if (scoreActivation) {
50+
seuratObj <- RIRA::PredictTcellActivation(seuratObj)
51+
}
52+
53+
if (recalculateUCells) {
54+
seuratObj <- RIRA::CalculateUCellScores(seuratObj, storeRanks = FALSE, assayName = 'RNA', forceRecalculate = TRUE, ncores = nCores)
55+
}
56+
3757
saveData(seuratObj, datasetId)
3858

3959
# Cleanup

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ public Provider()
4949
{{
5050
put("checked", false);
5151
}}, false),
52+
SeuratToolParameter.create("recalculateUCells", "Recalculate UCells", "If checked, RIRA::CalculateUCellScores will be re-run", "checkbox", new JSONObject()
53+
{{
54+
put("checked", true);
55+
}}, true),
56+
SeuratToolParameter.create("saveRepertoireStats", "Save TCR Repertoire Stats", "If checked, Rdiscvr::CalculateAndStoreTcrRepertoireStats will be run", "checkbox", new JSONObject()
57+
{{
58+
put("checked", true);
59+
}}, true),
60+
SeuratToolParameter.create("scoreActivation", "Score T Cell Activation", "If checked, RIRA::PredictTcellActivation will be run", "checkbox", new JSONObject()
61+
{{
62+
put("checked", true);
63+
}}, true),
5264
SeuratToolParameter.create("keepOriginal", "Keep Copy of Original File", "If checked, the original file will be copied with the file extension '.bk'", "checkbox", new JSONObject()
5365
{{
5466
put("checked", false);

0 commit comments

Comments
 (0)