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
)

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

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

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

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.00000000 0.18618653 0.02960180 0.00000000 0.03597833 0.04021078
#> 2  0.15782627 0.02020637 0.11439924 0.05250617 0.06940849 0.05887038
#> 3  0.05401384 0.00000000 0.12148969 0.02625676 0.03470910 0.02943931
#> 4  0.05550639 0.02020637 0.03964861 0.10231988 0.06940849 0.11437677
#> 5  0.00000000 0.02096390 0.19990978 0.05240163 0.00000000 0.05857640
#> 6  0.11034833 0.01306411 0.16405236 0.10453255 0.10455091 0.17049178
#> 7  0.06431156 0.11096823 0.00000000 0.08913490 0.06093280 0.03505191
#> 8  0.07005452 0.00000000 0.13772728 0.30045083 0.24600417 0.21062266
#> 9  0.16759965 0.03460130 0.06830973 0.05575761 0.17524592 0.00000000
#> 10 0.08328973 0.51264572 0.02422841 0.02770910 0.01864148 0.03106769
#>           [,7]       [,8]       [,9]      [,10]
#> 1  0.110094470 0.04884800 0.08539412 0.18559594
#> 2  0.015278123 0.07195386 0.11437677 0.03964861
#> 3  0.020061346 0.00000000 0.06251915 0.08256106
#> 4  0.015278123 0.13894474 0.05887038 0.11439924
#> 5  0.030964609 0.03685012 0.12439648 0.12442092
#> 6  0.009877832 0.00000000 0.31075029 0.05685745
#> 7  0.383751152 0.04284192 0.01406699 0.01857648
#> 8  0.015663351 0.17536191 0.10429364 0.20266751
#> 9  0.051107646 0.21409820 0.06829632 0.00000000
#> 10 0.086951378 0.03797225 0.00000000 0.01646496
#> 
#> $tf
#>          [,1]       [,2]       [,3]      [,4]       [,5]       [,6]       [,7]
#> 1  0.00000000 0.23624851 0.04080533 0.0000000 0.10532349 0.11771363 0.13969676
#> 2  0.16243074 0.06449688 0.11773676 0.0540380 0.07143343 0.06058788 0.04876637
#> 3  0.11116375 0.00000000 0.11773676 0.0540380 0.07143343 0.06058788 0.09526475
#> 4  0.05712575 0.06449688 0.04080533 0.1053050 0.07143343 0.11771363 0.04876637
#> 5  0.00000000 0.06449688 0.18917019 0.1053050 0.00000000 0.11771363 0.09526475
#> 6  0.11116375 0.06449688 0.11773676 0.1053050 0.10532349 0.17175163 0.04876637
#> 7  0.11116375 0.06449688 0.00000000 0.1540714 0.10532349 0.06058788 0.22304360
#> 8  0.05712575 0.00000000 0.08001067 0.2450017 0.20060338 0.17175163 0.09526475
#> 9  0.16243074 0.06449688 0.11773676 0.0540380 0.16984119 0.00000000 0.09526475
#> 10 0.16243074 0.28751550 0.11773676 0.0540380 0.03635442 0.06058788 0.04876637
#>          [,8]       [,9]      [,10]
#> 1  0.14299835 0.11771363 0.25583932
#> 2  0.07405307 0.11771363 0.04080533
#> 3  0.00000000 0.06058788 0.08001067
#> 4  0.14299835 0.06058788 0.11773676
#> 5  0.07405307 0.11771363 0.11773676
#> 6  0.00000000 0.22301862 0.04080533
#> 7  0.07405307 0.06058788 0.08001067
#> 8  0.14299835 0.06058788 0.11773676
#> 9  0.20749523 0.11771363 0.00000000
#> 10 0.07405307 0.00000000 0.08001067
#> 
#> $idf
#>            B         B         A         B         B         B         B
#> 1  0.4122448 0.4122448 0.8754687 0.4122448 0.4122448 0.4122448 0.4122448
#> 2  0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472
#> 3  0.4122448 0.4122448 0.8754687 0.4122448 0.4122448 0.4122448 0.4122448
#> 4  0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472
#> 5  0.4122448 0.4122448 0.8754687 0.4122448 0.4122448 0.4122448 0.4122448
#> 6  0.5508310 0.5508310 0.7731899 0.5508310 0.5508310 0.5508310 0.5508310
#> 7  0.9162907 0.9162907 0.3677248 0.9162907 0.9162907 0.9162907 0.9162907
#> 8  0.5508310 0.5508310 0.7731899 0.5508310 0.5508310 0.5508310 0.5508310
#> 9  0.7429087 0.7429087 0.4177352 0.7429087 0.7429087 0.7429087 0.7429087
#> 10 0.9162907 0.9162907 0.3677248 0.9162907 0.9162907 0.9162907 0.9162907
#>            B         A         A
#> 1  0.4122448 0.8754687 0.8754687
#> 2  0.6931472 0.6931472 0.6931472
#> 3  0.4122448 0.8754687 0.8754687
#> 4  0.6931472 0.6931472 0.6931472
#> 5  0.4122448 0.8754687 0.8754687
#> 6  0.5508310 0.7731899 0.7731899
#> 7  0.9162907 0.3677248 0.3677248
#> 8  0.5508310 0.7731899 0.7731899
#> 9  0.7429087 0.4177352 0.4177352
#> 10 0.9162907 0.3677248 0.3677248
#> 
#> $iae
#>            A         B         A         A         A         A         B
#> 1  0.8286298 1.9117188 0.8286298 0.8286298 0.8286298 0.8286298 1.9117188
#> 2  1.4017985 0.4519851 1.4017985 1.4017985 1.4017985 1.4017985 0.4519851
#> 3  1.1786550 0.5108256 1.1786550 1.1786550 1.1786550 1.1786550 0.5108256
#> 4  1.4017985 0.4519851 1.4017985 1.4017985 1.4017985 1.4017985 0.4519851
#> 5  1.2070929 0.7884574 1.2070929 1.2070929 1.2070929 1.2070929 0.7884574
#> 6  1.8021222 0.3677248 1.8021222 1.8021222 1.8021222 1.8021222 0.3677248
#> 7  0.6313826 1.8777019 0.6313826 0.6313826 0.6313826 0.6313826 1.8777019
#> 8  2.2263113 0.2984930 2.2263113 2.2263113 2.2263113 2.2263113 0.2984930
#> 9  1.3888951 0.7221347 1.3888951 1.3888951 1.3888951 1.3888951 0.7221347
#> 10 0.5596158 1.9459101 0.5596158 0.5596158 0.5596158 0.5596158 1.9459101
#>            A         A         A
#> 1  0.8286298 0.8286298 0.8286298
#> 2  1.4017985 1.4017985 1.4017985
#> 3  1.1786550 1.1786550 1.1786550
#> 4  1.4017985 1.4017985 1.4017985
#> 5  1.2070929 1.2070929 1.2070929
#> 6  1.8021222 1.8021222 1.8021222
#> 7  0.6313826 0.6313826 0.6313826
#> 8  2.2263113 2.2263113 2.2263113
#> 9  1.3888951 1.3888951 1.3888951
#> 10 0.5596158 0.5596158 0.5596158
#>