-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified sorting logic to sort no-node reads #440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some of the code was reordered to add the comments and now it doesn't actually work. Also the comparison function's comment about what it does needs updating. I made some suggestions.
src/util/tubemap.js
Outdated
function compareNoNodeReads(a, b) { | ||
// Sort by order by segments | ||
const segmentA = readA.path[a.pathIndex]; | ||
const segmentB = readB.path[b.pathIndex]; | ||
if (segmentA.order !== segmentB.order) { | ||
return segmentA.order - segmentB.order; | ||
} | ||
// Sort by reads' source track | ||
const readA = reads[a.readIndex]; | ||
const readB = reads[b.readIndex]; | ||
if (readA.sourceTrackID !== readB.sourceTrackID){ | ||
return readA.sourceTrackID - readB.sourceTrackID; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing because the reads are not defined early enough.
function compareNoNodeReads(a, b) { | |
// Sort by order by segments | |
const segmentA = readA.path[a.pathIndex]; | |
const segmentB = readB.path[b.pathIndex]; | |
if (segmentA.order !== segmentB.order) { | |
return segmentA.order - segmentB.order; | |
} | |
// Sort by reads' source track | |
const readA = reads[a.readIndex]; | |
const readB = reads[b.readIndex]; | |
if (readA.sourceTrackID !== readB.sourceTrackID){ | |
return readA.sourceTrackID - readB.sourceTrackID; | |
} | |
function compareNoNodeReads(a, b) { | |
// Get the reads for the segments | |
const readA = reads[a.readIndex]; | |
const readB = reads[b.readIndex]; | |
// Sort by order by segments | |
const segmentA = readA.path[a.pathIndex]; | |
const segmentB = readB.path[b.pathIndex]; | |
if (segmentA.order !== segmentB.order) { | |
return segmentA.order - segmentB.order; | |
} | |
// Sort by reads' source track | |
if (readA.sourceTrackID !== readB.sourceTrackID){ | |
return readA.sourceTrackID - readB.sourceTrackID; | |
} |
src/util/tubemap.js
Outdated
console.log("elementsWithoutNode before sort:", elementsWithoutNode) | ||
elementsWithoutNode.sort(compareNoNodeReads); | ||
console.log("elementsWithoutNode:", elementsWithoutNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this logging in the final version.
console.log("elementsWithoutNode before sort:", elementsWithoutNode) | |
elementsWithoutNode.sort(compareNoNodeReads); | |
console.log("elementsWithoutNode:", elementsWithoutNode) | |
elementsWithoutNode.sort(compareNoNodeReads); |
src/util/tubemap.js
Outdated
// compare read segments which are outside of nodes | ||
// by the y-coord of where they are coming from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment isn't true anymore and needs to be updated.
// compare read segments which are outside of nodes | |
// by the y-coord of where they are coming from | |
// Compare read segments which are outside of nodes, to sort them in a good horizontal | |
// and then vertical display order. |
Fixes #431