Skip to contents
  • If center is true, then the expression values are centered by the mean of expression across the samples.

Usage

.fit_preprocessing(network, mat, center, na.rm, sparse)

Arguments

network

Tibble or dataframe with edges and it's associated metadata.

mat

Matrix to evaluate (e.g. expression matrix). Target nodes in rows and conditions in columns. rownames(mat) must have at least one intersection with the elements in network .target column.

center

Logical value indicating if mat must be centered by base::rowMeans().

na.rm

Should missing values (including NaN) be omitted from the calculations of base::rowMeans()?

sparse

Deprecated parameter.

Value

A named list of matrices to evaluate in methods that fit models, like .mlm_analysis().

  • mat: Features as rows and samples as columns.

  • mor_mat: Features as rows and columns as source.

Examples

inputs_dir <- system.file("testdata", "inputs", package = "decoupleR")
mat <- readRDS(file.path(inputs_dir, "mat.rds"))
net <- readRDS(file.path(inputs_dir, "net.rds"))
net <- rename_net(net, source, target, mor)
.fit_preprocessing(net, mat, center = FALSE, na.rm = FALSE, sparse = FALSE)
#> $mat
#>            S01       S02       S03        S04        S05        S06        S07
#> G01 9.37095845 9.3888607 9.8951935  8.7844590 8.43144620 8.36723464 8.62351816
#> G02 8.56469817 8.2787888 8.4304691  8.8509076 8.65564788 8.18523056 8.95352336
#> G03 8.36312841 8.1333213 8.2572694 10.4142076 8.32192527 8.58182373 8.54282881
#> G04 8.63286260 8.6359504 9.7631631  8.0361226 8.78383894 9.39973683 8.58099650
#> G05 0.40426832 0.2842529 0.4600974  0.2059986 1.57572752 0.72729206 0.76817874
#> G06 0.10612452 2.6564554 0.6399949  0.3610573 0.64289931 1.30254263 0.46376759
#> G07 1.51152200 2.4404669 0.4554501  0.7581632 0.08976065 0.33584812 0.88577630
#> G08 0.09465904 1.3201133 0.7048373  0.7267048 0.27655075 1.03850610 1.09978090
#> G09 2.01842371 0.3066386 1.0351035  1.3682810 0.67928882 0.92072857 1.51270701
#> G10 0.06271410 1.7813084 0.6089264  0.4328180 0.08983289 0.72087816 0.25792144
#> G11 1.30486965 0.1719174 0.5049551  0.8113932 2.99309008 1.04311894 0.08844023
#> G12 2.28664539 1.2146747 1.7170087  1.4441013 0.28488295 0.09018639 0.12089654
#>           S08       S09       S10         S11        S12       S13         S14
#> G01 9.1943289 9.1317387 8.1881930 9.493625067 8.00006288 0.4138688 0.007762034
#> G02 8.6119969 9.4592140 8.1191610 9.470435741 9.12288964 1.1133860 0.800282178
#> G03 8.2171398 8.0799826 8.0250926 8.124702386 9.43985574 0.4809928 0.533492330
#> G04 8.1827567 8.6532043 8.1080727 8.996639135 9.09711377 0.4331690 1.287675246
#> G05 0.9333463 1.2009654 0.4854352 0.001822614 0.11731956 8.6968626 8.175525870
#> G06 0.8217731 1.0447511 0.5042171 0.428258881 1.20149840 9.0563684 9.071782384
#> G07 1.3921164 1.0032086 1.6610991 0.613671606 0.46972958 8.0406985 8.163206882
#> G08 0.4761739 1.8484819 0.3823337 2.024677845 0.05246948 9.5515448 8.362738416
#> G09 0.6503486 0.6667734 0.5126503 1.224747950 0.08610730 1.1671695 0.590013548
#> G10 1.3911105 0.1055138 2.7018910 0.179516441 0.88767902 0.2736457 1.432421928
#> G11 1.1107889 0.4222559 1.3621162 0.567620594 0.44468400 0.4678453 0.992692511
#> G12 0.8607926 0.1223502 0.1372562 0.492877354 0.02944488 1.2382523 0.454650298
#>             S15       S16       S17         S18       S19       S20         S21
#> G01 0.084898059 0.1514559 0.2526117  1.37686160 0.1320880 0.6585034  0.72921728
#> G02 0.895565582 0.5841090 1.2940025  1.15085557 1.4767874 1.2502366  0.99806891
#> G03 0.229778139 0.3688067 0.9591704  0.70582139 0.2170302 0.2717637  1.25848166
#> G04 0.836619068 0.2946543 1.0857749  1.05405578 1.2836022 0.9479520  1.24886369
#> G05 9.745055861 8.2792594 8.4037749  8.64574372 8.3856679 9.2015824  9.38063705
#> G06 9.689458921 9.3362367 8.5864875  8.18537797 8.3515129 8.4661161 10.04996069
#> G07 8.864777979 8.7007488 9.8152284  9.20122205 8.5217961 8.2693514  9.01687283
#> G08 8.150775989 8.5541966 8.1288214 10.03697217 9.0681312 8.3909654  8.02671746
#> G09 1.449007130 0.8363066 2.0009292  0.10777474 0.4283659 1.3487070  0.70360778
#> G10 0.643008700 1.5945882 0.3337772  0.08410810 0.1740182 0.0227647  0.97138523
#> G11 0.483193864 0.2049586 1.1713251  0.49561964 0.5156677 0.2442259  1.09615624
#> G12 0.006355626 0.3450880 2.0595392  0.03741519 0.2343653 0.9423717  0.04905045
#>           S22         S23        S24
#> G01 1.1984959  0.05399674 0.47039340
#> G02 0.1900190  1.06477321 1.24267027
#> G03 1.2977059  0.81319504 1.38157546
#> G04 1.0338737  0.19081647 1.20445894
#> G05 8.7384408 10.69992981 8.82407396
#> G06 8.0465639  8.06096664 9.66262940
#> G07 9.0175961  8.57375170 8.56930634
#> G08 8.3832840  8.04580358 8.63551382
#> G09 0.8727554  0.15741254 0.04372201
#> G10 0.9695450  0.43156537 0.34801230
#> G11 0.3838467  0.39654974 2.45959355
#> G12 1.8515557  1.30997823 0.81838032
#> 
#> $mor_mat
#>      T1  T2   T3
#> G01 1.0 0.0  0.0
#> G02 1.0 0.0  0.0
#> G03 0.7 0.0  0.0
#> G04 0.0 0.0  0.0
#> G05 0.0 0.0  0.0
#> G06 0.0 1.0 -0.5
#> G07 0.0 0.5 -3.0
#> G08 0.0 1.0 -1.0
#> G09 0.0 0.0  0.0
#> G10 0.0 0.0  0.0
#> G11 0.0 0.0  1.0
#> G12 0.0 0.0  0.0
#>