Run model to compute pathway enrichments. Can model inter-pathway relations, cross-validation and much more.
pareg(
df_genes,
df_terms,
lasso_param = NA_real_,
network_param = NA_real_,
term_network = NULL,
cv = FALSE,
cv_cores = NULL,
family = beta,
response_column_name = "pvalue",
max_iterations = 1e+05,
lasso_param_range = seq(0, 2, length.out = 10),
network_param_range = seq(0, 500, length.out = 10),
log_level = NULL,
...
)
Dataframe storing gene names and DE p-values.
Dataframe storing pathway database.
Lasso regularization parameter.
Network regularization parameter.
Term similarity network as adjacency matrix.
Estimate best regularization parameters using cross-validation.
How many cores to use for CV parallelization.
Distribution family of response.
Which column of model dataframe to use as response.
How many iterations to maximally run optimizer for.
LASSO regularization parameter search space in grid search of CV.
Network regularization parameter search space in grid search of CV.
Control verbosity (logger::INFO, logger::DEBUG, ...).
Further arguments to pass to `(cv.)edgenet`.
An object of class pareg
.
df_genes <- data.frame(
gene = paste("g", 1:20, sep = ""),
pvalue = c(
rbeta(10, .1, 1),
rbeta(10, 1, 1)
)
)
df_terms <- rbind(
data.frame(
term = "foo",
gene = paste("g", 1:10, sep = "")
),
data.frame(
term = "bar",
gene = paste("g", 11:20, sep = "")
)
)
pareg(df_genes, df_terms, max_iterations = 10)
#> $obj
#> $beta
#> pvalue
#> foo.member -0.5752621
#> bar.member -0.7534750
#>
#> $alpha
#> [1] -0.723709
#>
#> $gamma
#> NULL
#>
#> $dispersion
#> NULL
#>
#> $parameters
#> lambda psigx psigy
#> 0 0 0
#>
#> $lambda
#> [1] 0
#>
#> $psigx
#> [1] 0
#>
#> $psigy
#> [1] 0
#>
#> $loss_hist
#> $loss_hist[[1]]
#> $loss_hist[[1]]$likelihood
#> [1] -2.609012
#>
#> $loss_hist[[1]]$lasso
#> [1] 0
#>
#> $loss_hist[[1]]$total_loss
#> [1] -2.609012
#>
#>
#> $loss_hist[[2]]
#> $loss_hist[[2]]$likelihood
#> [1] -2.79624
#>
#> $loss_hist[[2]]$lasso
#> [1] 0
#>
#> $loss_hist[[2]]$total_loss
#> [1] -2.79624
#>
#>
#> $loss_hist[[3]]
#> $loss_hist[[3]]$likelihood
#> [1] -2.979803
#>
#> $loss_hist[[3]]$lasso
#> [1] 0
#>
#> $loss_hist[[3]]$total_loss
#> [1] -2.979803
#>
#>
#> $loss_hist[[4]]
#> $loss_hist[[4]]$likelihood
#> [1] -3.159598
#>
#> $loss_hist[[4]]$lasso
#> [1] 0
#>
#> $loss_hist[[4]]$total_loss
#> [1] -3.159598
#>
#>
#> $loss_hist[[5]]
#> $loss_hist[[5]]$likelihood
#> [1] -3.335522
#>
#> $loss_hist[[5]]$lasso
#> [1] 0
#>
#> $loss_hist[[5]]$total_loss
#> [1] -3.335522
#>
#>
#> $loss_hist[[6]]
#> $loss_hist[[6]]$likelihood
#> [1] -3.507481
#>
#> $loss_hist[[6]]$lasso
#> [1] 0
#>
#> $loss_hist[[6]]$total_loss
#> [1] -3.507481
#>
#>
#> $loss_hist[[7]]
#> $loss_hist[[7]]$likelihood
#> [1] -3.675401
#>
#> $loss_hist[[7]]$lasso
#> [1] 0
#>
#> $loss_hist[[7]]$total_loss
#> [1] -3.675401
#>
#>
#> $loss_hist[[8]]
#> $loss_hist[[8]]$likelihood
#> [1] -3.839211
#>
#> $loss_hist[[8]]$lasso
#> [1] 0
#>
#> $loss_hist[[8]]$total_loss
#> [1] -3.839211
#>
#>
#> $loss_hist[[9]]
#> $loss_hist[[9]]$likelihood
#> [1] -3.998846
#>
#> $loss_hist[[9]]$lasso
#> [1] 0
#>
#> $loss_hist[[9]]$total_loss
#> [1] -3.998846
#>
#>
#> $loss_hist[[10]]
#> $loss_hist[[10]]$likelihood
#> [1] -4.154269
#>
#> $loss_hist[[10]]$lasso
#> [1] 0
#>
#> $loss_hist[[10]]$total_loss
#> [1] -4.154269
#>
#>
#>
#> $stopping_reason
#> [1] "max_iterations"
#>
#> $pseudo_r_squared
#> [,1]
#> pvalue 0.6578053
#>
#> $mse
#> [1] 0.1170787
#>
#> $model
#> Model: "r_model_32"
#> ________________________________________________________________________________
#> Layer (type) Output Shape Param #
#> ================================================================================
#> Total params: 3
#> Trainable params: 3
#> Non-trainable params: 0
#> ________________________________________________________________________________
#>
#> $family
#> $family
#> [1] "beta"
#>
#> $link
#> [1] "logit"
#>
#> $linkfun
#> function (mu)
#> .Call(C_logit_link, mu)
#> <environment: namespace:stats>
#>
#> $linkinv
#> function (x)
#> 1/(1 + cast_float(tf$exp(-x)))
#> <bytecode: 0x7fd2edb5e488>
#> <environment: namespace:pareg>
#>
#> $loss
#> function (y, mu_hat, phi_hat, ...)
#> {
#> beta.loss(y, mu_hat, tf$ones(tf$shape(mu_hat)), ...)
#> }
#> <bytecode: 0x7fd30aec0800>
#> <environment: 0x7fd304bc22a8>
#>
#> $secondary_linkinv
#> NULL
#>
#> attr(,"class")
#> [1] "pareg.family"
#>
#> $call
#> fit_func(X = X, Y = Y, G.X = term_network, lambda = lasso_param,
#> psigx = network_param, psigy = 0, maxit = max_iterations,
#> family = family)
#>
#> attr(,"class")
#> [1] "beta.edgenet" "edgenet"
#>
#> $df_genes
#> gene pvalue
#> 1 g1 7.451128e-02
#> 2 g2 1.061844e-02
#> 3 g3 1.968323e-11
#> 4 g4 1.498321e-03
#> 5 g5 4.063008e-09
#> 6 g6 5.962183e-16
#> 7 g7 5.051918e-24
#> 8 g8 6.452519e-03
#> 9 g9 3.784457e-03
#> 10 g10 4.510034e-06
#> 11 g11 9.144835e-01
#> 12 g12 8.516346e-02
#> 13 g13 2.856287e-01
#> 14 g14 6.578151e-01
#> 15 g15 2.954903e-01
#> 16 g16 9.623416e-01
#> 17 g17 7.389104e-02
#> 18 g18 2.563478e-01
#> 19 g19 3.656874e-01
#> 20 g20 3.351051e-01
#>
#> $df_terms
#> term gene
#> 1 foo g1
#> 2 foo g2
#> 3 foo g3
#> 4 foo g4
#> 5 foo g5
#> 6 foo g6
#> 7 foo g7
#> 8 foo g8
#> 9 foo g9
#> 10 foo g10
#> 11 bar g11
#> 12 bar g12
#> 13 bar g13
#> 14 bar g14
#> 15 bar g15
#> 16 bar g16
#> 17 bar g17
#> 18 bar g18
#> 19 bar g19
#> 20 bar g20
#>
#> $term_network
#> NULL
#>
#> $covariates
#> [1] "foo.member" "bar.member"
#>
#> $X
#> foo.member bar.member
#> [1,] TRUE FALSE
#> [2,] TRUE FALSE
#> [3,] TRUE FALSE
#> [4,] TRUE FALSE
#> [5,] TRUE FALSE
#> [6,] TRUE FALSE
#> [7,] TRUE FALSE
#> [8,] TRUE FALSE
#> [9,] TRUE FALSE
#> [10,] TRUE FALSE
#> [11,] FALSE TRUE
#> [12,] FALSE TRUE
#> [13,] FALSE TRUE
#> [14,] FALSE TRUE
#> [15,] FALSE TRUE
#> [16,] FALSE TRUE
#> [17,] FALSE TRUE
#> [18,] FALSE TRUE
#> [19,] FALSE TRUE
#> [20,] FALSE TRUE
#>
#> $Y
#> pvalue
#> [1,] 0.09578572
#> [2,] 0.03508752
#> [3,] 0.02500000
#> [4,] 0.02642340
#> [5,] 0.02500000
#> [6,] 0.02500000
#> [7,] 0.02500000
#> [8,] 0.03112989
#> [9,] 0.02859523
#> [10,] 0.02500428
#> [11,] 0.89375928
#> [12,] 0.10590529
#> [13,] 0.29634724
#> [14,] 0.64992433
#> [15,] 0.30571583
#> [16,] 0.93922455
#> [17,] 0.09519649
#> [18,] 0.26853040
#> [19,] 0.37240305
#> [20,] 0.34334980
#>
#> $response_column_name
#> [1] "pvalue"
#>
#> $cv
#> [1] FALSE
#>
#> $params
#> $params$lasso_param
#> [1] 0
#>
#> $params$network_param
#> [1] 0
#>
#>
#> attr(,"class")
#> [1] "pareg"