compute TF (term/feature frequency), IDF (inverse document/cell frequency), IAE (inverse average expression of features) and combine the the final score

cal_score(
  data,
  tf = c("logtf", "tf"),
  idf = "prob",
  iae = "prob",
  slot = "counts",
  new.slot = "score",
  par.idf = NULL,
  par.iae = NULL,
  return.intermediate = FALSE
)

# S4 method for class 'AnyMatrix'
cal_score(
  data,
  tf = c("logtf", "tf"),
  idf = "prob",
  iae = "prob",
  par.idf = NULL,
  par.iae = NULL,
  return.intermediate = FALSE
)

# S4 method for class 'SummarizedExperiment'
cal_score(
  data,
  tf = c("logtf", "tf"),
  idf = "prob",
  iae = "prob",
  slot = "counts",
  new.slot = "score",
  par.idf = NULL,
  par.iae = NULL,
  return.intermediate = FALSE
)

Arguments

data

an expression object, can be matrix or SummarizedExperiment

tf

a character, specify the TF method to use, can be "tf" or "logtf"

idf

a character, specify the IDF method to use. Available methods can be accessed using idf_iae_methods()

iae

a character, specify the IAE method to use. Available methods can be accessed using idf_iae_methods()

slot

a character, specify which slot to use when data is se object, optional, default 'counts'

new.slot

a character, specify the name of slot to save score in se object, optional, default 'score'

par.idf

other parameters for specified IDF methods

par.iae

other parameters for specified IAE methods

return.intermediate

logical, if TRUE also return or store the intermediate tf, idf and iae matrices. Defaults to FALSE since these objects have the same dimension as the input expression matrix and can dominate memory usage on large datasets. Set to TRUE to restore the pre-1.7.3 behavior where intermediates were kept in metadata() of the SummarizedExperiment output.

Value

A list of matrices or se object containing combined score

Examples

data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
cal_score(
  data,
  par.idf = list(label = sample(c("A", "B"), 10, replace = TRUE)),
  par.iae = list(label = sample(c("A", "B"), 10, replace = TRUE))
)
#> $score
#>           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
#> 1  0.000000000 0.18618653 0.02960180 0.00000000 0.08300503 0.09276966
#> 2  0.050888286 0.02020637 0.11439924 0.01692968 0.02237954 0.01898171
#> 3  0.023409441 0.00000000 0.12148969 0.01137960 0.01504282 0.01275891
#> 4  0.017897053 0.02020637 0.03964861 0.03299123 0.02237954 0.03687876
#> 5  0.000000000 0.02096390 0.19990978 0.03422806 0.00000000 0.03826134
#> 6  0.022516683 0.01306411 0.16405236 0.02132997 0.02133371 0.03478901
#> 7  0.191259547 0.11096823 0.00000000 0.26508298 0.18121126 0.10424271
#> 8  0.009392569 0.00000000 0.13772728 0.04028299 0.03298304 0.02823926
#> 9  0.087140869 0.03460130 0.06830973 0.02899031 0.09111642 0.00000000
#> 10 0.289617166 0.51264572 0.02422841 0.09635080 0.06482064 0.10802937
#>           [,7]       [,8]       [,9]      [,10]
#> 1  0.110094470 0.11269645 0.08539412 0.18559594
#> 2  0.015278123 0.02320025 0.11437677 0.03964861
#> 3  0.020061346 0.00000000 0.06251915 0.08256106
#> 4  0.015278123 0.04480027 0.05887038 0.11439924
#> 5  0.030964609 0.02407002 0.12439648 0.12442092
#> 6  0.009877832 0.00000000 0.31075029 0.05685745
#> 7  0.383751152 0.12740985 0.01406699 0.01857648
#> 8  0.015663351 0.02351167 0.10429364 0.20266751
#> 9  0.051107646 0.11131707 0.06829632 0.00000000
#> 10 0.086951378 0.13203806 0.00000000 0.01646496
#>