### Install Dynamo via setup.py Source: https://github.com/aristoteleo/dynamo-release/wiki/Dynamo-workflow Installs the package by running the setup script from within the repository directory. ```sh git clone https://github.com/aristoteleo/dynamo-release.git cd dynamo-release/ python setup.py install --user ``` -------------------------------- ### Install dynamo-release from source Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/installation.md Clone the repository and install the package locally using pip. ```bash git clone https://github.com/aristoteleo/dynamo-release.git pip install dynamo-release/ --user ``` -------------------------------- ### Install Dynamo via PyPi Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Standard installation method using the Python package manager. ```bash pip install dynamo-release ``` -------------------------------- ### Install Shiny Framework Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/tutorials/shiny.md Commands to install the Shiny package via pip or conda. ```bash pip install shiny ``` ```bash conda install -c conda-forge shiny ``` -------------------------------- ### Install dynamo-release via package managers Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/installation.md Standard installation commands for conda and pip environments. ```bash conda install -c conda-forge dynamo-release ``` ```bash pip install dynamo-release ``` -------------------------------- ### Install Dynamo via Conda Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Installation using the conda-forge channel. ```bash conda install -c conda-forge dynamo-release ``` -------------------------------- ### Install dynamo Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Command to install the dynamo package in editable mode. ```bash pip install --no-deps -e . ``` -------------------------------- ### Create venv virtual environment with uv Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/installation.md Setup a virtual environment using the uv tool for faster package management. ```bash pip install -U uv uv venv .dynamo-env source .dynamo-env/bin/activate # for macOS and Linux .scvi-env\Scripts\activate # for Windows ``` -------------------------------- ### Install dependencies Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Commands to install project dependencies via conda and pip. ```bash conda install --file ci/conda_requirements.txt ``` ```bash pip install -r ci/pip_requirements.txt ``` -------------------------------- ### Install Dynamo via git URL Source: https://github.com/aristoteleo/dynamo-release/wiki/Dynamo-workflow Installs the package directly from the remote git repository using pip. ```sh pip install git+https://github.com:aristoteleo/dynamo-release ``` -------------------------------- ### Zebrafish Lineage Configuration Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-conventional-rna-velocity/SKILL.md Defines lineage relationships for the zebrafish worked example. ```python group_key = "Cell_type" lineage_dict = {"Proliferating Progenitor": ["Schwann Cell"]} ``` -------------------------------- ### Verify Dynamo Dependencies Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Check the versions of all installed dependencies to ensure the environment is correctly configured. ```python import dynamo as dyn dyn.session_info() ``` -------------------------------- ### Zebrafish Progenitor Configuration Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-conventional-rna-velocity/SKILL.md Sets the progenitor labels for the zebrafish fate prediction example. ```python group_key = "Cell_type" progenitor_labels = ["Proliferating Progenitor", "Pigment Progenitor"] ``` -------------------------------- ### Define Fixed-Point Indices Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lineage-appearance-analysis/references/compatibility.md Example of manual fixed-point selection used in notebooks; these indices are dataset-specific and not portable. ```python good_fixed_points = [2, 8, 1, 195, 4, 5] ``` -------------------------------- ### Navigate to project directory Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Command to change the current working directory to the project path. ```bash cd /path/to/dynamo ``` -------------------------------- ### Launch LAP Shiny App Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/tutorials/shiny.md Initializes the LAP web application using a sample hematopoiesis dataset. ```python import dynamo as dyn adata = dyn.sample_data.hematopoiesis() dyn.shiny.lap_web_app(adata) ``` -------------------------------- ### Importing Dynamo and Dependencies Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/introduction/perturbation_tutorial/perturbation_tutorial.rst Initializes the environment by importing necessary libraries and silencing the dynamo logger. ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt import sys import os import dynamo as dyn dyn.dynamo_logger.main_silence() ``` -------------------------------- ### Get TF Statistics Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Signature for retrieving statistical metrics for transcription factors. ```python def get_tf_statistics(processed_rankings, reprogramming_df) ``` -------------------------------- ### Recipe configuration entrypoints Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-preprocess/references/source-grounding.md Methods used to configure specific preprocessing recipes for the Preprocessor instance. ```python config_monocle_recipe(self, adata, n_top_genes=2000) -> None config_seurat_recipe(self, adata) -> None config_sctransform_recipe(self, adata) -> None config_pearson_residuals_recipe(self, adata) -> None config_monocle_pearson_residuals_recipe(self, adata) -> None ``` -------------------------------- ### Create a conda environment Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Commands to initialize a new Python 3.6 environment using conda. ```bash conda create -n env_name python=3.6 pip ``` ```bash conda create -n skbio python=3.6 pip ``` -------------------------------- ### Create a topic branch Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Create and switch to a new branch for your specific changes. ```bash git checkout -b my-topic-branch ``` -------------------------------- ### Launch LAP Shiny App with TFs Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/tutorials/shiny.md Initializes the LAP web application with transcription factor information for ranking evaluation. ```python human_tfs = dyn.sample_data.human_tfs() dyn.shiny.lap_web_app(adata_labeling, human_tfs) ``` -------------------------------- ### Execute standard preprocessing with the Preprocessor wrapper Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-preprocess/SKILL.md Use this pattern for standard velocity or vector-field analysis workflows. ```python import dynamo as dyn from dynamo.preprocessing import Preprocessor adata = dyn.sample_data.zebrafish() preprocessor = Preprocessor() preprocessor.preprocess_adata(adata, recipe="monocle") dyn.tl.reduceDimension(adata, basis="pca") ``` -------------------------------- ### Forward Fate Prediction Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-conventional-rna-velocity/SKILL.md Predicts cell fate trajectories starting from specified progenitor populations. ```python init_cells = adata.obs_names[adata.obs[group_key].isin(progenitor_labels)] dyn.pd.fate( adata, basis="umap", init_cells=init_cells[:20], interpolation_num=100, direction="forward", inverse_transform=False, average=False, cores=1, ) ``` -------------------------------- ### Create conda virtual environment Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/installation.md Initialize a conda environment with a supported Python version. ```bash conda create -n dynamo-env python=3.10 # any python 3.10 to 3.12 conda activate dynamo-env ``` -------------------------------- ### Run tests Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Commands to execute the test suite locally. ```bash make test ``` ```python >>> from dynamo.test import pytestrunner >>> pytestrunner() # full test suite is executed ``` -------------------------------- ### Launch Perturbation Web App Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/tutorials/shiny.md Initializes the perturbation analysis application using a processed AnnData object. ```python import dynamo as dyn adata = dyn.sample_data.hematopoiesis() dyn.shiny.perturbation_web_app(adata) ``` -------------------------------- ### Minimal Preprocessor Handoff Pattern Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-geneid-convert/references/preprocess-handoff.md Initializes the Preprocessor and executes the standard monocle recipe on the provided AnnData object. ```python from dynamo.preprocessing import Preprocessor preprocessor = Preprocessor() preprocessor.preprocess_adata(adata, recipe="monocle", tkey="time", experiment_type="one-shot") ``` -------------------------------- ### Zebrafish Sample Data Loading Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-conventional-rna-velocity/SKILL.md Loads the built-in zebrafish dataset for demonstration purposes. ```python adata = dyn.sample_data.zebrafish() adata.obs_names_make_unique() ``` -------------------------------- ### Load Data in Dynamo Source: https://github.com/aristoteleo/dynamo-release/wiki/Dynamo-workflow Initializes the Dynamo environment and loads datasets using built-in sample data or external file formats like loom and h5ad. ```python # first step: Load data import dynamo as dyn # set matplotlib's rcParams. this setting tries to emulate ggplot style. dyn.configuration.set_figure_params('dynamo', background='black') # when background set to black, it produces cool figure that is good for presentation. set background='white' if you are producing figures for publication. # you can read your own data via read_loom, read_h5ad or read_h5 adata = dyn.read_loom(filename, **param) # (or use read_h5ad, read_NASC_seq to integrate with scanpy work flow, load result generated from NASC-seq pipeline, etc.) # here let us play with Dentate Gyrus example dataset (27, 998 genes and 18, 213 cells) adata = dyn.sample_data.DentateGyrus() # there are many sample datasets available. You can check our tutorials for other available datasets: https://github.com/aristoteleo/dynamo-tutorials ``` -------------------------------- ### Define LAP visualization keys Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/introduction/lap_tutorial/lap_tutorial.rst Define lists of cell type transition keys for developmental, reprogramming, and transdifferentiation paths. ```python develope_keys = ["HSC->Meg", "HSC->Ery", "HSC->Bas", "HSC->Mon", "HSC->Neu"] reprogram_keys = ["Meg->HSC", "Ery->HSC", "Bas->HSC", "Mon->HSC", "Neu->HSC"] transdifferentiation = [ "Ery->Meg", "Neu->Bas", "Mon->Ery", "Bas->Meg", "Neu->Meg", "Meg->Bas", "Mon->Bas", "Neu->Mon", "Meg->Ery", "Ery->Bas", "Bas->Mon", "Mon->Neu", "Neu->Ery", "Mon->Meg", "Bas->Neu", "Meg->Neu", "Ery->Mon", "Meg->Mon", "Ery->Neu", "Bas->Ery", ] ``` -------------------------------- ### Run dynamics with combined one-shot method Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-one-shot-total-rna-velocity/SKILL.md Alternative dynamics modeling using the combined one-shot method. ```python dyn.tl.dynamics( adata, group="time", one_shot_method="combined", model="deterministic", cores=1, ) ``` -------------------------------- ### Pickle Utilities Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Signatures for saving and loading objects using pickle, with cloudpickle fallback. ```python def save_pickle(file, path) def load_pickle(path) ``` -------------------------------- ### Define Transitions Configuration Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/stage-selection.md Structure for defining standard and special transition sets for TF analysis. ```python TRANSITIONS_CONFIG = { "standard": [ "HSC->Meg", "HSC->Ery", "HSC->Bas", "HSC->Mon", "HSC->Neu", "Meg->HSC", "Meg->Neu", "Ery->Mon", "Mon->Meg", "Mon->Ery", "Mon->Bas", "Neu->Bas" ], "special": { "Ery->Neu": { "sets": [ ("TFs1", "TFs_rank1", "Ery->Neu1"), ("TFs2", "TFs_rank2", "Ery->Neu2"), ] } } } ``` -------------------------------- ### Execute notebook-compatible one-shot total RNA workflow Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-one-shot-total-rna-velocity/SKILL.md Full pipeline for processing hematopoiesis data, including preprocessing, moment calculation, dynamics modeling, and velocity estimation. ```python import dynamo as dyn adata = dyn.sample_data.hematopoiesis_raw() adata.obs_names_make_unique() selected_genes = list(adata.uns["genes_to_use"]) pre = dyn.pp.Preprocessor(force_gene_list=selected_genes) pre.config_monocle_recipe(adata, n_top_genes=len(selected_genes)) pre.preprocess_adata_monocle(adata, tkey="time", experiment_type="one-shot") dyn.tl.reduceDimension(adata) dyn.tl.moments(adata, group="time") adata.uns["pp"]["has_splicing"] = False dyn.tl.dynamics( adata, group="time", one_shot_method="sci_fate", model="deterministic", cores=1, ) dyn.tl.calculate_velocity_alpha_minus_gamma_s(adata) dyn.tl.cell_velocities( adata, enforce=True, X=adata.layers["M_t"], V=adata.layers["velocity_alpha_minus_gamma_s"], method="cosine", ) ``` -------------------------------- ### Import Dynamo library Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/api/index.md Standard import statement for accessing the library as the alias dyn. ```python import dynamo as dyn ``` -------------------------------- ### dyn.pd.create_reprogramming_matrix Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Creates a reprogramming matrix based on a transition graph and configuration. ```APIDOC ## dyn.pd.create_reprogramming_matrix ### Description Creates a reprogramming matrix based on a provided transition graph and configuration settings. ### Signature `create_reprogramming_matrix(transition_graph, transitions_config, transition_pmids=None, transition_types=None, total_tf_count=133)` ### Parameters - **transition_graph** (object) - The transition graph object. - **transitions_config** (dict) - Configuration dictionary containing 'standard' and 'special' transition sets. - **transition_pmids** (list, optional) - List of PMIDs associated with transitions. - **transition_types** (list, optional) - List of transition types. - **total_tf_count** (int, optional) - Total number of transcription factors, default 133. ``` -------------------------------- ### Learn and Visualize Vector Fields Source: https://github.com/aristoteleo/dynamo-release/wiki/Dynamo-workflow Learn the vector field function and visualize it using grid velocity, streamlines, and line integral convolution. ```python # seventh step: learn vector field dyn.tl.VectorField(adata) dyn.pl.grid_velocity(adata, color=gene_list, ncols=3, method='SparseVFC') dyn.pl.grid_velocity(adata, color=gene_list, ncols=3, method='SparseVFC') dyn.pl.stremline_plot(adata, color=gene_list, ncols=3, method='SparseVFC') dyn.pl.line_integral_conv(adata) ``` -------------------------------- ### dyn.pd.process_all_transition_rankings Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/SKILL.md Adds TF and known_TF columns to all transitions. ```APIDOC ## dyn.pd.process_all_transition_rankings(transition_graph, human_tfs_names, known_tfs_dict=None) ### Description Step-wise version: adds TF and known_TF columns to all transitions. Returns processed_rankings. ``` -------------------------------- ### Configure and execute custom preprocessing recipes Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-preprocess/SKILL.md Customize preprocessing parameters by modifying the Preprocessor instance attributes before calling the specific recipe method. ```python import numpy as np from dynamo.preprocessing import Preprocessor preprocessor = Preprocessor() preprocessor.config_monocle_recipe(adata) preprocessor.filter_cells_by_outliers_kwargs = { "filter_bool": None, "layer": "all", "min_expr_genes_s": 300, "min_expr_genes_u": 100, "min_expr_genes_p": 50, "max_expr_genes_s": np.inf, "max_expr_genes_u": np.inf, "max_expr_genes_p": np.inf, "shared_count": None, } preprocessor.select_genes_kwargs = { "n_top_genes": 2500, "sort_by": "cv_dispersion", "keep_filtered": True, "SVRs_kwargs": { "relative_expr": True, "total_szfactor": "total_Size_Factor", "min_expr_cells": 0, "min_expr_avg": 0, "max_expr_avg": np.inf, "winsorize": False, "winsor_perc": (1, 99.5), "sort_inverse": False, "svr_gamma": None, }, } preprocessor.preprocess_adata_monocle(adata) ``` -------------------------------- ### Visualize Developmental LAP Times Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/introduction/lap_tutorial/lap_tutorial.rst Calculates and plots the developmental time for various lineages using metabolic labeling-based scRNA-seq data. ```python dyn.configuration.set_pub_style(scaler=1.5) develop_time_df = pd.DataFrame({"integration time": t_df.iloc[0, :].T}) develop_time_df["lineage"] = ["HSC", "Meg", "Ery", "Bas", "Mon", "Neu"] print(develop_time_df) ig, ax = plt.subplots(figsize=(4, 3)) dynamo_color_dict = { "Mon": "#b88c7a", "Meg": "#5b7d80", "MEP-like": "#6c05e8", "Ery": "#5d373b", "Bas": "#d70000", "GMP-like": "#ff4600", "HSC": "#c35dbb", "Neu": "#2f3ea8", } sns.barplot( y="lineage", x="integration time", hue="lineage", data=develop_time_df.iloc[1:, :], dodge=False, palette=dynamo_color_dict, ax=ax, ) ax.set_ylabel("") plt.tight_layout() plt.legend(bbox_to_anchor=(1.05, 1), loc="upper left") ``` -------------------------------- ### Construct state graph Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-differential-geometry-analysis/references/pseudotime-and-state-graph.md Creates a group-level transition graph. The vf method is recommended for vector-field integration. ```python dyn.pd.state_graph( adata, group, method="vf", transition_mat_key="pearson_transition_matrix", approx=False, eignum=5, basis="umap", layer=None, arc_sample=False, sample_num=100, prune_graph=False, ) ``` -------------------------------- ### Configure Visualization Styles Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Sets global figure parameters for different output environments such as notebooks, presentations, or publications. ```python dyn.configuration.set_figure_params('dynamo', background='white') # jupyter notebooks dyn.configuration.set_figure_params('dynamo', background='black') # presentation dyn.configuration.set_pub_style() # manuscript ``` -------------------------------- ### Extract Transition Metrics Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Retrieves action values and integration times from a transition graph. ```python def extract_transition_metrics( transition_graph, cells_indices_dict, cell_types, transcription_factors, top_tf_genes=10, lap_method='action' ) ``` -------------------------------- ### Pseudotime, Kinetic Heatmaps, and State Graphs Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-differential-geometry-analysis/SKILL.md Performs ddhodge pseudotime analysis and generates visualizations for kinetic heatmaps and state transitions. ```python dyn.ext.ddhodge(adata, basis="pca", sampling_method="velocity") transition_genes = adata.var_names[adata.var["top_pca_genes"]][:20].tolist() heat = dyn.pl.kinetic_heatmap( adata, genes=transition_genes, basis="pca", mode="pseudotime", tkey="pca_ddhodge_potential", gene_order_method="maximum", save_show_or_return="return", ) dyn.pd.state_graph( adata, group="Cell_type", basis="pca", method="vf", sample_num=30, ) ``` -------------------------------- ### Compute LAP Cell Type Transitions Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/SKILL.md Initializes the transition graph by building a UMAP neighbor graph and computing transitions between specified cell types. ```python import dynamo as dyn adata = dyn.sample_data.hematopoiesis() # Build UMAP neighbor graph needed for LAP dyn.tl.neighbors(adata, basis="umap", result_prefix="umap") cell_types = ["HSC", "Meg", "Ery", "Bas", "Mon", "Neu"] transition_graph, cells_indices = dyn.pd.compute_cell_type_transitions( adata=adata, cell_types=cell_types, reference_cell_types=["HSC"], marginal_method="combined", potential_column="umap_ddhodge_potential", cell_type_column="cell_type", EM_steps=2, top_genes=5, enable_plotting=True, enable_gene_analysis=True, ) # Persist — this step is expensive dyn.utils.save_pickle(transition_graph, "result/transition_graph.pkl") dyn.utils.save_pickle(cells_indices, "result/cells_indices.pkl") adata.write("result/adata_labeling_analysis.h5ad") ``` -------------------------------- ### dyn.pd.create_reprogramming_matrix Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/SKILL.md Builds a normalized priority-score DataFrame for reprogramming. ```APIDOC ## dyn.pd.create_reprogramming_matrix(transition_graph, transitions_config, transition_pmids=None, transition_types=None, total_tf_count=133) ### Description Builds a normalized priority-score DataFrame. Returns a tuple of (reprogramming_dict, reprogramming_df). Note: pass {} for transition_pmids and transition_types. ``` -------------------------------- ### Extract Transition Metrics Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/SKILL.md Loads the computed transition graph and indices to extract metrics using a list of known transcription factors. ```python transition_graph = dyn.utils.load_pickle("result/transition_graph.pkl") cells_indices = dyn.utils.load_pickle("result/cells_indices.pkl") human_tfs = dyn.sample_data.human_tfs() human_tfs_names = list(human_tfs["Symbol"]) action_df, t_df, tf_genes = dyn.pd.extract_transition_metrics( transition_graph=transition_graph, cells_indices_dict=cells_indices, cell_types=cell_types, transcription_factors=human_tfs_names, top_tf_genes=10, lap_method="action_t", # 'action' or 'action_t' ) ``` -------------------------------- ### Loading Hematopoiesis Sample Data Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/introduction/perturbation_tutorial/perturbation_tutorial.rst Loads the hematopoiesis dataset for analysis. ```python adata_labeling = dyn.sample_data.hematopoiesis() ``` -------------------------------- ### Calculate potential landscape via numerical integration Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Maps the potential landscape using a least action method based on the learned vector field function. ```python dyn.vf.Potential(adata) ``` -------------------------------- ### Initialize Interactive Animations Source: https://github.com/aristoteleo/dynamo-release/blob/master/shiny_web/index.html Applies fadeInUp animations to elements with the .app-card class upon DOM content loading. ```javascript // Add some interactive animations document.addEventListener('DOMContentLoaded', function() { const cards = document.querySelectorAll('.app-card'); cards.forEach((card, index) => { card.style.animation = `fadeInUp 0.8s ease-out ${index * 0.2}s both`; }); }); // Add fadeInUp animation const style = document.createElement('style'); style.textContent = ` @keyframes fadeInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } } `; document.head.appendChild(style); ``` -------------------------------- ### dyn.tl.dynamics Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-one-shot-total-rna-velocity/SKILL.md Estimates one-shot kinetic parameters. ```APIDOC ## dyn.tl.dynamics(adata, group=None, model='auto', est_method='auto', one_shot_method='combined') ### Description Estimates one-shot kinetic parameters and writes velocity-like layers such as velocity_N and velocity_T. ``` -------------------------------- ### Graph and Potential Calculation Signatures Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lineage-appearance-analysis/references/source-grounding.md Signatures for graph construction and potential field calculations. ```python build_graph(adj_mat) div(g) potential(g, div_neg=None) ``` -------------------------------- ### Create Reprogramming Matrix Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Defines the signature and configuration structure for generating a reprogramming matrix. ```python def create_reprogramming_matrix( transition_graph, transitions_config, transition_pmids=None, transition_types=None, total_tf_count=133 ) ``` ```python { "standard": ["HSC->Meg", ...], # processed with TFs/TFs_rank "special": { "Ery->Neu": { "sets": [("TFs1", "TFs_rank1", "Ery->Neu1"), ("TFs2", "TFs_rank2", "Ery->Neu2")] } } } ``` -------------------------------- ### Generating Jacobian prerequisites Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-in-silico-perturbation/references/compatibility.md Run this command to populate the required Jacobian data in adata.uns if it is missing from a freshly fitted dataset. ```python dyn.vf.jacobian(adata, regulators=gene_list, effectors=gene_list, basis='pca') ``` -------------------------------- ### Calculate Potential from Transition Matrices Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lineage-appearance-analysis/SKILL.md Computes potential values using graph divergence from cosine transition matrices or Fokker-Planck rates. ```python import dynamo as dyn from dynamo.tools.graph_operators import build_graph, div, potential adata = dyn.sample_data.hematopoiesis() g = build_graph(adata.obsp["cosine_transition_matrix"]) cosine_div = div(g) adata.obs["cosine_potential"] = potential(g, -cosine_div) g_fp = build_graph(adata.obsp["fp_transition_rate"]) fp_div = div(g_fp) adata.obs["potential_fp"] = potential(g_fp, fp_div) adata.obs["pseudotime_fp"] = -adata.obs["potential_fp"] ``` -------------------------------- ### Bootstrap Zebrafish Data Processing Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-differential-geometry-analysis/SKILL.md Initializes and preprocesses zebrafish sample data, followed by core dynamics, dimensionality reduction, and velocity estimation. ```python import dynamo as dyn adata = dyn.sample_data.zebrafish() adata.obs_names_make_unique() pre = dyn.pp.Preprocessor(cell_cycle_score_enable=True) pre.preprocess_adata(adata, recipe="monocle") dyn.tl.dynamics(adata, cores=1) dyn.tl.reduceDimension(adata) dyn.tl.cell_velocities(adata) dyn.tl.cell_velocities( adata, basis="pca", transition_genes=adata.var.use_for_pca.values, ) dyn.vf.VectorField(adata, basis="pca", M=50, cores=1) ``` -------------------------------- ### Handle Import Errors in Quiver Source Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lineage-appearance-analysis/references/compatibility.md Error encountered when using 'reconstructed' quiver source in the current runtime. ```text ImportError: cannot import name 'vector_field_function' from 'dynamo.tools.utils' ``` -------------------------------- ### dyn.pd.analyze_transition_tfs Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lap-cell-fate-transition/references/source-grounding.md Analyzes transcription factor activity across transitions. ```APIDOC ## dyn.pd.analyze_transition_tfs ### Description Evaluates transcription factor involvement in transitions based on specified plot types. ### Parameters - **transition_graph** (dict) - The transition graph. - **human_tfs_names** (list) - List of human TF names. - **transitions_config** (dict) - Configuration for transitions. - **plot_type** (str) - Type of analysis: 'development', 'reprogramming', or 'transdifferentiation'. ``` -------------------------------- ### Sample Data Loader Signature Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-lineage-appearance-analysis/references/source-grounding.md Signature for the hematopoiesis sample data loader. ```python (url='https://figshare.com/ndownloader/files/47439635', filename='hematopoiesis.h5ad') ``` -------------------------------- ### Execute Gradient-based Pseudotime Velocity Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-pseudotime-velocity/SKILL.md Alternative execution pattern using the gradient method for pseudotime velocity. ```python dyn.tl.pseudotime_velocity( adata, pseudotime="palantir_pseudotime", basis="umap", method="gradient", dynamics_info=False, ) ``` -------------------------------- ### Preprocessor.preprocess_adata_monocle Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-one-shot-total-rna-velocity/SKILL.md The primary entrypoint for monocle-style preprocessing. ```APIDOC ## Preprocessor.preprocess_adata_monocle(adata, tkey=None, experiment_type=None) ### Description Executes the monocle preprocessing workflow on the provided AnnData object. ``` -------------------------------- ### Preprocess Data Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/user_guide/index.md Initializes the Preprocessor class and applies a generalized normalization and feature selection strategy to the AnnData object. ```python from dynamo.preprocessing import Preprocessor preprocessor = Preprocessor() preprocessor.preprocess_adata(adata, recipe="monocle") ``` -------------------------------- ### Generate kinetic heatmap Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-differential-geometry-analysis/references/pseudotime-and-state-graph.md Visualizes gene expression kinetics. Can automatically run ddhodge if pseudotime mode is selected and the tkey is missing. ```python dyn.pl.kinetic_heatmap( adata, genes, mode="vector_field", basis=None, layer="X", project_back_to_high_dim=True, tkey="potential", gene_order_method="maximum", save_show_or_return="show", ) ``` -------------------------------- ### Preprocessor.preprocess_adata Source: https://github.com/aristoteleo/dynamo-release/blob/master/skills/dynamo-differential-geometry-analysis/SKILL.md Conventional preprocessing wrapper for AnnData objects. ```APIDOC ## Preprocessor.preprocess_adata(adata, recipe='monocle', tkey=None, experiment_type=None) ### Description Performs standard preprocessing on an AnnData object. ### Parameters - **adata** (AnnData) - Required - The AnnData object to process. - **recipe** (str) - Optional - The preprocessing recipe to use (default: 'monocle'). - **tkey** (str) - Optional - Time key for temporal data. - **experiment_type** (str) - Optional - The type of experiment. ``` -------------------------------- ### Identify Optimal Path Between Cell States Source: https://github.com/aristoteleo/dynamo-release/blob/master/docs/introduction/lap_tutorial/lap_tutorial.rst Selects initial and target cells and computes the least action path between them. ```python init_cells = [adata_labeling.obs_names[HSC_cells_indices[0][0]]] target_cells = [adata_labeling.obs_names[Bas_cells_indices[0][0]]] print("init cells:", init_cells) print("end cells:", target_cells) ``` ```python dyn.configuration.set_pub_style(scaler=0.6) lap = dyn.pd.least_action( adata_labeling, init_cells=init_cells, target_cells=target_cells, basis="pca", adj_key="cosine_transition_matrix", ) ``` -------------------------------- ### Activate conda environment Source: https://github.com/aristoteleo/dynamo-release/blob/master/CONTRIBUTING.md Command to activate the specified conda environment. ```bash source activate env_name ```