Skip to content

Commit 419a18c

Browse files
committed
More granular control over NimbleAppend
1 parent 1222185 commit 419a18c

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

singlecell/resources/chunks/AppendNimble.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ for (datasetId in names(seuratObjects)) {
1616
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
1717

1818
for (genomeId in names(nimbleGenomes)) {
19-
retainAmbiguousFeatures <- !nimbleGenomeAmbiguousPreference[[genomeId]]
20-
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, dropAmbiguousFeatures = !retainAmbiguousFeatures, maxLibrarySizeRatio = maxLibrarySizeRatio)
19+
maxAmbiguityAllowed <- !nimbleGenomeAmbiguousPreference[[genomeId]]
20+
seuratObj <- Rdiscvr::DownloadAndAppendNimble(seuratObject = seuratObj, allowableGenomes = genomeId, ensureSamplesShareAllGenomes = ensureSamplesShareAllGenomes, targetAssayName = nimbleGenomes[[genomeId]], enforceUniqueFeatureNames = TRUE, maxAmbiguityAllowed = maxAmbiguityAllowed, maxLibrarySizeRatio = maxLibrarySizeRatio)
2121
}
2222

2323
saveData(seuratObj, datasetId)

singlecell/resources/web/singlecell/panel/NimbleAppendPanel.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
4040
},LABKEY.ext4.GRIDBUTTONS.DELETERECORD()],
4141
store: {
4242
type: 'array',
43-
fields: ['genomeId', 'targetAssay','retainAmbiguousFeatures']
43+
fields: ['genomeId', 'targetAssay','maxAmbiguityAllowed']
4444
},
4545
columns: [{
4646
dataIndex: 'genomeId',
@@ -69,12 +69,13 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
6969
allowBlank: false
7070
}
7171
},{
72-
dataIndex: 'retainAmbiguousFeatures',
72+
dataIndex: 'maxAmbiguityAllowed',
7373
width: 175,
74-
header: 'Retain Ambiguous Features?',
74+
header: 'Max Ambiguity Allowed',
7575
editor: {
76-
xtype: 'checkbox',
77-
allowBlank: false
76+
xtype: 'ldk-integerfield',
77+
allowBlank: true,
78+
minValue: 0
7879
}
7980
}]
8081
}]
@@ -86,7 +87,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
8687
getValue: function(){
8788
var ret = [];
8889
this.down('ldk-gridpanel').store.each(function(r, i) {
89-
ret.push([r.data.genomeId, r.data.targetAssay, !!r.data.retainAmbiguousFeatures]);
90+
ret.push([r.data.genomeId, r.data.targetAssay, r.data.maxAmbiguityAllowed ?? '']);
9091
}, this);
9192

9293
return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
@@ -122,7 +123,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
122123
var rec = grid.store.createModel({
123124
genomeId: row[0],
124125
targetAssay: row[1],
125-
retainAmbiguousFeatures: !!row[2]
126+
maxAmbiguityAllowed: row[2]
126127
});
127128
grid.store.add(rec);
128129
}, this);

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public Provider()
3232
{{
3333
put("allowBlank", false);
3434
}}, null),
35+
SeuratToolParameter.create("maxAmbiguityAllowed", "Max Ambiguity Allowed", "If provided, ambiguous features with more than this number of values will be discarded (e.g. if maxAmbiguityAllowed=2, then the feature Feat1,Feat2,Feat3 would be discared, but not Feat1,Feat3. This can be overridden per genome.", "ldk-integerfield", new JSONObject()
36+
{{
37+
put("minValue", 0);
38+
}}, 0, null, true),
3539
SeuratToolParameter.create("ensureSamplesShareAllGenomes", "Ensure Samples Share All Genomes", "If checked, the job will fail unless nimble data is found for each requested genome for all samples", "checkbox", new JSONObject()
3640
{{
3741
put("check", true);
@@ -84,6 +88,8 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
8488
}
8589
ret.bodyLines.add(")");
8690

91+
Integer maxAmbiguityAllowed = getProvider().getParameterByName("maxAmbiguityAllowed").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
92+
8793
ret.bodyLines.add("nimbleGenomeAmbiguousPreference <- list(");
8894
delim = "";
8995
for (int i = 0; i < json.length(); i++)
@@ -95,8 +101,13 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
95101
}
96102

97103
int genomeId = arr.getInt(0);
98-
boolean retainAmbiguousFeatures = arr.getBoolean(2);
99-
ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (retainAmbiguousFeatures ? "TRUE" : "FALSE"));
104+
Integer maxAmbiguityAllowed2 = arr.get(2) == null ? null : arr.getInt(2);
105+
if (maxAmbiguityAllowed2 == null)
106+
{
107+
maxAmbiguityAllowed2 = maxAmbiguityAllowed;
108+
}
109+
110+
ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (maxAmbiguityAllowed2 == null ? "Inf" : maxAmbiguityAllowed2));
100111
delim = ",";
101112
}
102113
ret.bodyLines.add(")");

0 commit comments

Comments
 (0)