Skip to contents

This function runs stabilised ICA with the defined number of components.

Usage

ica_stabilised_results(
  object,
  no_comp = NULL,
  ica_type = c("logcosh", "exp"),
  iter_params = params_ica_randomisation(),
  ica_params = params_ica_general(),
  membership_params = params_module_membership(),
  random_seed = 42L,
  consistent_sign = TRUE,
  .verbose = TRUE
)

Arguments

object

The class, see BulkCoExp(). You need to apply ica_processing() before running this function.

no_comp

Optional integer. Number of components you wish to use for the ICA run. If you have run ica_evaluate_comp() the optimal number is identified via the elbow method and will be used if set to NULL. You can overwrite this however.

ica_type

String, element of c("logcosh", "exp").

iter_params

List. This list controls the randomisation parameters for the ICA runs, see params_ica_randomisation() for estimating stability. Has the following elements:

  • cross_validate - Boolean. Shall the data be split into different chunks on which ICA is run. This will slow down the function substantially, as every chunk needs to whitened again.

  • random_init - Integer. How many random initialisations shall be used for the ICA runs.

  • folds - If cross_validate is set to TRUE how many chunks shall be used. To note, you will run per ncomp random_init * fold ICA runs which can quickly increase.

ica_params

List. The ICA parameters, see params_ica_general() wrapper function. This function generates a list containing:

  • maxit - Integer. Maximum number of iterations for ICA.

  • alpha - Float. The alpha parameter for the logcosh version of ICA. Should be between 1 to 2.

  • max_tol - Maximum tolerance of the algorithm.

  • verbose - Controls verbosity of the function.

membership_params

List. Controls how the component loadings are turned into module membership, see params_module_membership(). Membership is not exclusive: a gene loading strongly on several components will appear in several modules, and a gene in no tail appears in none.

random_seed

Integer. For reproducibility.

consistent_sign

Boolean. If set to TRUE, for each source the absolute maximum value will be positive, i.e., the sign will be inverted so that the absolute bigger tail is set to positive floats.

.verbose

Boolean. Controls verbosity.

Value

BulkCoExp with the the source matrix S, mixing matrix A and other parameters added to the slots.

Examples

# stabilised five-component ICA and the resulting modules
mat <- t(synthetic_signal_matrix()$mat)
obj <- BulkCoExp(mat, data.table::data.table(sample_id = rownames(mat)))
obj <- preprocess_bulk_coexp(obj, hvg = 0.3, .verbose = FALSE)
obj <- ica_processing(obj, .verbose = FALSE)
obj <- ica_stabilised_results(
  obj, no_comp = 5L, ica_type = "logcosh", .verbose = FALSE
)
head(get_modules(get_results(obj)))
#>       gene module_id   loading   sign        z
#>     <char>    <char>     <num> <char>    <num>
#> 1:  gene17      IC_1  4.098349    pos 3.031712
#> 2:  gene47      IC_2  2.325615    pos 3.193498
#> 3: gene184      IC_3 10.133645    pos 4.554106
#> 4: gene138      IC_3  9.554019    pos 4.311909
#> 5: gene176      IC_3  9.062064    pos 4.106346
#> 6: gene116      IC_3  7.938691    pos 3.636945