ConNetGNN function

Construct association networks for gene-gene, cell-cell, and gene-cell based on graph neural network (GNN)

Construct association networks for gene-gene, cell-cell, and gene-cell based on graph neural network (GNN)

This function implements a graph neural network with two autoencoders. 1. AutoEncoder (AE) based on deep neural network: Infer latent associations between genes and cells. 2. Graph AutoEncoder (GAE) based on graph convolutional neural network: Construct association networks for gene-gene, cell-cell.

ConNetGNN( Prep_data, python.path = NULL, miniconda.path = NULL, AE.epochs = 1000, AE.learning.rate = 0.001, AE.reg.alpha = 0.5, use.VGAE = TRUE, GAE.epochs = 300, GAE.learning.rate = 0.01, GAE_val_ratio = 0.05, parallel = FALSE, seed = 125, GPU.use = FALSE, verbose = TRUE )

Arguments

  • Prep_data: The input data is the result from the Preprocessing function.
  • python.path: The path to a Python binary. If python.path="default", the program will use the current system path to python.
  • miniconda.path: The path in which miniconda will be installed. If the python.path is NULL and conda or miniconda is not installed in the system, the program will automatically install miniconda according to the path specified by miniconda.path.
  • AE.epochs: The number of epoch for the deep neural network (AE). Default: 1000.
  • AE.learning.rate: Initial learning rate of AE. Default: 0.001.
  • AE.reg.alpha: The LTMG regularized intensity. Default: 0.5.
  • use.VGAE: Whether to use Variational Graph AutoEncoder (VGAE). Default: TRUE.
  • GAE.epochs: The number of epoch for the GAE. Default: 300.
  • GAE.learning.rate: Initial learning rate of GAE. Default: 0.01.
  • GAE_val_ratio: For GAE, the proportion of edges that are extracted as the validation set. Default: 0.05.
  • parallel: Whether to use multiple processors to run GAE. Default: FALSE When parallel=TRUE (default), tow processors will be used to run GAE.
  • seed: Random number generator seed.
  • GPU.use: Whether to use GPU for GNN modules. Default: FALSE. If GPU.use=TRUE, CUDA needs to be installed.
  • verbose: Gives information about each step. Default: TRUE.

Returns

A list:

  • cell_network: Constructed cell association network.
  • gene_network: Constructed gene association network.
  • cell_gene_network: Constructed gene-cell association network.

Details

ConNetGNN

The ConNetGNN function establishes a graph neural network (GNN) framework to mine latent relationships between genes and cells and within themselves. This framework mainly includes two capabilities:

  • 1.Deep neural network-based AutoEncoder inferring associations between genes and cells and generating gene features and cell features for the GAE.
  • 2.The GAE takes the gene feature and cell feature as the node features of the initial gene correlation network and cell correlation network, and constructs the gene association network and cell association network through the graph convolution process.

The GNN is implemented based on pytorch, so an appropriate python environment is required:

  • python >=3.9.7
  • pytorch >=1.10.0
  • sklearn >=0.0
  • scipy >=1.7.3
  • numpy >=1.19.5

If the user has already configured the python environment, the path of the python binary file can be directly entered into python.path. If the parameter python.path is NULL, the program will build a miniconda environment called scapGNN_env and configure python. We also provide environment files for conda: /inst/extdata/scapGNN_env.yaml. Users can install it with the command: conda env create -f scapGNN_env.yaml.

Examples

require(coop) require(reticulate) require(parallel) # Data preprocessing data("Hv_exp") Hv_exp <- Hv_exp[,1:20] Hv_exp <- Hv_exp[which(rowSums(Hv_exp) > 0),] Prep_data <- Preprocessing(Hv_exp[1:10,]) ## Not run: # Specify the python path ConNetGNN_data <- ConNetGNN(Prep_data,python.path="../miniconda3/envs/scapGNN_env/python.exe") ## End(Not run)
  • Maintainer: Xudong Han
  • License: GPL (>= 2)
  • Last published: 2023-08-08

Useful links