FloWuenne / scFunctions

Functions for single cell data analysis
23 stars 9 forks source link

auc_thresh_kmeans Error: unable to find an inherited method for function ‘mutate’ for signature ‘"data.frame"’ #1

Closed Sophia409 closed 4 years ago

Sophia409 commented 4 years ago

Hi, Thank you for your work. I got an error at the first step.What's the reason?

> regulonAUC <- importAUCfromText(file.path(pyScenicDir,  "auc.tsv"))
> number_of_regulon_clusters <- 28
> ## Binary regulons
> kmeans_thresholds <- auc_thresh_kmeans(regulonAUC)
[1] "Processing regulon diProgress:   1%  Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘mutate’ for signature ‘"data.frame"’
> traceback()
11: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
        sQuote(fdef@generic), sQuote(cnames)), domain = NA)
10: (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("data.frame"), new("standardGeneric", .Data = function (object, 
        ...) 
    standardGeneric("mutate"), generic = "mutate", package = "scater", 
        group = list(), valueClass = character(0), signature = "object", 
        default = NULL, skeleton = (function (object, ...) 
        stop("invalid call in method dispatch to 'mutate' (no default method)", 
            domain = NA))(object, ...)), <environment>)
9: mutate(., cluster = gsub(2, 3, cluster))
8: function_list[[i]](value)
7: freduce(value, `_function_list`)
6: `_fseq`(`_lhs`)
5: eval(quote(`_fseq`(`_lhs`)), env, env)
4: eval(quote(`_fseq`(`_lhs`)), env, env)
3: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
2: df %>% mutate(cluster = gsub(2, 3, cluster)) %>% mutate(cluster = gsub(1, 
       2, cluster)) %>% mutate(cluster = gsub(3, 1, cluster))
1: auc_thresh_kmeans(regulonAUC)
> regulonAUC
AUC for 310 regulons (rows) and 27007 cells (columns).

Top-left corner of the AUC matrix:
               cells
regulons        E11-1_CTTAGGATCGACAGCC E11-1_TGACTAGCATAAAGGT E11-1_TTCGGTCAGATGAGAG
  AU041133 (7g)            0.000000000            0.000000000            0.000000000
  Ahr (16g)                0.000000000            0.000000000            0.000000000
  Ar (137g)                0.001198745            0.004568314            0.002050244
  Arid3a (31g)             0.064171754            0.039857574            0.050370145
  Arnt (6g)                0.000000000            0.000000000            0.000000000
  Arx (168g)               0.061808244            0.026720226            0.039475101
               cells
regulons        E11-2_AAGTCGTTCGAGTTGT E11-2_AATCGTGCAATCTCGA
  AU041133 (7g)            0.000000000            0.000000000
  Ahr (16g)                0.000000000            0.000000000
  Ar (137g)                0.001136217            0.001351098
  Arid3a (31g)             0.055342567            0.077449389
  Arnt (6g)                0.000000000            0.000000000
  Arx (168g)               0.067715879            0.095272387