Skip to content

Commit

Permalink
Allow nimble append to support queryDatabaseForLineageUpdates
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Jan 23, 2025
1 parent 5a5740f commit 22034c2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
5 changes: 3 additions & 2 deletions singlecell/resources/chunks/AppendNimble.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ for (datasetId in names(seuratObjects)) {
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])

for (genomeId in names(nimbleGenomes)) {
maxAmbiguityAllowed <- !nimbleGenomeAmbiguousPreference[[genomeId]]
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, maxAmbiguityAllowed = maxAmbiguityAllowed, maxLibrarySizeRatio = maxLibrarySizeRatio)
maxAmbiguityAllowed <- nimbleGenomeAmbiguousPreference[[genomeId]]
queryDatabaseForLineageUpdates <- queryDatabaseForLineageUpdatesPreference[[genomeId]]
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, maxAmbiguityAllowed = maxAmbiguityAllowed, maxLibrarySizeRatio = maxLibrarySizeRatio, queryDatabaseForLineageUpdates = queryDatabaseForLineageUpdates)
}

saveData(seuratObj, datasetId)
Expand Down
16 changes: 13 additions & 3 deletions singlecell/resources/web/singlecell/panel/NimbleAppendPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
},LABKEY.ext4.GRIDBUTTONS.DELETERECORD()],
store: {
type: 'array',
fields: ['genomeId', 'targetAssay','maxAmbiguityAllowed']
fields: ['genomeId', 'targetAssay','maxAmbiguityAllowed', 'queryDatabaseForLineageUpdates']
},
columns: [{
dataIndex: 'genomeId',
Expand Down Expand Up @@ -77,6 +77,15 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
allowBlank: true,
minValue: 0
}
},{
dataIndex: 'queryDatabaseForLineageUpdates',
width: 175,
header: 'Check for Lineage Updates',
editor: {
xtype: 'checkbox',
allowBlank: true,
value: false
}
}]
}]
});
Expand All @@ -87,7 +96,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
getValue: function(){
var ret = [];
this.down('ldk-gridpanel').store.each(function(r, i) {
ret.push([r.data.genomeId, r.data.targetAssay, r.data.maxAmbiguityAllowed ?? '']);
ret.push([r.data.genomeId, r.data.targetAssay, r.data.maxAmbiguityAllowed ?? '', !!r.data.queryDatabaseForLineageUpdates]);
}, this);

return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
Expand Down Expand Up @@ -123,7 +132,8 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
var rec = grid.store.createModel({
genomeId: row[0],
targetAssay: row[1],
maxAmbiguityAllowed: row[2]
maxAmbiguityAllowed: row[2],
queryDatabaseForLineageUpdates: !!row[3]
});
grid.store.add(rec);
}, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
for (int i = 0; i < json.length(); i++)
{
JSONArray arr = json.getJSONArray(i);
if (arr.length() != 3)
if (arr.length() < 3)
{
throw new PipelineJobException("Unexpected value: " + json.getString(i));
}
Expand All @@ -113,6 +113,25 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
}
ret.bodyLines.add(")");

ret.bodyLines.add("queryDatabaseForLineageUpdatesPreference <- list(");
delim = "";
for (int i = 0; i < json.length(); i++)
{
JSONArray arr = json.getJSONArray(i);
if (arr.length() != 4)
{
throw new PipelineJobException("Unexpected value: " + json.getString(i));
}

int genomeId = arr.getInt(0);
String valStr = arr.get(2) == null ? null : StringUtils.trimToNull(String.valueOf(arr.get(2)));
boolean val = Boolean.parseBoolean(valStr);

ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (val ? "TRUE" : "FALSE"));
delim = ",";
}
ret.bodyLines.add(")");

return ret;
}

Expand Down

0 comments on commit 22034c2

Please sign in to comment.