Skip to content

Commit 53842b6

Browse files
committed
Allow nimble runs to provide a custom value for num_mismatches
1 parent d3b5fae commit 53842b6

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

singlecell/resources/web/singlecell/panel/NimbleAlignPanel.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
4141
},LABKEY.ext4.GRIDBUTTONS.DELETERECORD()],
4242
store: {
4343
type: 'array',
44-
fields: ['genomeId', 'template', 'grouping', 'scorePercent']
44+
fields: ['genomeId', 'template', 'grouping', 'scorePercent', 'numMismatches']
4545
},
4646
columns: [{
4747
dataIndex: 'genomeId',
@@ -85,6 +85,16 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
8585
dataIndex: 'scorePercent',
8686
width: 150,
8787
header: 'Min Pct Aligned',
88+
editor: {
89+
xtype: 'ldk-numberfield',
90+
minValue: 0,
91+
maxValue: 1,
92+
decimalPrecision: 2
93+
}
94+
},{
95+
dataIndex: 'numMismatches',
96+
width: 150,
97+
header: 'Max Mismatches',
8898
editor: {
8999
xtype: 'ldk-integerfield',
90100
minValue: 0
@@ -99,7 +109,7 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
99109
getValue: function(){
100110
var ret = [];
101111
this.down('ldk-gridpanel').store.each(function(r, i) {
102-
ret.push([r.data.genomeId, r.data.template, r.data.grouping || false, r.data.scorePercent || '']);
112+
ret.push([r.data.genomeId, r.data.template, r.data.grouping || false, r.data.scorePercent || '', r.data.numMismatches || '']);
103113
}, this);
104114

105115
return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
@@ -136,7 +146,8 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
136146
genomeId: row[0],
137147
template: row[1],
138148
grouping: row[2],
139-
scorePercent: row.length > 3 ? row[3] : null
149+
scorePercent: row.length > 3 ? row[3] : null,
150+
numMismatches: row.length > 4 ? row[4] : null
140151
});
141152
grid.store.add(rec);
142153
}, this);

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ else if ("strict".equals(alignTemplate))
288288
config.put("score_percent", genome.getScorePercent());
289289
}
290290

291+
if (genome.getNumMismatches() > 0)
292+
{
293+
getPipelineCtx().getLogger().debug("Using custom num_mismatches: " + genome.getNumMismatches());
294+
config.put("num_mismatches", genome.getNumMismatches());
295+
}
296+
291297
getPipelineCtx().getLogger().info("Final config:");
292298
getPipelineCtx().getLogger().info(config.toString(1));
293299

@@ -570,6 +576,7 @@ private static class NimbleGenome
570576
private final boolean doGroup;
571577
private final int maxHitsToReport;
572578
private final double scorePercent;
579+
private final int numMismatches;
573580

574581
public NimbleGenome(JSONArray arr, int maxHitsToReport) throws PipelineJobException
575582
{
@@ -585,6 +592,9 @@ public NimbleGenome(JSONArray arr, int maxHitsToReport) throws PipelineJobExcept
585592
String rawScore = arr.length() > 3 ? StringUtils.trimToNull(arr.getString(3)) : null;
586593
scorePercent = rawScore == null ? -1.0 : Double.parseDouble(rawScore);
587594

595+
String rawMismatches = arr.length() > 4 ? StringUtils.trimToNull(arr.getString(4)) : null;
596+
numMismatches = rawMismatches == null ? -1 : Integer.parseInt(rawMismatches);
597+
588598
this.maxHitsToReport = maxHitsToReport;
589599
}
590600

@@ -607,5 +617,10 @@ public double getScorePercent()
607617
{
608618
return scorePercent;
609619
}
620+
621+
public Integer getNumMismatches()
622+
{
623+
return numMismatches;
624+
}
610625
}
611626
}

0 commit comments

Comments
 (0)