I'm trying to make a lollipop chart to show variants on a gene of interest. I have gotten so far as plotting them along the coding regions, and coloring the features of the gene, but I am having trouble coloring the lollipops to indicate the type of mutation (missense, synonymous, etc.). I made a new column called "snpEff_ann_colors" in my data.frame that lists the color and associates it with the type of mutation:
> Gene_exonic_SNPs$snpEff_ann_colors
[1] aquamarine azure darkseagreen1 darkseagreen1 azure
[6] azure darkseagreen1 azure azure darkseagreen1
[11] azure azure darkseagreen1 darkseagreen1 darkseagreen1
I then did:
gene.gr$color <- Gene_exonic_SNPs$snpEff_ann_colors
When I plotted, the colors were not correct:
lolliplotgene.gr, domains, ranges = GRanges("chrX", IRanges(1, 239)))
I noticed that they did this differently in TrackViewer documentation:
sample.gr$color <- sample.int(6, length(SNP), replace=TRUE)
When I did the same in my console, when I print sample.gr$color, it is a list of numbers... However, I would like to have mine be the list that I give it... is there a way to do this?
Did you tried to change your color into character but not factor? You may also try to convert it into hex color.
You're asking a follow up question, not answering the top level question. Please use
Add Comment
, notAdd Answer
.Hi! I stuck with the same problem. Have u figured out yet how to set the color for lollipop node?