Skip to contents

Builds all prior knowledge data required by NicheNet. For this it calls a multitude of methods to download and combine data from various databases according to the settings. The content of the prior knowledge data is highly customizable, see the documentation of the related functions. After the prior knowledge is ready, it performs parameter optimization to build a NicheNet model. This results a weighted ligand- target matrix. Then, considering the expressed genes from user provided data, a gene set of interest and background genes, it executes the NicheNet ligand activity analysis.


  only_omnipath = FALSE,
  expressed_genes_transmitter = NULL,
  expressed_genes_receiver = NULL,
  genes_of_interest = NULL,
  background_genes = NULL,
  use_weights = TRUE,
  n_top_ligands = 42,
  n_top_targets = 250,
  signaling_network = list(),
  lr_network = list(),
  gr_network = list(),
  small = FALSE,
  tiny = FALSE,
  make_multi_objective_function_param = list(),
  objective_function_param = list(),
  mlrmbo_optimization_param = list(),
  construct_ligand_target_matrix_param = list(),
  results_dir = NULL,
  quality_filter_param = list()



Logical: use only OmniPath for network knowledge. This is a simple switch for convenience, further options are available by the other arguments. By default we use all available resources. The networks can be customized on a resource by resource basis, as well as providing custom parameters for individual resources, using the parameters `signaling_network`, `lr_network` and `gr_network`.


Character vector with the gene symbols of the genes expressed in the cells transmitting the signal.


Character vector with the gene symbols of the genes expressed in the cells receiving the signal.


Character vector with the gene symbols of the genes of interest. These are the genes in the receiver cell population that are potentially affected by ligands expressed by interacting cells (e.g. genes differentially expressed upon cell-cell interaction).


Character vector with the gene symbols of the genes to be used as background.


Logical: calculate and use optimized weights for resources (i.e. one resource seems to be better than another, hence the former is considered with a higher weight).


How many of the top ligands to include in the ligand-target table.


How many of the top targets (for each of the top ligands) to consider in the ligand-target table.


A list of parameters for building the signaling network, passed to nichenet_signaling_network.


A list of parameters for building the ligand-receptor network, passed to nichenet_lr_network.


A list of parameters for building the gene regulatory network, passed to nichenet_gr_network.


Logical: build a small network for testing purposes, using only OmniPath data. It is also a high quality network, it is reasonable to try the analysis with this small network.


Logical: build an even smaller network for testing purposes. As this involves random subsetting, it's not recommended to use this network for analysis.


Override parameters for smoof::makeMultiObjectiveFunction.


Override additional arguments passed to the objective function.


Override arguments for nichenetr::mlrmbo_optimization.


Override parameters for nichenetr::construct_ligand_target_matrix.


Character: path to the directory to save intermediate and final outputs from NicheNet methods.


Arguments for filter_intercell_network (quality filtering of the OmniPath ligand-receptor network). It is recommended to check these parameters and apply some quality filtering. The defaults already ensure certain filtering, but you might want more relaxed or stringent options.


A named list with the intermediate and final outputs of the pipeline: `networks`, `expression`, `optimized_parameters`, `weighted_networks` and `ligand_target_matrix`.


About small and tiny networks: Building a NicheNet model is computationally demanding, taking several hours to run. As this is related to the enormous size of the networks, to speed up testing we can use smaller networks, around 1,000 times smaller, with few thousands of interactions instead of few millions. Random subsetting of the whole network would result disjunct fragments, instead we load only a few resources. To run the whole pipeline with tiny networks use nichenet_test.


if (FALSE) {
nichenet_results <- nichenet_main(
    # altering some network resource parameters, the rest
    # of the resources will be loaded according to the defaults
    signaling_network = list(
        cpdb = NULL, # this resource will be excluded
        inbiomap = NULL,
        evex = list(min_confidence = 1.0) # override some parameters
    gr_network = list(only_omnipath = TRUE),
    n_top_ligands = 20,
    # override the default number of CPU cores to use
    mlrmbo_optimization_param = list(ncores = 4)