Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom color with consensus_views #54

Open
csgenomics-admin opened this issue Nov 18, 2022 · 0 comments
Open

custom color with consensus_views #54

csgenomics-admin opened this issue Nov 18, 2022 · 0 comments

Comments

@csgenomics-admin
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant