Skip to content

Commit f02cc58

Browse files
committed
Switch nimble to use custom alignment percentage, rather than alignment length
1 parent 7fb741a commit f02cc58

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

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

Lines changed: 5 additions & 5 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', 'scoreThreshold']
44+
fields: ['genomeId', 'template', 'grouping', 'scorePercent']
4545
},
4646
columns: [{
4747
dataIndex: 'genomeId',
@@ -82,9 +82,9 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
8282
xtype: 'checkbox'
8383
}
8484
},{
85-
dataIndex: 'scoreThreshold',
85+
dataIndex: 'scorePercent',
8686
width: 150,
87-
header: 'Score Threshold',
87+
header: 'Min Pct Aligned',
8888
editor: {
8989
xtype: 'ldk-integerfield',
9090
minValue: 0
@@ -99,7 +99,7 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
9999
getValue: function(){
100100
var ret = [];
101101
this.down('ldk-gridpanel').store.each(function(r, i) {
102-
ret.push([r.data.genomeId, r.data.template, r.data.grouping || false, r.data.scoreThreshold || '']);
102+
ret.push([r.data.genomeId, r.data.template, r.data.grouping || false, r.data.scorePercent || '']);
103103
}, this);
104104

105105
return Ext4.isEmpty(ret) ? null : JSON.stringify(ret);
@@ -136,7 +136,7 @@ Ext4.define('SingleCell.panel.NimbleAlignPanel', {
136136
genomeId: row[0],
137137
template: row[1],
138138
grouping: row[2],
139-
scoreThreshold: row.length > 3 ? row[3] : null
139+
scorePercent: row.length > 3 ? row[3] : null
140140
});
141141
grid.store.add(rec);
142142
}, this);

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void doNimbleAlign(File bam, PipelineStepOutput output, Readset rs, Strin
179179
output.addIntermediateFile(genomeFasta);
180180
output.addIntermediateFile(refJson);
181181

182-
String description = genome.getScoreThreshold() > 0 ? "score_threshold: " + genome.getScoreThreshold() : null;
182+
String description = genome.getScorePercent() > 0 ? "score_percent: " + genome.getScorePercent() : null;
183183
output.addSequenceOutput(results, basename + ": nimble align", "Nimble Alignment", rs.getRowId(), null, genome.getGenomeId(), description);
184184
}
185185
}
@@ -231,6 +231,7 @@ private void updateNimbleConfigFile(File configFile, NimbleGenome genome) throws
231231
config.put("num_mismatches", 10);
232232
config.put("intersect_level", 0);
233233
config.put("score_threshold", 45);
234+
config.put("score_percent", 0.75);
234235
config.put("score_filter", 25);
235236
//discard_multiple_matches: false
236237
//discard_multi_hits: ?
@@ -240,7 +241,8 @@ else if ("strict".equals(alignTemplate))
240241
{
241242
config.put("num_mismatches", 0);
242243
config.put("intersect_level", 0);
243-
config.put("score_threshold", 50);
244+
config.put("score_percent", 0.99);
245+
config.put("score_threshold", 45);
244246
config.put("score_filter", 25);
245247
}
246248
else
@@ -255,10 +257,10 @@ else if ("strict".equals(alignTemplate))
255257

256258
config.put("max_hits_to_report", genome.maxHitsToReport);
257259

258-
if (genome.getScoreThreshold() > 0)
260+
if (genome.getScorePercent() > 0)
259261
{
260-
getPipelineCtx().getLogger().debug("Using custom score_threshold: " + genome.getScoreThreshold());
261-
config.put("score_threshold", genome.getScoreThreshold());
262+
getPipelineCtx().getLogger().debug("Using custom score_percent: " + genome.getScorePercent());
263+
config.put("score_percent", genome.getScorePercent());
262264
}
263265

264266
getPipelineCtx().getLogger().info("Final config:");
@@ -487,7 +489,7 @@ private static class NimbleGenome
487489
private final String template;
488490
private final boolean doGroup;
489491
private final int maxHitsToReport;
490-
private final int scoreThreshold;
492+
private final double scorePercent;
491493

492494
public NimbleGenome(String genomeStr, int maxHitsToReport) throws PipelineJobException
493495
{
@@ -502,7 +504,7 @@ public NimbleGenome(String genomeStr, int maxHitsToReport) throws PipelineJobExc
502504
doGroup = arr.getBoolean(2);
503505

504506
String rawScore = arr.length() > 3 ? StringUtils.trimToNull(arr.getString(3)) : null;
505-
scoreThreshold = rawScore == null ? -1 : Integer.parseInt(rawScore);
507+
scorePercent = rawScore == null ? -1.0 : Double.parseDouble(rawScore);
506508

507509
this.maxHitsToReport = maxHitsToReport;
508510
}
@@ -522,9 +524,9 @@ public boolean isDoGroup()
522524
return doGroup;
523525
}
524526

525-
public int getScoreThreshold()
527+
public double getScorePercent()
526528
{
527-
return scoreThreshold;
529+
return scorePercent;
528530
}
529531
}
530532

0 commit comments

Comments
 (0)