Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ public AbstractSingleCellPipelineStep(PipelineStepProvider<?> provider, Pipeline
super(provider, ctx);
}

private String getSavedSeuratFileName(String outputPrefix)
{
return outputPrefix + ".savedSeuratObjects.txt";
}

@Override
public Output execute(SequenceOutputHandler.JobContext ctx, List<SeuratObjectWrapper> inputObjects, String outputPrefix) throws PipelineJobException
{
SingleCellOutput output = new SingleCellOutput();

File tracker = new File(ctx.getOutputDir(), "savedSeuratObjects.txt");
File tracker = new File(ctx.getOutputDir(), getSavedSeuratFileName(outputPrefix));
if (tracker.exists())
{
ctx.getLogger().debug("deleting pre-existing file: " + tracker.getName());
Expand Down Expand Up @@ -481,6 +486,7 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
}
body.add("");
body.add("outputPrefix <- '" + outputPrefix + "'");
body.add("trackerFile <- '/work/" + getSavedSeuratFileName(outputPrefix) + "'");

//Read RDS:
body.add("");
Expand Down
2 changes: 1 addition & 1 deletion singlecell/resources/chunks/AvgExpression.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ GenerateAveragedData <- function(seuratObj, groupFields, addMetadata) {
}
}

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

if (addMetadata) {
a <- Rdiscvr::QueryAndApplyMetadataUsingCDNA(a)
Expand Down
2 changes: 1 addition & 1 deletion singlecell/resources/chunks/FindClustersAndDimRedux.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ for (datasetId in names(seuratObjects)) {
printName(datasetId)
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])

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

saveData(seuratObj, datasetId)

Expand Down
15 changes: 8 additions & 7 deletions singlecell/resources/chunks/Functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ printName <- function(datasetId) {
}

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

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

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

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

# Write cell barcodes and metadata:
metaDf <- seuratObj@meta.data
Expand Down
3 changes: 3 additions & 0 deletions singlecell/resources/views/singleCellDataManagement.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
},{
name: 'VLoupe Files Needing TCR Import',
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'})
},{
name: 'Stim Data Needing Activation Data',
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'})
},{
name: 'Loupe Files Missing Prototype',
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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Provider()
SeuratToolParameter.create("requireSaturation", "Require Per-Cell Saturation", "If this dataset uses TCR sequencing, these data are required", "checkbox", null, true),
SeuratToolParameter.create("requireSingleR", "Require SingleR", "If checked, SingleR calls, including singleRConsensus are required to pass", "checkbox", null, true),
SeuratToolParameter.create("requireScGate", "Require scGate", "If checked, scGateConsensus calls are required to pass", "checkbox", null, true),
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)
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)
), null, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public Provider()
SeuratToolParameter.create("minDimsToUse", "Min. PCs to Use", "The minimum number of PCs to use", "ldk-integerfield", new JSONObject()
{{
put("minValue", 0);
}}, 15)
}}, 15),
SeuratToolParameter.create("useLeiden", "Use Leiden Clustering", "If true, FindClusters() will use algorith=4 (leiden), as opposed to the default (louvain)", "checkbox", new JSONObject(){{

}}, false)
), null, null);
}

Expand Down