Comments (8)
Thank you wilkox, this is what I want to achieve, thank you very much for your help!
from gggenes.
Hi @qingxi586, it looks like you might be using the patchwork package to compose the plots? I can show you how to combine the two plots but I need access to the data stored in z
and f
. Please post your current code as a reprex.
from gggenes.
I tried to merge them using the patchwork package, but it was not successful,I will now present my data to you
> z
net TE X_start X_end direction start end
1 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 0 619 1 4 620
2 Fill Alt.Os0173_LTR_Dasheng#LTR/Gypsy 0 440 0 620 1061
3 Fill Alt.Os0173_LTR_Dasheng#LTR/Gypsy 0 440 0 7942 8383
4 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 614 2282 1 8383 10050
5 Fill Alt.Os0039_LTR_RIRE3#LTR/Gypsy 0 3139 0 10049 13196
6 Fill Alt.Os0039_LTR_RIRE3#LTR/Gypsy 0 3139 0 18964 22115
7 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 2278 2989 1 22117 22824
> f
net TE X_start X_end direction start end
1 Fill Alt.Os0173_INT_Dasheng#LTR/Gypsy 713 6310 0 1061 7071
2 Fill Alt.Os0039_INT_RIRE3#LTR/Gypsy 0 5791 0 13196 18963
It can be observed that these coordinates are all continuous, and I want to represent LTR and INT separately with different arrows in a linear gene
and this is my code
(ggplot(z, aes(xmin = start, xmax = end,y = net, fill = TE,forward = direction,label = TE)) + geom_gene_arrow() +ggplot(f, aes(xmin = start, xmax = end,y = net, fill = TE,forward = direction,label = TE)) + geom_gene_arrow(arrowhead_height = unit(3, "mm"), arrowhead_width = unit(1, "mm")))+facet_wrap( ~ net,scales = "free", ncol = 1)+theme_genes() +
scale_fill_brewer(palette = "Set3") +labs(title=sv_names)+theme(plot.title = element_text(hjust = 0.5,vjust = -130),axis.text.x = element_text(hjust = 0.5, vjust = 185))+geom_gene_label()
thank you for your help!
from gggenes.
library(tidyverse)
library(gggenes)
z <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 0 , 619 , 1 , 4 , 620 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 620 , 1061 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 7942 , 8383 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 614 , 2282 , 1 , 8383 , 10050 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 10049 , 13196 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 18964 , 22115 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 2278 , 2989 , 1 , 22117 , 22824)
z$type <- "LTR"
f <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0173_INT_Dasheng#LTR/Gypsy" , 713 , 6310 , 0 , 1061 , 7071 ,
"Fill" , "Alt.Os0039_INT_RIRE3#LTR/Gypsy" , 0 , 5791 , 0 , 13196 , 18963)
f$type <- "INT"
genes <- bind_rows(z, f)
ggplot(genes, aes(xmin = start, xmax = end, y = net, fill = TE,
forward = direction, label = TE)) +
geom_gene_arrow() +
facet_wrap(~ type, scales = "free", ncol = 1) +
theme_genes()
Created on 2024-03-15 with reprex v2.1.0
from gggenes.
Hi,wilkox
Maybe there are some issues with my description,The data in z and f are actually together, but I divided INT and LTR into two files. This file originally looked like this
> a
net TE X_start X_end direction start end
1 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 0 619 1 4 620
2 Fill Alt.Os0173_LTR_Dasheng#LTR/Gypsy 0 440 0 620 1061
3 Fill Alt.Os0173_INT_Dasheng#LTR/Gypsy 713 6310 0 1061 7071
4 Fill Alt.Os0173_LTR_Dasheng#LTR/Gypsy 0 440 0 7942 8383
5 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 614 2282 1 8383 10050
6 Fill Alt.Os0039_LTR_RIRE3#LTR/Gypsy 0 3139 0 10049 13196
7 Fill Alt.Os0039_INT_RIRE3#LTR/Gypsy 0 5791 0 13196 18963
8 Fill Alt.Os0039_LTR_RIRE3#LTR/Gypsy 0 3139 0 18964 22115
9 Fill Alt.Os0365_LTR_Truncator#LTR/Gypsy 2278 2989 1 22117 22824
Using your gggenes package does draw nice arrows,like this
I said before that I wanted to use two different arrows to plot my genes,LTR uses default parameters geom_gene_arrow()
, INT uses another parameter geom_gene_arrow(arrowhead_height = unit(3, "mm"), arrowhead_width = unit(1, "mm"))
This way I can get the picture I want .
from gggenes.
I don't think I really understand what you're trying to achieve. Is it something like this?
library(tidyverse)
library(gggenes)
z <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 0 , 619 , 1 , 4 , 620 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 620 , 1061 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 7942 , 8383 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 614 , 2282 , 1 , 8383 , 10050 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 10049 , 13196 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 18964 , 22115 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 2278 , 2989 , 1 , 22117 , 22824)
z$type <- "LTR"
f <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0173_INT_Dasheng#LTR/Gypsy" , 713 , 6310 , 0 , 1061 , 7071 ,
"Fill" , "Alt.Os0039_INT_RIRE3#LTR/Gypsy" , 0 , 5791 , 0 , 13196 , 18963)
f$type <- "INT"
genes <- bind_rows(z, f)
ggplot(genes, aes(xmin = start, xmax = end, y = type, fill = TE,
forward = direction, label = TE)) +
geom_gene_arrow(data = z) +
geom_gene_arrow(data = f, arrowhead_height = unit(3, "mm"), arrowhead_width = unit(1, "mm")) +
theme_genes()
Created on 2024-03-17 with reprex v2.1.0
If not, maybe you could draw it on paper and take a picture to show what you want?
from gggenes.
Sorry, my description is not accurate enough, I use Adobe illustrator to show you
In this picture you can see Alt.Os0173_INT_Dasheng#LTR/Gypsy
and Alt.Os0039_INT_RIRE3#LTR/Gypsy
The parameters used are geom_gene_arrow(arrowhead_height = unit(3, "mm"), arrowhead_width = unit(1, "mm"))
While other TEs use geom_gene_arrow()
This is what I want to express, I want two different arrows to be drawn on one graph at the same time.
from gggenes.
Thanks for the picture. Is this what you're after?
library(tidyverse)
library(gggenes)
z <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 0 , 619 , 1 , 4 , 620 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 620 , 1061 ,
"Fill" , "Alt.Os0173_LTR_Dasheng#LTR/Gypsy" , 0 , 440 , 0 , 7942 , 8383 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 614 , 2282 , 1 , 8383 , 10050 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 10049 , 13196 ,
"Fill" , "Alt.Os0039_LTR_RIRE3#LTR/Gypsy" , 0 , 3139 , 0 , 18964 , 22115 ,
"Fill" , "Alt.Os0365_LTR_Truncator#LTR/Gypsy" , 2278 , 2989 , 1 , 22117 , 22824)
z$type <- "LTR"
f <- tribble(
~net , ~TE , ~X_start , ~X_end , ~direction , ~start , ~end ,
"Fill" , "Alt.Os0173_INT_Dasheng#LTR/Gypsy" , 713 , 6310 , 0 , 1061 , 7071 ,
"Fill" , "Alt.Os0039_INT_RIRE3#LTR/Gypsy" , 0 , 5791 , 0 , 13196 , 18963)
f$type <- "INT"
genes <- bind_rows(z, f)
ggplot(genes, aes(xmin = start, xmax = end, y = "fill", fill = TE,
forward = direction, label = TE)) +
geom_gene_arrow(data = z) +
geom_gene_arrow(data = f, arrowhead_height = unit(3, "mm"), arrowhead_width = unit(1, "mm")) +
theme_genes() +
scale_fill_brewer(palette = "Set3") +
labs(y = "net", title = "MH63.chr01_SV10298075")
Created on 2024-03-19 with reprex v2.1.0
from gggenes.
Related Issues (20)
- theme_genes() produces error HOT 3
- Can you modify the length of the following genomic region HOT 3
- Terminator point feature HOT 5
- Deprecate `size` in favour of `linewidth`
- Implement SBOL sequence feature glyphs HOT 3
- Break strand in intra-CDS regions HOT 2
- geom_feature_label text size very small when ncol=1 in facet_wrap HOT 1
- How to prepare for gggenes HOT 3
- Gene Orientation not correct HOT 1
- An incomprehensible error HOT 4
- would be nice for protein people HOT 2
- How about an option to draw an interrupted X-axis? HOT 1
- Genome alignment HOT 1
- error: No "geom_terminator" functions HOT 2
- how to rescale and align genes of different size? HOT 1
- Gene length issue HOT 1
- How to deal with larger length for the genes HOT 1
- Calculate the direction of data obtained from gff file HOT 4
- How to use scale_colour_manual to specify color for individual genes 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 gggenes.