This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CellScatter function Seurat not working

Hi all,

I am trying to plot the average gene expression of two clusters within my single cell RNAseq data using the CellScatter function (Seurat). I followed the exact steps of the vignette, however my plot looks like a black square sheet of evenly distributed cells instead of a proper cell scatter. Here is the code:

#Calculate the average gene expression within clusters to plot

cluster.averages <- AverageExpression(thymus)
head(cluster.averages[["RNA"]][, 1:3])


#Return this information as a Seurat object (enables downstream plotting and analysis) First,replace spaces with underscores '_' so ggplot2 doesn't fail
orig.levels <- levels(thymus)
Idents(thymus) <- gsub(pattern = " ", replacement = "_", x = Idents(thymus))
orig.levels <- gsub(pattern = " ", replacement = "_", x = orig.levels)
levels(thymus) <- orig.levels
cluster.averages <- AverageExpression(thymus, return.seurat = TRUE)
cluster.averages

#How can I plot the average expression of cluster 1 vs. cluster 2? Pass do.hover = T for an interactive plot to identify gene outliers
CellScatter(cluster.averages, cell1 = "1", cell2 = "2")

In my data I have three clusters named 1-3. I am trying to plot the average gene expression of cluster 1 against cluster 2. Any idea what I might have done wrong? I wanted to post an image of the plot I am now getting but not sure how to. Sorry, I am still quite new!

Many thanks in advance, Florencia

seurat cellscatter scrna-seq

Can you post the output of head(cluster.averages[["RNA"]][, 1:3]) and cluster.averages?

Hi geek_y,

Of course:

> head(cluster.averages[["RNA"]][, 1:3])
6 x 3 sparse Matrix of class "dgCMatrix"
                 1           2          3
A1BG    0.14812722 0.178343100 0.12386361
A1CF    0.02273091 0.006427456 0.06277195
A2M-AS1 0.02273091 0.073081493 .         
AAAS    0.68124170 0.480231933 0.72484221
AACSP1  .          0.065723290 0.06052527
AACS    0.05213810 0.122433900 .  

> cluster.averages
An object of class Seurat 
12013 features across 3 samples within 1 assay 
Active assay: RNA (12013 features)

Hope this brings some clarification!

Kind regards, Florencia

Oeh, I see the output of head(cluster.averages[["RNA"]][, 1:3]) got a bit mixed up:

                 1           2          3
A1BG    0.14812722 0.178343100 0.12386361
A1CF    0.02273091 0.006427456 0.06277195
A2M-AS1 0.02273091 0.073081493 .         
AAAS    0.68124170 0.480231933 0.72484221
AACSP1  .          0.065723290 0.06052527
AACS    0.05213810 0.122433900 .

I don't see any problem with the data format. Did you see clear clusters with tSNE or UMAP before taking the average of gene expression for each cluster ? Here is a guideline on how to add images in biostars.

Thank you for the link to the guideline for images, geek_y!

I indeed could distinguish clear clusters to my opinion (although I only had a little more than 300 cells).

Here's my attempt to posting images then:

this is what my tSNE looks like

this is what the cell scatter plot looks like

Many cheers again for your time, Florencia

0 answers

No answers yet.

Log in to answer this question.