Skip to content

Commit 1222185

Browse files
committed
Allow per-library setting for retaining ambiguous features
1 parent fb878fe commit 1222185

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

singlecell/resources/chunks/AppendNimble.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ invisible(Rlabkey::labkey.setCurlOptions(NETRC_FILE = '/homeDir/.netrc'))
77
Rdiscvr::SetLabKeyDefaults(baseUrl = serverBaseUrl, defaultFolder = defaultLabKeyFolder)
88

99
# NOTE: this file is created by DownloadAndAppendNimble if there was an error. It might exist if a job failed and then was restarted
10-
if (file.exists('debug.nimble.txt')) {
11-
unlink('debug.nimble.txt')
10+
if (file.exists('debug.nimble.txt.gz')) {
11+
unlink('debug.nimble.txt.gz')
1212
}
1313

1414
for (datasetId in names(seuratObjects)) {
1515
printName(datasetId)
1616
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
1717

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

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
1010
initComponent: function(){
1111
Ext4.apply(this, {
1212
style: 'padding: 10px;margins: 5px;',
13-
minWidth: 650,
13+
minWidth: 850,
1414
border: true,
1515
items: [{
1616
html: 'This step will query nimble results for the selected genome(s). It will then append these results to the seurat object on the target assay.',
@@ -20,7 +20,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
2020
},{
2121
xtype: 'ldk-gridpanel',
2222
clicksToEdit: 1,
23-
width: 600,
23+
width: 775,
2424
tbar: [{
2525
text: 'Add',
2626
handler: function(btn){
@@ -40,7 +40,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
4040
},LABKEY.ext4.GRIDBUTTONS.DELETERECORD()],
4141
store: {
4242
type: 'array',
43-
fields: ['genomeId', 'targetAssay']
43+
fields: ['genomeId', 'targetAssay','retainAmbiguousFeatures']
4444
},
4545
columns: [{
4646
dataIndex: 'genomeId',
@@ -68,6 +68,14 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
6868
xtype: 'textfield',
6969
allowBlank: false
7070
}
71+
},{
72+
dataIndex: 'retainAmbiguousFeatures',
73+
width: 175,
74+
header: 'Retain Ambiguous Features?',
75+
editor: {
76+
xtype: 'checkbox',
77+
allowBlank: false
78+
}
7179
}]
7280
}]
7381
});
@@ -78,7 +86,7 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
7886
getValue: function(){
7987
var ret = [];
8088
this.down('ldk-gridpanel').store.each(function(r, i) {
81-
ret.push([r.data.genomeId, r.data.targetAssay]);
89+
ret.push([r.data.genomeId, r.data.targetAssay, !!r.data.retainAmbiguousFeatures]);
8290
}, this);
8391

8492
return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
@@ -113,7 +121,8 @@ Ext4.define('SingleCell.panel.NimbleAppendPanel', {
113121
Ext4.Array.forEach(val, function(row){
114122
var rec = grid.store.createModel({
115123
genomeId: row[0],
116-
targetAssay: row[1]
124+
targetAssay: row[1],
125+
retainAmbiguousFeatures: !!row[2]
117126
});
118127
grid.store.add(rec);
119128
}, this);

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public Provider()
3232
{{
3333
put("allowBlank", false);
3434
}}, null),
35-
SeuratToolParameter.create("retainAmbiguousFeatures", "Retain Ambiguous Features", "If checked, features hitting more than one reference will be retained", "checkbox", new JSONObject()
36-
{{
37-
put("check", false);
38-
}}, false, null, true),
3935
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()
4036
{{
4137
put("check", true);
@@ -76,7 +72,7 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
7672
for (int i = 0; i < json.length(); i++)
7773
{
7874
JSONArray arr = json.getJSONArray(i);
79-
if (arr.length() != 2)
75+
if (arr.length() != 3)
8076
{
8177
throw new PipelineJobException("Unexpected value: " + json.getString(i));
8278
}
@@ -88,6 +84,23 @@ protected Chunk createParamChunk(SequenceOutputHandler.JobContext ctx, List<Seur
8884
}
8985
ret.bodyLines.add(")");
9086

87+
ret.bodyLines.add("nimbleGenomeAmbiguousPreference <- list(");
88+
delim = "";
89+
for (int i = 0; i < json.length(); i++)
90+
{
91+
JSONArray arr = json.getJSONArray(i);
92+
if (arr.length() != 3)
93+
{
94+
throw new PipelineJobException("Unexpected value: " + json.getString(i));
95+
}
96+
97+
int genomeId = arr.getInt(0);
98+
boolean retainAmbiguousFeatures = arr.getBoolean(2);
99+
ret.bodyLines.add("\t" + delim + "'" + genomeId + "' = " + (retainAmbiguousFeatures ? "TRUE" : "FALSE"));
100+
delim = ",";
101+
}
102+
ret.bodyLines.add(")");
103+
91104
return ret;
92105
}
93106

singlecell/src/org/labkey/singlecell/run/NimbleHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ private Map<NimbleGenome, File> doAlignment(List<NimbleGenome> genomes, List<Fil
535535
return resultMap;
536536
}
537537

538-
private File getReportHtmlFileFromResults(File reportResultsGz)
538+
private File getReportHtmlFileFromResults(File reportResults)
539539
{
540-
return new File(reportResultsGz.getPath().replaceAll("txt.gz$", "html$"));
540+
return new File(reportResults.getPath().replaceAll("txt(.gz)*$", "html"));
541541
}
542542

543543
private File getNimbleDoneFile(File parentDir, String resumeString)

0 commit comments

Comments
 (0)