BodenmillerGroup / IMCDataAnalysis

R based workflow for multiplexed imaging data
https://bodenmillergroup.github.io/IMCDataAnalysis/
MIT License
29 stars 12 forks source link

11.2.1 Visualizing metadata: Error in .valid.colour(...) #77

Closed Will760 closed 1 year ago

Will760 commented 1 year ago

Hi Nils,

I am attempting to visualize a single cell type on the segmented image in the following manner:

CD8 <- spe[,spe$celltype == "CD8+ T Cells"]

plotCells(cur_masks,
          object = CD8, 
          cell_id = "ObjectNumber", 
          img_id = "sample_id",
          colour_by = "celltype",
          colour = list(celltype = c(CD8 = "red")),
          missing_colour = "white")

I get the following error:

'Error in .valid.colour(colour, colour_by, outline_by, object, image = NULL) : 
  Please specify colours for all 'colour_by' levels.

Should setting missing_colour = white not specify the colour for all other levels as white? What have I done wrong.

Best wishes and Thank you!!!, Will

nilseling commented 1 year ago

The level you want to color is CD8+ T Cells and not CD8: colour = list(celltype = c("CD8+ T Cells" = "red"))

Will760 commented 1 year ago

Thank you!