0
$\begingroup$

I run plotPCA for single cell RNA-seq data, while I get error message (I use R 4.0). I attached the code and error message here. Did anyone know the reason and how to deal with it. Thanks!

library(pcaMethods)
library(SC3)
library(scater)
library(SingleCellExperiment)
library(pheatmap)
library(mclust)
set.seed(1234567)
deng <- readRDS("deng-reads.rds")
plotPCA(deng, colour_by = "cell_type2")
Error in value[[3L]](cond) : invalid subscript 'type' in 'reducedDimNames(<SingleCellExperiment>)'
'PCA' not in 'reducedDimNames(<SingleCellExperiment>)'

I also get error message when I run the code as below:

colData(deng)$tSNE_kmeans <- as.character(kmeans(deng@reducedDims$TSNE, centers = 8)$clust)
# Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), : 'data' must be of a vector type, was 'NULL'
$\endgroup$
1
  • $\begingroup$ I solve the first error for PCA, while have no idea about the second one. Does anyone have any suggestion? $\endgroup$
    – Yach
    Commented May 25, 2020 at 9:22

1 Answer 1

1
$\begingroup$

The error is pretty obvious. There is no PCA data in the respective slot of the SingleCellExperiment that plotPCA could use, at least it is not called PCA which by default is expected. Use runPCA first, please read the manuals of scater and scran first, they have step-by-step code.

$\endgroup$
3
  • $\begingroup$ Thank you for your reminding. I follow a tutorial from Sanger institute and they use plotPCA(deng, colour_by = "cell_type2") without error message. While the newest scater package may have litter difference. However now I make it work and please see below: deng <- runPCA(deng) plotReducedDim(deng, "PCA", colour_by="cell_type2") $\endgroup$
    – Yach
    Commented May 25, 2020 at 8:27
  • $\begingroup$ If you follow tutorials and refer to them then please provide a link. $\endgroup$
    – user3051
    Commented May 25, 2020 at 8:45
  • $\begingroup$ Here is the link: scrnaseq-course.cog.sanger.ac.uk/website/… $\endgroup$
    – Yach
    Commented May 25, 2020 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.