MOFA2 icon indicating copy to clipboard operation
MOFA2 copied to clipboard

matrix.please function not found

Open jiangfuqing opened this issue 2 years ago • 3 comments

Hi, when I run scripts as belows: " msgidb.matrix <- msigdbr( species = "Mus musculus", # Homo sapiens category = "C5", subcategory = "BP" ) %>% as.data.table %>% .[,id:=1] %>% dcast(gs_name~gene_symbol, value.var="id", fill=0) %>% matrix.please " I got an error: " Error in matrix.please(.) : could not find function "matrix.please" " Thanks!

jiangfuqing avatar May 20 '22 09:05 jiangfuqing

This is a function that converts a data.frame into a matrix:

matrix.please <-function(x) {
  m<-as.matrix(x[,-1])
  rownames(m)<-x[[1]]
  m
}

rargelaguet avatar May 20 '22 11:05 rargelaguet

Got it, thanks!

jiangfuqing avatar May 21 '22 13:05 jiangfuqing

Hi, when I run scripts as belows: gsea.positive <- run_enrichment(mofa, feature.sets = msgidb.matrix, view = "RNA", sign = "positive" ) I got an error: Error in run_enrichment(mofa, feature.sets = msgidb.matrix, view = "RNA", : feature.sets has to be a list or a binary matrix. Any suggestion is welcomed, thanks!

jiangfuqing avatar May 22 '22 10:05 jiangfuqing