HectorRDB / condiments

Trajectory inference across multiple conditions with condiments: differential topology, progression, differentiation, and expression
https://hectorrdb.github.io/condiments/
Other
16 stars 1 forks source link

error for running 'imbalance_score' function #20

Closed dahun73 closed 7 months ago

dahun73 commented 1 year ago

Hello :)

I'm new user for condiments package. I'm trying to follow tutorial using my data now. To compare imbalance score between different conditions, I tried using 'imbalance_score' function. However, error came out and I can not which one is wrong.

scores <- imbalance_score(rd = reducedDims(sce)$UMAP,
                          cl = colData(sce)$stim,
                          k=10, smooth = 10)

I annotated two conditions for name as 'stim'.

Following error is:

scores <- condiments::imbalance_score(rd = reducedDims(sce)$UMAP,
+                           cl = colData(sce)$stim,
+                           k=10, smooth = 10)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'imbalance_score' for signature '"missing"'

Is there any suggestion about this..?

Thanks

Dahun

yudibedi commented 10 months ago

What was the solution to this? I'm running in to the same issue

HectorRDB commented 10 months ago

HI, could you share the traceback() of that error?

yudibedi commented 10 months ago

HI, could you share the traceback() of that error?

3: stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) 2: (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("missing", package = "methods")), new("nonstandardGenericFunction", .Data = function (Object, ...) { standardGeneric("imbalance_score") }, generic = structure("imbalance_score", package = "condiments"), package = "condiments", group = list(), valueClass = character(0), signature = "Object", default = NULL, skeleton = (function (Object, ... 1: imbalance_score(rd = reducedDims(sce_all)$UMAP, cl = colData(sce_all)$age_inj, k = 20, smooth = 40)

HectorRDB commented 10 months ago

Can you tell me the output of

is(reducedDims(sce)$UMAP)
is(colData(sce)$stim)
yudibedi commented 10 months ago

is(reducedDims(sce_all)$UMAP) [1] "matrix" "array"
[3] "mMatrix" "AnyMatrix"
[5] "input" "mpinput"
[7] "listI" "output"
[9] "structure" "matrix_OR_array_OR_table_OR_numeric" [11] "vector" "vector_OR_factor"
[13] "vector_OR_Vector"

is(colData(sce_all)$stim) [1] "NULL" "OptionalFunction" "optionalMethod" "OptionalList"
[5] "OptionalCharacter" "character_OR_NULL" "DataFrame_OR_NULL" "Constraint_OR_NULL" [9] "data.frameOrNULL" "integer_OR_NULL" "Assays_OR_NULL" "output"

Thanks for the help :)

HectorRDB commented 9 months ago

As you can see, colData(sce_all)$stim is null. You are not providing a condition vector. Hope this helps.