-
Notifications
You must be signed in to change notification settings - Fork 56
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
implement one row linear viewer #205
base: develop
Are you sure you want to change the base?
Conversation
7a0f15f
to
e95d649
Compare
0923a0b
to
92220a5
Compare
92220a5
to
9008211
Compare
Seeing one small thing @bugzpodder where the annotation wrapping edges are showing up along the linear viewer like: That should be fixable down in Annotations around among all this nonsense for edges and stuff: https://github.com/Lattice-Automation/seqviz/blob/develop/src/Linear/Annotations.tsx#L130-L182 |
src/Linear/Linear.tsx
Outdated
blockWidths[i] = blockWidth; | ||
if (blockHeight > maxBlockHeight) { | ||
maxBlockHeight = blockHeight; | ||
} | ||
if (maxTranslationRowSize < translationRows[i].length) { | ||
maxTranslationRowSize = translationRows[i].length; | ||
} | ||
if (maxAnnotationRowSize < annotationRows[i].length) { | ||
maxAnnotationRowSize = annotationRows[i].length; | ||
} | ||
} |
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've only skimmed this so far -- so I'm not saying this with certainty -- but do we need to calculate the max at all @bugzpodder. I would think that down in SeqBlock
we could just use the size of the first (and only) row every time
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 reason for using max is actually for exactly this reason:
#205 (comment)
The bps and the yellow bar might not match up because of differing translation/annotation. See this screenshot.
This sequence is what's being used in the current demo
At bps 1170 you'll see the amino acid translation taking two rows. If you feel this is ok then then I can take out the maxTranlsationRowSize/maxAnnotationRowSize calculations. Now that I think of it, what I have today still doesn't guarentee that everything lines up. If you have two translations in the first block, and second translation extends to the second block, you'll still get a broken translation block which is not ideal.
In case you are curious the reason why they don't match up in this particular sequence is because of the translations prop from the demo:
translations: [
{ direction: -1, end: 630, start: 6 },
{ end: 1147, start: 736 },
{ end: 1885, start: 1165 },
],
Note that here the second translation section and third section doesn't actually overlap (1147/1165) but they happen to be in the same SeqBlock but the code did not figure out that they happen to be on the same row.
@bugzpodder I'm toying around with something like what's in this example PR's commit: 95fa062 We'd literally have only a single Some pros/cons of that different approach in that commit above: Pros:
Cons:
where return tickIndexes.map(p => {
let { x: tickFromLeft, render } = findXAndWidth(p - 1, p - 1); // for midpoint
if (!render) {
return null;
}
tickFromLeft += charWidth / 2; I'm open to other thoughts/opinions on this. And I realize it's a bit of a drift in approach from the PR, but I think it might be less total work... |
I think that's a really neat idea. If we can render using just a partial block and do some optimizations so the svg path are only drawn for whats in the viewport that would obviously be best. definitely prefer that since its much easier to reason with and code. |
This is awesome. Looks like we've made some progress with this PR. Can we carry this over the finish line? @jjti @bugzpodder |
@leshane I think @jjti is planning a simpler implementation. The issue with my version is that when two blocks are connected together you see some weird artifacts: #205 (comment) |
fixes #179
https://codesandbox.io/s/dawn-haze-ey1k3v?file=/demo/package.json