ConNetGNN {scapGNN} | R Documentation |
Construct association networks for gene-gene, cell-cell, and gene-cell based on graph neural network (GNN)
Description
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.
Usage
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 |
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 |
AE.epochs |
The number of epoch for the deep neural network (AE). Default: |
AE.learning.rate |
Initial learning rate of AE. Default: |
AE.reg.alpha |
The LTMG regularized intensity. Default: |
use.VGAE |
Whether to use Variational Graph AutoEncoder (VGAE). Default: |
GAE.epochs |
The number of epoch for the GAE. Default: |
GAE.learning.rate |
Initial learning rate of GAE. Default: |
GAE_val_ratio |
For GAE, the proportion of edges that are extracted as the validation set. Default: |
parallel |
Whether to use multiple processors to run GAE. Default: |
seed |
Random number generator seed. |
GPU.use |
Whether to use GPU for GNN modules. Default: |
verbose |
Gives information about each step. Default: |
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
.
Value
A list:
- cell_network
Constructed cell association network.
- gene_network
Constructed gene association network.
- cell_gene_network
Constructed gene-cell association network.
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)