Comments (4)
Fancy! Good question. What kind of scale do you mean? A complete axis, or a small scale bar with fixed size for comparison. Maybe akin to #85 geom_scale_bar but on the y-axis matching the ribbon scale?
On a side note, check out gggenomes::geom_wiggle()
which I've added a while back. It wraps geom_ribbon()
, so that you don't need to add all the y,ymax,x,xend, ...
.
from gggenomes.
Thanks a lot for the geom_wiggle() tip! Indeed makes it much easier to plot the ribbons. I tried the "line" and "linerange" option which gives you a legend for the plotted data. This is already pretty nice!
Below is the "line" version as I think the "linerange" is a bit confusing in a whole genome context. To elaborate the graph a bit: The upper ribbon is actual annotated genes of a gene family and the lower part is expressed genes of the same gene family from IsoSeq data.
However, the problem I encounter is that each ribbon gets its own legend scale. It should be a shared one among all the ribbons.
I guess an added dedicated axis for each ribbon would be the easiest for people to understand what they are looking at there.
Thank you for your help!
Cheers,
Daniel
from gggenomes.
A little update to this. I had some time to play around with this and I got a bit further with the gggenomes builtin aesthetics:
- First I draw the bare genome
- Then I add the feature track plus a bar plot
- To this I add the axis information plus a continuous scale that takes the max from the added feature track.
p_chr <- gggenomes(seqs = genome)+
geom_seq()
p_chr %>% add_feats(cluster)+
geom_bar(aes(x=(x+xend)/2,
y = score),
feats(cluster),
fill="orange",
linetype=1,
size=0.1,
alpha=1,
stat = "identity")+
theme(axis.line.y.left = element_line(),
axis.ticks.y = element_line(),
axis.text.y = element_text(),
axis.line.x = element_blank(),
axis.ticks.x = element_blank(),
axis.text.x = element_blank())+
scale_y_continuous(limits = c(0, max(cluster$score)),breaks = seq(0,max(cluster$score), 2))
My question would be if there is a way to move the bare genome to 0. It seems to sit always at 1 at the Y-axis.
I haven't tried to add this to a bigger gggenomes plot.
from gggenomes.
Here's a solution, although granted, not the prettiest ...
p1 <- gggenomes(emale_genes, emale_seqs) |> add_clusters(emale_cogs) +
geom_seq() + geom_gene()
# default plot with first genome at y==1
p1 + theme_bw()
p2 <- p1
# change y-coords of seqs by hand
p2 <- set_seqs(p2, get_seqs(p2) |> mutate(y=y-1))
# relayout other features (genes, etc)
# BUG: this should work but ignore_seqs not propaged
# p2 <- layout(p2, ignore_seqs=TRUE)
# this works
p2$data <- layout(p2$data, ignore_seqs=TRUE)
# plot with genomes shifted on y axis, i.e. first genomes at y==0
p2 + theme_bw()
from gggenomes.
Related Issues (20)
- geom_link new error HOT 2
- Strand error when call gggenome()
- Submission for JOSS?
- Errror while installing HOT 1
- ggplot2 error using example data HOT 6
- Installation error HOT 3
- fill and fontface otions for geom_gene_label HOT 4
- Move deps from Depends to Imports? HOT 1
- Adding UTRs in the plot HOT 3
- Genes do not start and end at the expected positions HOT 2
- Setting coordinates to visualise part of the genome HOT 1
- shitf() "unused argument" HOT 2
- geom_gene() doesn't work HOT 5
- Errors when running read_feats command HOT 3
- Change space between seqs within the same bin HOT 5
- Changing gene colours HOT 2
- ! Required column(s) missing: • length HOT 2
- breaks to sequences with geom_break() HOT 1
- Error in read_feats HOT 4
- Draw a combined plot with ggtree and gggenomes HOT 3
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 gggenomes.