module_preservation {BioNERO} | R Documentation

## Calculate network preservation between two expression data sets

### Description

Calculate network preservation between two expression data sets

### Usage

    module_preservation(
      explist,
      ref_net = NULL,
      test_net = NULL,
      algorithm = "netrep",
      nPerm = 1000,
      nThreads = 1,
      plot_all_stats = FALSE
    )

### Arguments

`explist` | List of SummarizedExperiment objects or expression data frames with genes (or orthogroups) in row names and samples in column names.
`ref_net` | Reference network object returned by the function `exp2gcn`.
`test_net` | Test network object returned by the function `exp2gcn`.
`algorithm` | Module preservation algorithm to be used. One of 'netrep' (default, permutation-based) or WGCNA.
`nPerm` | Number of permutations. Default: 1000
`nThreads` | Number of threads to be used for parallel computing. Default: 1
`plot_all_stats` | Logical indicating whether to save all density and connectivity statistics in a PDF file or not. Default: FALSE.

### Value

A list containing the preservation statistics (netrep) or a ggplot object with preservation statistics. See `WGCNA::modulePreservation` or `NetRep::modulePreservation` for more info.

### Examples

    set.seed(1)
    data(og.zma.osa)
    data(zma.se)
    data(osa.se)
    og <- og.zma.osa
    exp_ortho <- exp_genes2orthogroups(explist, og, summarize = "mean")
    exp_ortho <- lapply(exp_ortho, function(x) filter_by_variance(x, n=1500))
    # Previously calculated SFT powers
    powers <- c(13, 15)
    gcn_osa <- exp2gcn(exp_ortho$osa, net_type = "signed hybrid",
                       SFTpower = powers[1], cor_method = "pearson")
    gcn_zma <- exp2gcn(exp_ortho$zma, net_type = "signed hybrid",
                       SFTpower = powers[2], cor_method = "pearson")
    explist <- exp_ortho
    ref_net <- gcn_osa
    test_net <- gcn_zma
    # 10 permutations for demonstration purposes
    pres <- module_preservation(explist, ref_net, test_net, nPerm=10)

[Package BioNERO version 1.0.4 Index]