Skip to content

When annotated colors are provided, coerce to character vector #84

@jiajic

Description

@jiajic

When an annotated colors in GiottoVisuals are provided, providing as list can result in a very unclear error message. For example:

cell_colors <- list(
    "T_Cell" = "darkgreen",
    "Macrophage" = "cornflowerblue",
    "Endothelial" = "red",
    "Adipocyte" = "purple",
    "B_Cell" = "blue",
    "Mast" = "green",
    "PVL" = "lightblue",
    "CAF" = "orange",
    "Basal_like_Epithelial" = "brown",
    "Cancer" = "grey"
)

plotUMAP(gobject, cell_color = "cell_types", point_size = 0.2,
         cell_color_code = cell_colors,
         point_border_stroke = 0,
         label_size = 4,
         save_param = list(
             base_width = 11
         ))

This will eventually produce an error and ALSO lock up your session for quite a long time as ggplot figures things out.

These cases should be coerced to the expected color vector if possible so that it can be gracefully handled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions