custom color with consensus_views
Opened this issue · 0 comments
csgenomics-admin commented
Hi,
I was wondering if it would be possible to render a valid result with the custom_color = ...
argument when also setting consensus_views = TRUE
. Currently, you can render custom colors if the consensus view is set to FALSE, but not if TRUE.
As I show below, it appears you can currently generate alternative color schemes while also passing consensus_view = TRUE
provided those alternatives are the built-in set of colors, however, I can not find a way to pass the custom_color
argument and get the expected custom palette to render (it always defaults back to the default color palette).
Thanks for any tips you can offer
# reproducing using https://github.com/YuLab-SMU/ggmsa/issues/32
# custom palette labeled 'my_cutstom', though see: https://github.com/YuLab-SMU/ggmsa/issues/21
protein_sequences <- system.file("extdata", "sample.fasta", package = "ggmsa")
p1 <- ggmsa(protein_sequences, 300, 345)
custom_color = my_cutstom,
char_width = 0.5,
show.legend = FALSE)
my_cutstom <- data.frame(names = c(LETTERS[1:26],"-"),
color = "#FFFFFF",
stringsAsFactors = FALSE)
# default color works
ggmsa(protein_sequences, 300, 350, char_width = 0.5, seq_name = TRUE, consensus_views = TRUE, disagreement = FALSE, use_dot = TRUE)
# custom color can work if not requiring consensus_views to be TRUE:
ggmsa(protein_sequences, 300, 350, char_width = 0.5, seq_name = TRUE, custom_color = my_cutstom)
# alternate built-in color works
ggmsa(protein_sequences, 300, 350, char_width = 0.5, seq_name = TRUE, consensus_views = TRUE, disagreement = FALSE, use_dot = TRUE, color = 'Taylor_AA')
# custom color does not work
ggmsa(protein_sequences, 300, 350, char_width = 0.5, seq_name = TRUE, consensus_views = TRUE, disagreement = FALSE, use_dot = TRUE, custom_color = my_cutstom)