error in monocle.
1
0
Entering edit mode
ikwak • 0
@ikwak-11289
Last seen 4.5 years ago

I am analyzing a scRNAseq data and having error messages like this. 

Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing
In addition: Warning message:
Deprecated, use tibble::rownames_to_column() instead. 

 

May I have some advice to handle this error?

Thank you so much!! 

 

#### codes : 

 

## X is a count data (gene by cell)

> X <- X[rowSums(X > 0) >= 2, , drop = FALSE]
> pX <- X
> colpX <- colnames(pX)

> library(DESeq2) # normalize cells using
> sf <- estimateSizeFactorsForMatrix(pX)
> npX <- t(t(pX) / sf ) ## normalization using size factor.
> lnpX <- log(npX+1, 10)

> colpXc <- colnames(pX)
> library(monocle)
> pD <- data.frame(cellname = colpX, time= timelab)
> rownames(pD) <- paste("C", 1:ncol(pX), sep = "")

> fD <- data.frame(genename = rownames(pX), num_cells_expressed = rowSums(pX !=0) )
> rownames(fD) <-rownames(pX)
> colnames(pX) <- rownames(pD)

> pd <- new("AnnotatedDataFrame", data = pD)
> fd <- new("AnnotatedDataFrame", data = fD)

> pXX <- newCellDataSet(pX, phenoData = pd, featureData = fd)

## Here I used Census on normalized read count. Would it be the reason for this error? 

> rpc_matrix <- relative2abs(pXX)

> pXX <- newCellDataSet(as(as.matrix(rpc_matrix), "sparseMatrix"),
+                        phenoData = pd,
+                        featureData = fd,
+                        lowerDetectionLimit=1,
+                        expressionFamily=negbinomial.size())

> pXX <- estimateSizeFactors(pXX)
> pXX <- estimateDispersions(pXX)
Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) : 
  invalid character indexing
In addition: Warning message:
Deprecated, use tibble::rownames_to_column() instead. 

monocle • 1.6k views
ADD COMMENT
0
Entering edit mode
driver.ian • 0
@driverian-12664
Last seen 4.5 years ago

You have one or more cells that is essentially empty (most likely):

Do something like this first and you won't get the error:

X <- X[,colSums(X) > 100]

The number doesn't have to be 100 but the total counts for a cell should be higher than that, so just get rid of empty cells before anything else. 

ADD COMMENT

Login before adding your answer.

Traffic: 224 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