Comments (4)
Thank you for the detailed work on this and the documentation, the examples are great! A lot of work, really appreciated.
from ggtranscript.
I really like the idea of labelling geom_range
s. Not only would this be useful for exons, I can imagine it coming in handy for other use cases e.g. labelling to_diff()
(or one day, to_jdiff()
) outputs with their width to see if transcript changes remain in frame. With this in mind, I find the generic solution more appealing, with a helper function to facilitate the exon number use case.
Thinking this through, I think such a label could currently be achieved by adding something like e.g. ggplot2::geom_label(aes(x = (start + end / 2), label = exon_number))
. I wonder if it is worth adding a label
parameter to geom_range()
or instead, show in the vignette/example the combined use of geom_label
and geom_range
? Personally favour the latter, as it gives users more flexibility and maybe more ggplot2
-esque - would appreciate your thoughts.
For the junction case, I do think a label
parameter makes sense. The difference from geom_range
being that users currently cannot easily add a label to the centre of the junction line as this requires knowing the points of the curve (in particular the y
values). Implementation-wise, I think I would need to rewrite GeomJunction
to inherit from GeomPath
rather than GeomCurve
to allow manipulation of the curve prior to creation of the grob
- I will give this a go.
Thank you for your feedback, super helpful @gpertea!
from ggtranscript.
Thank you -- using geom_label
(with geom_range
) sounds like a good solution for labeling exons, I did not realize it could be that simple. I guess in that case the only thing left for exons would be to make sure the exon_ number
column can be generated with a helper function if the attribute is missing.
from ggtranscript.
I've added both the exon number helper function and method for labelling junctions.
For the junction label, I went for a separate label geom that inherits from ggrepel::geom_label_repel
. The reason I chose this option over a label
parameter inside geom_junction
was because I think this approach would give users more flexibility in deciding the label aesthetics. The downside of this approach is that costs more computationally (as we have to generate junction curves twice - once for junctions, another for junction labels), but there is scope to optimise my implementation if speed does become a bottleneck.
One thing I was considering is whether to provide a helper function (pretty much what is used internally by geom_junction_label_repel
) to obtain the midpoints of junction curves. This would enable users to e.g. use ggplot2::geom_text
or ggplot2::geom_label
instead of ggrepel::geom_label_repel
if they desired. Out of simplicity, I've held back on this for now with the idea to return to it if any users requested - would you find this helper useful?
Let me know if you have any additional thoughts regarding the above - thank you!
from ggtranscript.
Related Issues (12)
- high-level workflow example HOT 1
- Warning about size being replaced by linewidth in ggplot2 3.4.0+
- reverse orientation of transcripts on minus strand HOT 1
- shortened gaps with exon and CDS
- extend `to_diff()` to junctions HOT 1
- packing non-overlapping transcripts on the same y
- Allow `shorten_gaps()` to take into account CDS as well as exons
- Make plots interactive HOT 4
- Problems using facet_wrap HOT 2
- lines extend to gene model with geom_junction_label_repel HOT 3
- adding coverage HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggtranscript.