API Documentations

Import UNAGI:

from UNAGI import UNAGI

Documentaions for the UNAGI package.

UNAGI launcher

The UNAGI class is the main class of UNAGI. It contains the function to prepare the data, start the model training and start analysing the perturbation results.

UNAGI.UNAGI_tool.UNAGI.setup_data

The function to specify the data directory, the attribute name of the stage information and the total number of time stages of the time-series single-cell data.

UNAGI.UNAGI_tool.UNAGI.setup_training

Set up the training parameters and the model parameters.

UNAGI.UNAGI_tool.UNAGI.calculate_neighbor_graph

The function to calculate the cell graphs for each stage.

UNAGI.UNAGI_tool.UNAGI.register_CPO_parameters

The function to register the parameters for the CPO analysis.

UNAGI.UNAGI_tool.UNAGI.register_iDREM_parameters

The function to register the parameters for the iDREM analysis.

UNAGI.UNAGI_tool.UNAGI.register_species

The function to register the species of the single-cell data.

UNAGI.UNAGI_tool.UNAGI.run_UNAGI

The function to launch the model training.

The model architecture of UNAGI

The module contains the VAE model and the discriminator model.

UNAGI.model.models

Trainer of UNAGI

The modules to start the training of UNAGI.

UNAGI.train.trainer.UNAGI_trainer

UNAGI.train.runner.UNAGI_runner

The UNAGI_runner class is used to set up the hyperparameters to run iDREM, find clustering optimal parameters and run the UNAGI model .

UNAGI.train.customized_elbo

The customized elbo to support the VAE and discriminator loss.

Dynamic graphs

Construct the dynamic graphs for the given data.

Calculate the distance between two nodes.

UNAGI.dynamic_graphs.distDistance.calculateKL

calculate KL divergence of multivariate gaussian distributions between two clusters.

UNAGI.dynamic_graphs.distDistance.getSimilarity

calculate the differential gene similarity between two clusters.

UNAGI.dynamic_graphs.distDistance.normalizeDistance

Normalize the kl divergence distance and top differential gene distances.

Build the dynamic graphs.

UNAGI.dynamic_graphs.buildGraph.nodesDistance

calculate the distance between two stages

UNAGI.dynamic_graphs.buildGraph.buildEdges

calculate the distance between two stages and connect the clusters in two stages with smallest distance with midpath in iterative training

UNAGI.dynamic_graphs.buildGraph.reupdateAttributes

update gaussian and gamma rep, top 100 differential genes, cell types of clusters to anndata

UNAGI.dynamic_graphs.buildGraph.updateEdges

updata edges to the anndata database, calculate edges changes.

Dynamic regulatory networks

Reconstruct the dynamic regulatory networks using iDREM for the dynamic graphs.

UNAGI.dynamic_regulatory_networks.processIDREM.runIdrem

train IDREM model and save the results in iterative training with midpath and iteration

Gene weights accumulation

Identify dynamic genes and accumulate gene weights.

UNAGI.dynamic_regulatory_networks.processTFs.updataGeneTablesWithDecay

update gene weights and decay the weight of genes that are not important in this iteration

Perturbations

Perform perturbations using compounds/drugs or pathways, analyze the perturbation results.

UNAGI.perturbations.compounds.get_top_compounds

Get top compounds predictions after compound perturbations at a given intensity.

UNAGI.perturbations.pathways.get_top_pathways

Get top pathways predictions after pathway perturbations at a given intensity.

UNAGI.perturbations.analysis_perturbation.perturbationAnalysis.online_analysis

Analyse the online perturbation results.

UNAGI.perturbations.analysis_perturbation.perturbationAnalysis.main_analysis

The main function to analyse the perturbation results.

UNAGI.perturbations.speedup_perturbation.perturbation.run

Perform perturbation.

UNAGI.perturbations.speedup_perturbation.perturbation.run_online

Perform online perturbation.

UNAGI.perturbations.speedup_perturbation.perturbation.startAutoPerturbation

Start the perturbation analysis.

UNAGI.perturbations.speedup_perturbation.perturbation.startAutoPerturbation_online

Start the perturbation analysis (online version).

Analyse pertubration results

UNAGI.UNAGI_analyst.analyst

The analyst class is the class to perform downstream analysis.

UNAGI.UNAGI_analyst.analyst.start_analyse

Perform downstream tasks including dynamic markers discoveries, hierarchical markers discoveries, pathway perturbations and compound perturbations.

Marker discovery

UNAGI supports to discover dynamic markers (temporal) and hierarchical markers (static).

Dynamic markers

UNAGI.marker_discovery.dynamic_markers.runGetProgressionMarker

Get the top markers for each track from IDREM results.

UNAGI.marker_discovery.dynamic_markers.runGetProgressionMarker_one_dist

Get the top markers for each track from IDREM results and consider the whole background as one distribution.

UNAGI.marker_discovery.dynamic_markers.runGetProgressionMarkercsv

Get the top markers for each track from IDREM results and save as a csv file.

UNAGI.marker_discovery.dynamic_markers.getTopMarkersFromIDREM

Get the top markers for each track from IDREM results.

UNAGI.marker_discovery.dynamic_markers.scoreAgainstBackground

Calculate the p-value of the input gene expression change based on the background gene expression change.

Hierarchical static markers

UNAGI.marker_discovery.hierachical_static_markers.get_dataset_hcmarkers

Perform hierarchical clustering on the dataset and get the hierarchical clustering markers for each stage.

Plottings

Functions to visualize the outputs of UNAGI, including cell type compositions, latent representations, the heatmaps of hierarchical markers, and dendrogram of individual stages.

The plotting module contains functions for visualizing the results of UNAGI.

UNAGI.plotting.plot_cell_embeddings.plot_stages_latent_representation

Plot the latent representation of the cells colored by cell type and leiden clusters.

UNAGI.plotting.plot_cell_embeddings.plot_with_colormap

The color scheme the cell types are plotted with.

UNAGI.plotting.plot_cell_type_composition.cell_type_composition

Plot the cell type composition of each stage

UNAGI.plotting.plot_stage_dendrogram.plot_hc_dendrogram

Plot the dendrogram of the hierarchical static markers of each stage.

UNAGI.plotting.plot_hierarchical_markers_heatmap.hierarchical_static_markers_heatmap

Plot the heatmap of the hierarchical static markers of the chosen cluster and its siblings.