Skip to content

Commit f0edd26

Browse files
committed
adjust edit distance by barcode length
1 parent cea407a commit f0edd26

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/CellHashingHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,16 @@ public void processFilesRemote(List<Readset> readsets, JobContext ctx) throws Un
242242

243243
if (scanEditDistances)
244244
{
245-
editDistances.add(0);
246-
editDistances.add(1);
247-
editDistances.add(2);
248-
editDistances.add(3);
245+
//account for total length of barcode. shorter barcode should allow fewer edits
246+
Integer minLength = readAllBarcodes(ctx.getSourceDirectory()).keySet().stream().map(String::length).min(Integer::compareTo).get();
247+
int maxEdit = Math.min(3, minLength - 6);
248+
ctx.getLogger().debug("Scanning edit distances, up to: " + maxEdit);
249+
int i = 0;
250+
while (i <= maxEdit)
251+
{
252+
editDistances.add(i);
253+
i++;
254+
}
249255
}
250256
else
251257
{

0 commit comments

Comments
 (0)