scNET: Learning Context-Specific Gene and Cell Embeddings by Integrating Single-Cell Gene Expression Data with Protein-Protein Interaction Information
Recent advances in single-cell RNA sequencing (scRNA-seq) techniques have provided unprecedented insights into tissue heterogeneity. However, gene expression data alone often fails to capture changes in cellular pathways and complexes, which are more discernible at the protein level. Additionally, analyzing scRNA-seq data presents challenges due to high noise levels and zero inflation. In this study, we propose a novel approach to address these limitations by integrating scRNA-seq datasets with a protein-protein interaction (PPI) network. Our method employs a unique bi-graph architecture based on graph neural networks (GNNs), enabling the joint representation of gene expression and PPI network data. This approach models gene-to-gene relationships under specific biological contexts and refines cell-cell relations using an attention mechanism, resulting in new gene and cell embeddings.
pip install scnet
To clone the repository, use the following command:
git clone https://github.com/madilabcode/scNET
We recommend using the provided Conda environment located at ./Data/scNET-env.yaml. cd scNET conda env create -f ./Data/scNET-env.yaml
import scNET
To train scNET on scRNA-seq data, first load an AnnData object using Scanpy, then initialize training with the following command:
scNET.run_scNET(obj, pre_processing_flag=False, human_flag=False, number_of_batches=3, split_cells= True, max_epoch=250, model_name = project_name)
with the following args:
-
obj (AnnData, optional): AnnData obj.
-
pre_processing_flag (bool, optional): If True, perform pre-processing steps.
-
human_flag (bool, optional): Controls gene name casing in the network.
-
number_of_batches (int, optional): Number of mini-batches for the training.
-
split_cells (bool, optional): If True, split by cells instead of edges during training.
-
n_neighbors (int, optional): Number of neighbors for building the adjacency graph.
-
max_epoch (int, optional): Max number of epochs for model training.
-
model_name (str, optional): Identifier for saving the model outputs.
-
save_model_flag (bool, optional): If True, save the trained model.
embedded_genes, embedded_cells, node_features , out_features = scNET.load_embeddings(project_name)
where:
-
embedded_genes (np.ndarray): Learned gene embeddings.
-
embedded_cells (np.ndarray): Learned cell embeddings.
-
node_features (pd.DataFrame): Original gene expression matrix.
-
out_features (np.ndarray): Reconstructed gene expression matrix
recon_obj = scNET.create_reconstructed_obj(node_features, out_features, obj)
scNET.build_co_embeded_network(embedded_genes, node_features)
For a basic usage example of our framework, please refer to the following notebook: scNET Example Notebook
For a uasge example with batch integration using bbknn graph, plese refer to the following notebook: scNET Multi Batch Example Notebook
For a simple usage example on gene inference using scNET gene embedding,please refer to the following notebook: scNET Icos embedding
For a simple example of predicting functional annotations using gene embeddings, please refer to the following notebook: scNET functional annotations
For a example of how to use scNET to identify CD8+ T Cells subpopulation please refer to the following notebook: scNET subpouplation clustring