Comments (2)
Ah yes! ok, it makes sense. I was actually almost there earlier but I couldn't figure out exactly what the problem was. I was trying to apply to_intron
to only subsets of the dataframe but this is much easier. Thank you very much and great package, I was really missing something simple like ggtranscript, that works well with the ggplot2 philosophy.
Thanks for the prompt reply, I am closing this as it's resolved.
Andrea
from ggtranscript.
Thanks for the feedback on ggtranscript
!
to_intron()
assumes each group_var
is represented once in the data. In your data each "feature_id" is repeated 3 times (one repeat per DAI), which results in the weird output.
The easiest solution is to create a unique group_var
for each of your transcript + DAIs combinations. For example:
prop_plot <- prop_plot |> dplyr::mutate(unique_id = stringr::str_c(feature_id, "-", DAI)
Then, the rest of your code should work as intended.
# using the created "unique_id" as the group_var
prop_plot_introns <- ggtranscript::to_intron(prop_plot, "unique_id")
prop_plot %>%
ggplot2::ggplot(ggplot2::aes(
xstart = start,
xend = end,
y = feature_id
)) +
ggplot2::facet_grid(cols = vars(DAI)) +
ggtranscript::geom_range(
ggplot2::aes(fill = Proportion)
) +
ggtranscript::geom_intron(
data = prop_plot_introns,
ggplot2::aes(strand = strand)
) +
ggplot2::scale_fill_gradient2(
high = "darkorchid",
low = "white",
mid = "darkorange",
midpoint = 0.5
# midpoint = min(prop_plot$Proportion) + ((max(prop_plot$Proportion) - min(prop_plot$Proportion)) / 2)
) +
ggplot2::guides(fill = ggplot2::guide_legend("Proportion"))
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
- labeling of exons (junctions?) HOT 4
- 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
- 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.