Closed hoonghim closed 5 years ago
try something like this:
library(GenVisR)
library(ggplot2)
tmp <- data.frame("sample"=c("Luc1", "Luc1"), "chromosome"=c("5", "8"), "start"=c(20000000, 20000000), "end"=c(70000000, 70000000))
layer <- geom_rect(data=tmp, mapping=aes(xmin=start, xmax=end, ymin=0, ymax=1), fill="yellow", color="yellow")
cnSpec(LucCNseg, genome="hg19", plotLayer = layer)
Thank you so much for your help. It works very well!
And, could I give one more question?
I tried to make a legend which describes color information (Gain: Red, Loss: Blue, Copy-neutral LOH: Yellow) although there is already legend about copy number information like this.
The reason I try to make the legend is to inform people what yellow means.
I tried to do this by adding this code by referring to this question and answer https://stackoverflow.com/questions/23635662/editing-legend-text-labels-in-ggplot
###################### geom_rect(data=int.loh.cohort.df, mapping=aes(xmin=start, xmax=end, ymin=0, ymax=1, color="yellow"), fill="yellow") + scale_color_manual(labels = c("Gain", "Loss", "CN-LOH"), values = c("red", "blue", "yellow")) ####################### This gave me an error: Error: Cannot add ggproto objects together. Did you forget to add this object to a ggplot object? #######################
I don't know what the grammatical problem is.
Could you help me how to add color description?
Again, I sincerely appreciate your help.
Seung-hoon
I think the problem is that you need to pass the ggplot items as a list to GenVisR, also you probably want scale_fill_manual()
On 12/23/18 9:21 AM, hoonghim wrote:
Thank you so much for your help. It works very well!
And, could I give one more question?
I tried to make a legend which describes color information (Gain: Red, Loss: Blue, Copy-neutral LOH: Yellow) although there is already legend about copy number information like this.
[image]https://user-images.githubusercontent.com/42195952/50384972-4d581480-0710-11e9-913a-35b8cb15fdb8.png
The reason I try to make the legend is to inform people what yellow means.
I tried to do this by adding this code by referring to this question and answer https://stackoverflow.com/questions/23635662/editing-legend-text-labels-in-ggplot
###################### geom_rect(data=int.loh.cohort.df, mapping=aes(xmin=start, xmax=end, ymin=0, ymax=1, color="yellow"), fill="yellow") + scale_color_manual(labels = c("Gain", "Loss", "CN-LOH"), values = c("red", "blue", "yellow")) ####################### This gave me an error: Error: Cannot add ggproto objects together. Did you forget to add this object to a ggplot object? #######################
I don't know what the grammatical problem is.
Could you help me how to add color description?
Again, I sincerely appreciate your help.
Seung-hoon
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/griffithlab/GenVisR/issues/350#issuecomment-449643301, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF3GnGpbEeE4izI2-WBmGbdYZ4jLBHDmks5u759lgaJpZM4Zac6j.
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Dear Zachary Skidmore,
hello, I'm trying to visualize copy number variation results for 36 cancer patients using GenVisR, cnSpec().
Thanks to your kind and easy-to-understand description, I could draw a plot for diverse copy-number variations.![image](https://user-images.githubusercontent.com/42195952/50228536-8b40fa00-03eb-11e9-9e48-472be77c6bf8.png)
This is an example part.
And I hope to add more information to this plot. I have information about copy-neutral loss of heterozygosity (LOH).
I made a data frame which includes copy-neutral loh information (chromosome, start, end, segmean, sample) For copy-neutral LOH, segmean is always 2. Thus, I would like to display the LOH area in yellow like this.
In Vignettes, I saw plotLayer option, which could utilize ggplot2.
Could you tell me how to display copy-neutral LOH on a plot?
Thank you for your reading and making this useful tool.
Sincerely,
Seung-hoon