Skip to content

Commit

Permalink
Merge pull request #386 from ducku/issues/364-prevent-reads-shuffle
Browse files Browse the repository at this point in the history
Issues/364 prevent reads shuffle
  • Loading branch information
adamnovak authored Jan 17, 2024
2 parents dfc61a9 + 9f0170e commit 17c69e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/util/tubemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,23 @@ function placeReads() {
reads.forEach((read, idx) => {
read.path.forEach((element, pathIdx) => {
if (!element.hasOwnProperty("y")) {
// previous y value from pathIdx - 1 might not exist yet if that segment is also without node
// use previous y value from last segment with node instead
let previousValidY = null;
let lastIndex = pathIdx - 1;
while (previousValidY === null && lastIndex >= 0) {
previousValidY = reads[idx].path[lastIndex].y;
lastIndex = lastIndex - 1;
}
elementsWithoutNode.push({
readIndex: idx,
pathIndex: pathIdx,
previousY: reads[idx].path[pathIdx - 1].y,
previousY: previousValidY,
});
}
});
});

elementsWithoutNode.sort(compareNoNodeReadsByPreviousY);
elementsWithoutNode.forEach((element) => {
const segment = reads[element.readIndex].path[element.pathIndex];
Expand Down

0 comments on commit 17c69e5

Please sign in to comment.