Skip to content

Commit 2457505

Browse files
authored
Merge pull request #276 from BimberLab/24.3_fb_merge
Merge discvr-23.11 to discvr-24.3
2 parents 6122014 + ecec74b commit 2457505

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
lines changed

singlecell/api-src/org/labkey/api/singlecell/pipeline/AbstractSingleCellPipelineStep.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ public AbstractSingleCellPipelineStep(PipelineStepProvider<?> provider, Pipeline
4343
super(provider, ctx);
4444
}
4545

46+
private String getSavedSeuratFileName(String outputPrefix)
47+
{
48+
return outputPrefix + ".savedSeuratObjects.txt";
49+
}
50+
4651
@Override
4752
public Output execute(SequenceOutputHandler.JobContext ctx, List<SeuratObjectWrapper> inputObjects, String outputPrefix) throws PipelineJobException
4853
{
4954
SingleCellOutput output = new SingleCellOutput();
5055

51-
File tracker = new File(ctx.getOutputDir(), "savedSeuratObjects.txt");
56+
File tracker = new File(ctx.getOutputDir(), getSavedSeuratFileName(outputPrefix));
5257
if (tracker.exists())
5358
{
5459
ctx.getLogger().debug("deleting pre-existing file: " + tracker.getName());
@@ -481,6 +486,7 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
481486
}
482487
body.add("");
483488
body.add("outputPrefix <- '" + outputPrefix + "'");
489+
body.add("trackerFile <- '/work/" + getSavedSeuratFileName(outputPrefix) + "'");
484490

485491
//Read RDS:
486492
body.add("");

singlecell/resources/chunks/AvgExpression.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ GenerateAveragedData <- function(seuratObj, groupFields, addMetadata) {
3232
}
3333
}
3434

35-
a <- CellMembrane::PseudobulkSeurat(seuratObj, groupFields = groupFields, assays = assayName, additionalFieldsToAggregate = additionalFieldsToAggregate, nCountRnaStratification = nCountRnaStratification)
35+
a <- CellMembrane::PseudobulkSeurat(seuratObj, groupFields = groupFields, assayToAggregate = assayName, additionalFieldsToAggregate = additionalFieldsToAggregate, nCountRnaStratification = nCountRnaStratification)
3636

3737
if (addMetadata) {
3838
a <- Rdiscvr::QueryAndApplyMetadataUsingCDNA(a)

singlecell/resources/chunks/FindClustersAndDimRedux.R

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

5-
seuratObj <- CellMembrane::FindClustersAndDimRedux(seuratObj, minDimsToUse = minDimsToUse)
5+
seuratObj <- CellMembrane::FindClustersAndDimRedux(seuratObj, minDimsToUse = minDimsToUse, useLeiden = useLeiden)
66

77
saveData(seuratObj, datasetId)
88

singlecell/resources/chunks/Functions.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ printName <- function(datasetId) {
6161
}
6262

6363
savedFiles <- data.frame(datasetId = character(), datasetName = character(), filename = character(), outputFileId = character(), readsetId = character())
64-
if (file.exists('/work/savedSeuratObjects.txt')) {
65-
print('Deleting pre-existing savedSeuratObjects.txt file')
66-
unlink('/work/savedSeuratObjects.txt')
64+
if (file.exists(trackerFile)) {
65+
print(paste0('Deleting pre-existing ', trackerFile, ' file'))
66+
unlink(trackerFile)
6767
}
6868

69-
file.create('/work/savedSeuratObjects.txt')
70-
print(paste0('Total lines in savedSeuratObjects.txt on job start:', length(readLines('savedSeuratObjects.txt'))))
69+
file.create(trackerFile)
70+
print(paste0('Total lines in ', trackerFile, ' on job start:', length(readLines(trackerFile))))
7171

7272
saveData <- function(seuratObj, datasetId) {
7373
message(paste0('Saving dataset: ', datasetId, ' with ', ncol(seuratObj), ' cells'))
@@ -101,8 +101,9 @@ saveData <- function(seuratObj, datasetId) {
101101
stop('Error saving seurat objects, more than one row!')
102102
}
103103

104-
write.table(toAppend, file = 'savedSeuratObjects.txt', quote = FALSE, sep = '\t', row.names = FALSE, col.names = FALSE, append = TRUE)
105-
print(paste0('Total lines in savedSeuratObjects.txt after save:', length(readLines('savedSeuratObjects.txt'))))
104+
print(paste0('Total lines in ', trackerFile, ' before save:', length(readLines(trackerFile))))
105+
write.table(toAppend, file = trackerFile, quote = FALSE, sep = '\t', row.names = FALSE, col.names = FALSE, append = TRUE)
106+
print(paste0('Total lines in ', trackerFile, ' after save:', length(readLines(trackerFile))))
106107

107108
# Write cell barcodes and metadata:
108109
metaDf <- seuratObj@meta.data

singlecell/resources/views/singleCellDataManagement.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
},{
3737
name: 'VLoupe Files Needing TCR Import',
3838
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'outputfiles', 'query.readset/status~isblank': null, 'query.readset/numTcrResults~eq': 0, 'query.category~eq': '10x VLoupe', 'query.sort': 'readset/name'})
39+
},{
40+
name: 'Stim Data Needing Activation Data',
41+
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'outputfiles', 'query.readset/assaytypes~contains': 'stim', 'query.readset/numTcrResults~eq': 0, 'query.category~eq': 'Seurat Object Prototype', 'query.readset/outputFileTypes~doesnotcontain': 'TCell Activation', 'query.sort': 'readset/name'})
3942
},{
4043
name: 'Loupe Files Missing Prototype',
4144
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'outputfiles', 'query.category~eq': '10x Loupe File', 'query.readset/status~isblank': null, 'query.readset/cDNA/rowid~isnonblank': null, 'query.readset/outputFileTypes~doesnotcontain': 'Prototype', 'query.sort': 'readset/name', 'query.maxRows': 250})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public Provider()
3434
SeuratToolParameter.create("requireSaturation", "Require Per-Cell Saturation", "If this dataset uses TCR sequencing, these data are required", "checkbox", null, true),
3535
SeuratToolParameter.create("requireSingleR", "Require SingleR", "If checked, SingleR calls, including singleRConsensus are required to pass", "checkbox", null, true),
3636
SeuratToolParameter.create("requireScGate", "Require scGate", "If checked, scGateConsensus calls are required to pass", "checkbox", null, true),
37-
SeuratToolParameter.create("requireRiraImmune", "Require RIRA Immune V2", "If checked, RIRA_Immune_v2 calls (field RIRA_Immune_v2.cellclass) are required to pass", "checkbox", null, true)
37+
SeuratToolParameter.create("requireRiraImmune", "Require RIRA Immune V2", "If checked, RIRA_Immune_v2 calls (field RIRA_Immune_v2.cellclass) are required to pass", "checkbox", null, false)
3838
), null, null);
3939
}
4040

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ public Provider()
2424
SeuratToolParameter.create("minDimsToUse", "Min. PCs to Use", "The minimum number of PCs to use", "ldk-integerfield", new JSONObject()
2525
{{
2626
put("minValue", 0);
27-
}}, 15)
27+
}}, 15),
28+
SeuratToolParameter.create("useLeiden", "Use Leiden Clustering", "If true, FindClusters() will use algorith=4 (leiden), as opposed to the default (louvain)", "checkbox", new JSONObject(){{
2829

30+
}}, false)
2931
), null, null);
3032
}
3133

0 commit comments

Comments
 (0)