spatialtis.GCNG

class spatialtis.GCNG(data, known_pairs=None, predict_pairs=None, train_partition=0.9, gpus=None, max_epochs=10, lr=0.0001, batch_size=32, random_seed=42, load_model=False, **kwargs)[source]

A pytorch reimplementation of GCNG

Use to identify directional gene-gene interactions. The trained model will be automatically save to anndata.

Note

To perform this analysis, you need pytorch, pytorch-geometry and pytorch-lightning installed. If you have GPU, make sure you install pytorch with GPU support, it would be way more faster than CPU.

Parameters
  • data (anndata._core.anndata.AnnData) – AnnData object to perform analysis

  • known_pairs (Optional[pandas.core.frame.DataFrame]) – The input data for training, should be a dataframe with three columns, ligand, receptor, relationship; 0 means not interact, 1 means interact.

  • predict_pairs (Optional[List[Tuple]]) – The pairs that you interested

  • train_partition (float) – The ratio to split the dataset for training

  • gpus (Optional[int]) – Number of gpu to use, can be auto-detected

  • max_epochs (int) – Number of epoch

  • lr (float) – Learning rate

  • batch_size (int) – The batch size

  • random_seed (int) – The random seed

  • load_model (bool) – To load a pretrained model from anndata

  • **kwargs – Pass to spatialtis.abc.AnalysisBase