As directed in the Monocle 2 Documentation, the cellDataSet constructor is called on a sparse matrix and two AnnotatedDataFrames. Here is the suggested usage:
pd <- new("AnnotatedDataFrame", data = sample_sheet)
fd <- new("AnnotatedDataFrame", data = gene_annotation)
cds <- newCellDataSet(expr_matrix, phenoData = pd, featureData = fd)
Below, I show the matrix I am working with and the two AnnotatedDataFrames. When I attempt to create the new CellDataSet, I get an error that refers to the assayData parameter of CellDataSet's parent class, ExpressionSet. However, as far as I can tell, the assayData parameter (which is of type AnnotatedDataFrame) is replaced by a sparse matrix in Monocle 2's CellDataSet, so this error is cryptic.
> head(combined_mat_trimmed)
6 x 904 sparse Matrix of class "dgCMatrix"
[[ suppressing 51 column names ‘Edge1_AAACGGGGTACCGTTA’, ‘Edge1_AAACGGGTCTGGCGAC’, ‘Edge1_AAAGATGAGCCTCGTG’ ... ]]
RP11-791M20.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ARIH2OS . 2 . . . . . . . . 1 . . . . 1 . . . . . 1 1 1 . . . . . . . . . 1 . . . . 1 . . . . . 1 . . . . .
RP11-5P4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RP11-561E1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROSC 1 . . . . 1 1 . . 1 . 1 . 1 . 4 2 1 . 2 1 . 1 2 . . 2 . 2 1 3 . . 5 . . 3 . 1 2 1 1 3 3 1 1 . 4 . 3
RP11-744I24.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RP11-791M20.1 . ......
ARIH2OS . ......
RP11-5P4.3 . ......
RP11-561E1.1 . ......
PROSC 1 ......
RP11-744I24.3 . ......
.....suppressing columns in show(); maybe adjust 'options(max.print= *, width = *)'
..............................
> head(fd)
An object of class 'AnnotatedDataFrame'
rowNames: RP11-34P13.7 FO538757.2 ... RP11-206L10.9 (6 total)
varLabels: System
varMetadata: labelDescription
> head(pd)
An object of class 'AnnotatedDataFrame'
rowNames: Edge1_AAACGGGGTACCGTTA Edge1_AAACGGGTCTGGCGAC ... Edge1_AAAGTAGCAGCTCGAC (6 total)
varLabels: Replicate
varMetadata: labelDescription
> colonTumor <- newCellDataSet(combined_mat_trimmed, phenoData=pd, featureData=fd)
Error in validObject(.Object) :
invalid class “CellDataSet” object: featureNames differ between assayData and featureData
In addition: Warning messages:
1: In newCellDataSet(combined_mat_trimmed, phenoData = pd, featureData = fd) :
Warning: featureData must contain a column verbatim named 'gene_short_name' for certain functions
2: In newCellDataSet(combined_mat_trimmed, phenoData = pd, featureData = fd) :
Warning: featureData must contain a column verbatim named 'gene_short_name' for certain functions
3: In newCellDataSet(combined_mat_trimmed, phenoData = pd, featureData = fd) :
Warning: featureData must contain a column verbatim named 'gene_short_name' for certain functions
2 answers
turned out that fd was prepared based on a bad matrix. Issue resolved!
Hello ! I am really glad to log in and meet you here .Now ,I have the same question here .I am very curiosity of how do you figure out the question.Really hope for your response ! Bast wishes to you !
Log in to answer this question.