Dimensionality reduction visualization
1
0
Entering edit mode
Simon • 0
@56deffa4
Last seen 3 months ago
Switzerland

Enter the body of text here

Code should be placed in three backticks as shown below

library(dittoSeq)
 library(scater)
 library(patchwork)
 library(cowplot)
 library(viridis)

 ## UMAP colored by cell type and expression - dittoDimPlot
 p1 <- dittoDimPlot(spe, 
                    var = "celltype", 
                    reduction.use = "UMAP_mnnCorrected", 
                    size = 0.2,
                    do.label = TRUE) +
   scale_color_manual(values = metadata(spe)$color_vectors$celltype) +
   theme(legend.title = element_blank()) +
   ggtitle("Cell types on UMAP, integrated cells")

 p2 <- dittoDimPlot(spe, 
                    var = "Ecad", 
                    assay = "exprs",
                    reduction.use = "UMAP_mnnCorrected", 
                    size = 0.2, 
                    colors = viridis(100), 
                    do.label = TRUE) +
   scale_color_viridis()

 p1 + p2
# include your problematic code here with any corresponding output 
# please also include the results of running the following in an R session 
Error in .var_OR_get_meta_or_gene(target, object, assay, slot, adjustment) : 
  celltype is not a metadata or gene nor equal in length to ncol('object')
sessionInfo( )
imcRtools SingleCellData imcdatasets SpatialWorkflow • 252 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 13 hours ago
United States

You did this:

p1 <- dittoDimPlot(spe, 
                    var = "celltype", 
                    reduction.use = "UMAP_mnnCorrected", 
                    size = 0.2,
                    do.label = TRUE)

And then got an error that says

Error in .var_OR_get_meta_or_gene(target, object, assay, slot, adjustment) : 
  celltype is not a metadata or gene nor equal in length to ncol('object')

Which seems pretty clear? The var argument you used is not in the colData slot, nor is it a gene name, nor is it a vector that is the same length as the number of columns of your SingleCellExperiment object. You are the only one who has that object and can check, so I would recommend you look at colData(spe) to figure it out.

Login before adding your answer.

Traffic: 632 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6