Skip to content
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

Tips of reads can overlap in X by fractions of a base #418

Open
adamnovak opened this issue Apr 9, 2024 · 3 comments
Open

Tips of reads can overlap in X by fractions of a base #418

adamnovak opened this issue Apr 9, 2024 · 3 comments
Assignees

Comments

@adamnovak
Copy link
Member

In this view, reads crossing an expanded gap between nodes can get bumped down a lane because they overlap other reads in X by a few pixels, not an entire base. See this image:

Image

Read lines should always start and end exactly on base boundaries. There shouldn't be apparently random slop of a few pixels here or there.

@adamnovak adamnovak converted this from a draft issue Apr 9, 2024
@adamnovak
Copy link
Member Author

I looked at these more and the reads are indeed overlapping by exactly 1 SVG pixel unit. The X + width of the final rectangle in that blue read on the right is 1 more than the X of the first rectangle of that red read it bumps into.

We probably need to look at the functions that compute read start and end X coordinates:

function getReadXStart(read) {
const node = nodes[read.path[0].node];
if (read.path[0].isForward) {
// read starts in forward direction
return getXCoordinateOfBaseWithinNode(node, read.firstNodeOffset);
}
// read starts in backward direction
return getXCoordinateOfBaseWithinNode(
node,
node.sequenceLength - read.firstNodeOffset
);
}
function getReadXEnd(read) {
const node = nodes[read.path[read.path.length - 1].node];
if (read.path[read.path.length - 1].isForward) {
// read ends in forward direction
return getXCoordinateOfBaseWithinNode(node, read.finalNodeCoverLength);
}
// read ends in backward direction
return getXCoordinateOfBaseWithinNode(
node,
node.sequenceLength - read.finalNodeCoverLength
);
}

But I have no idea where we're getting the 1 pixel of overlap.

@adamnovak
Copy link
Member Author

To follow the view link, you should be able to start your local tube map and then click it. The node I am looking at is near the middle of the rendered visualization.

@adamnovak
Copy link
Member Author

Actually, the problem might be here:

.attr("width", (d) => d.xEnd - d.xStart + 1)
.attr("height", (d) => d.yEnd - d.yStart + 1)

We generate the rectangle list entries with exactly coinciding start and end coordinates, and then we add a +1 when we go to draw the SVG elements for them for some reason.

@adamnovak adamnovak self-assigned this Jun 12, 2024
@adamnovak adamnovak moved this from Todo to In Progress in Tube Map/Lancet Integration Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants