vgteam / sequenceTubeMap

displays multiple genomic sequences in the form of a tube map
MIT License
178 stars 24 forks source link

Extra Space Between Nodes #400

Closed ducku closed 5 months ago

ducku commented 6 months ago

Sometimes tracks don't have enough space to make a smooth transition from node to node. This PR creates extra space between nodes, taking into account the maximum difference in y values between nodes given any track.

snp1kg-BRCA1 Before: snp1kg-BRCA1_before

After: snp1kg-BRCA1_after

chr1_15608265_15608765 Before: chr1_15608265_15608765_before

After: chr1_15608265_15608765_after

adamnovak commented 6 months ago

I like the space, but now it's easier to see that the reads are just sort of free-form swooshing around in these gaps, and their lines can get pretty thin along the axis perpendicular to their direction of motion. I wonder if there's a good way to use the extra space to ensure a minimum thickness or to get the reads to stick to horizontal and 45 degree angles.

ducku commented 6 months ago

Currently, curves are drawn using SVG's Beziar Curves. We draw 2 parallel curves and fill them in.

Turns out, drawing parallel Beziar Curves are pretty difficult.

In commit 8b09fa2, some simple numbers were tweaked to make the curves look nicer.

In commit 14a46ec, I attempted to group sets of curves together and skew them based on how they're traversing. I think the results are better, but I'm not sure if it's the right way to do this. Maybe it's not a commit we want to keep.

snp1kg-BRCA1: Skewed_Beziar_snp1kg-BRCA1

ch1_15608265_15608765: Skewed_Beziar_ch1_15608265_15608765

A low hanging fruit could be adding more space between nodes based on the number of curvy reads.

Some improvements can also be made to how curves are grouped. Sometimes, curves start and end on the same node, but aren't neccesarily traversing together. Other times, curves start and end on different nodes, but are traversing closely together. In snp1kg-BRCA1, there's a single read going from T that gets covered up by the reads going from C. Them being grouped together can prevent the coverup.