cole-trapnell-lab / garnett

Automated cell type classification
MIT License
99 stars 24 forks source link

Unable to access pData/fData #20

Closed ccruizm closed 4 years ago

ccruizm commented 4 years ago

Hi there,

I have an issue after classifying my cells using classify_cells. When I want to access the pData, I have found the next error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'fData' for signature '"CellDataSet"'
Traceback:

1. head(fData(gbm_cds))
2. fData(gbm_cds)
3. (function (classes, fdef, mtable) 
 . {
 .     methods <- .findInheritedMethods(classes, fdef, mtable)
 .     if (length(methods) == 1L) 
 .         return(methods[[1L]])
 .     else if (length(methods) == 0L) {
 .         cnames <- paste0("\"", vapply(classes, as.character, 
 .             ""), "\"", collapse = ", ")
 .         stop(gettextf("unable to find an inherited method for function %s for signature %s", 
 .             sQuote(fdef@generic), sQuote(cnames)), domain = NA)
 .     }
 .     else stop("Internal error in finding inherited methods; didn't return a unique method", 
 .         domain = NA)
 . })(list(structure("CellDataSet", package = "monocle")), new("standardGeneric", 
 .     .Data = function (x) 
 .     standardGeneric("fData"), generic = structure("fData", package = "monocle3"), 
 .     package = "monocle3", group = list(), valueClass = character(0), 
 .     signature = "x", default = NULL, skeleton = (function (x) 
 .     stop("invalid call in method dispatch to 'fData' (no default method)", 
 .         domain = NA))(x)), <environment>)
4. stop(gettextf("unable to find an inherited method for function %s for signature %s", 
 .     sQuote(fdef@generic), sQuote(cnames)), domain = NA)

This is the structure of my data:

CellDataSet (storageMode: environment)
assayData: 32738 features, 4002 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: AAACCCACAGTCGCTG-1 AAACCCACAGTGTATC-1 ...
    TTTGTTGAGGTCGTGA-1 (4002 total)
  varLabels: Size_Factor garnett_cluster cell_type cluster_ext_type
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  

I do not understand where the issue is. When I check the object obtained after training the classifier, the data class is the same (CellDataSet (storageMode: environment)) and I am able to access with pData the varLabels: size factors stored in that object.

P.S. I have tried to access the small dataset included in the package but wasn't able to load the mat object. I checked the GitHub repository and the exprs.txt doesn't exist.

Thanks for your help!

rebeccagj commented 4 years ago

I am having this issue also. My suspicion is this might have something to do with Monocle 2 "CellDataSet" objects not being compatible with Monocle 3 "cell_data_set" objects for which pData and fData are written. Of course, we can always hard code the data that pData would call (eg, table(cds@phenoData@data$cell_type) instead of table(pData(cds)$cell_type), but this is less ideal.

Would appreciate a comment or workaround from the authors if there is a better alternative than what I have suggested.

hpliner commented 4 years ago

Hello, I suspect that you're right that this is a conflict between monocle2 and monocle3. I have just updated the Garnett website to have separate instructions for those using Monocle2 versus monocle3. Try using one or the other of the instructions and making sure that you don't have both monocle and monocle3 loaded.

Also, fixed the small dataset issue!

rebeccagj commented 4 years ago

Hi Hannah, thanks for your reply! I'll have a look at the updates to the website. I've been working on building my reference for Garnett and am optimizing that, but other than that have the pipeline working. (:

hpliner commented 4 years ago

Great! I will close this now, if either of you find that there is still an issue, please reopen!

kinali commented 3 years ago

Hello, I suspect that you're right that this is a conflict between monocle2 and monocle3. I have just updated the Garnett website to have separate instructions for those using Monocle2 versus monocle3. Try using one or the other of the instructions and making sure that you don't have both monocle and monocle3 loaded.

Also, fixed the small dataset issue!

I am getting the same error. However, I want to use both monocle and monocle3 since there is no plot_pseudotime_heatmap() function in monocle3. How can I solve this?