YuLab-SMU / ggmsa

:traffic_light: Visualizing publication-quality multiple sequence alignment using ggplot2
http://yulab-smu.top/ggmsa
200 stars 22 forks source link

Error with custom color #21

Open atm44 opened 3 years ago

atm44 commented 3 years ago

Hi, i have found that using custom color produced the next error:

Error in color_scheme(y, color, custom_color) : 
  object 'my_cutstom' not found

I have found that if my custom color dataframe is named as "'my_cutstom" (as you example) the error is fixed. I look at the code and i found that in: https://github.com/YuLab-SMU/ggmsa/blob/master/R/color_else.R there is what i think an error with variables names...and it should be:

    if (!is.null(custom_color)){
        custom_color[["names"]] <- as.character(custom_color[["names"]]) #Elimination factor interference
        custom_color[["color"]] <- as.character(custom_color$col) #Fuzzy matching the string "colors" or "colours"
        row.names(custom_color) <- custom_color[["names"]]
        scheme_AA$custom_color <- custom_color[row.names(scheme_AA), "color"] %>% as.character()
        y$color <- scheme_AA[y$character, "custom_color"]
    }else{

Thanks for this great package!!

nyzhoulang commented 3 years ago

Hi, @atm44

Sorry for the late reply. Thank you for taking the time to fix this bug and helping to make ggmsa better. We are incredibly grateful for you as a customer.

Sincerely, The YuLab Team