Skip to contents

Given an anndata object containing clustered velocity vectors, and NicheNet ligand database, identify ligands responsible for velocity vectors. This function first calls a wrapper for scvelo's recover_dynamics function, obtaining gene-wise velocity dynamics for each cluster. Folloewd by Entrain ligand analysis. Note that velocity clusters are generated from velocity data (i.e. time derivative of expression), rather than expression data like a typical usual cell clustering workflow such as Seurat FindClusters. Those wishing to run this on their own pre-generated clusters (E.g. if you have a bespoke set of marker genes) can do so by inputting an anndata with the custom cluster annotations in the anndata.obs metadata, and passing the column name to cluster_key But this is not quite recommended because cells that are similar in expression could exhibit very different velocities. In turn, this will input a noisy dataset to Entrain's randomForest, and any ligands that come out of such an analysis will be spurious.

Usage

entrain_velocity(
  receiver_obj,
  sender_obj = NULL,
  adata = NULL,
  sender_cluster_key,
  expressed_ligands = NULL,
  sender_clusters = NULL,
  reduction_key = NULL,
  save_adata = NULL,
  velocity_cluster_key = NULL,
  num_jobs = 10L,
  num_top_genes = NULL,
  expression_proportion_cutoff = 0.1,
  resolution = 0.05,
  lr_network = NULL,
  ligand_target_matrix = NULL,
  adata_dynamics = NULL,
  ...
)

Arguments

receiver_obj

A seurat object.

sender_obj

Optional. A seurat object. Use this if your sender cells are in a different dataset than your receiver cells. E.g. if the microenvironment data is in a different file than the differentiating cells.

adata

An anndata file containing velocities, preclustered with cluster_velocities().

sender_cluster_key

Column name in adata.obs that denotes the sender cluster annotation column.

expressed_ligands

Optional. A list of ligands expressed by the sender cells. This is calculated by default but you can specify if you have specific ligands of interest.

sender_clusters

Optional. Character vector denoting sender cluster cell types. If not supplied, will launch an interactive workflow selecting them manually.

reduction_key

Seurat reduction key for dimension reduction visualization.

save_adata

Optional. Filename of anndata object to write results to. If not given or NULL, anndata will not be saved. Recommended if you want to re-run or continue analysis in scanpy/scvelo.

velocity_cluster_key

Column name of the cluster labels in the metadata of adata_clustered. Can be calculated manually in scvelo with scvelo.tl.velocity_clusters().

num_jobs

Long integer. Number of parallel jobs to run for scvelo recover dynamics function.

num_top_genes

Long integer. Number of top velocity genes to calculate likelihoods for. Default NULL.

expression_proportion_cutoff

Pct cutoff to threshold a ligand as active. A ligand is 'active' if it is expressed in more than expression_proportion_cutoff fraction of cells in the sender cluster.

resolution

Optional argument defining resolution of velocity clustering. Default 0.05.

lr_network

NicheNet ligand-receptor pairs data file.

ligand_target_matrix

NicheNet ligand-target data file.

adata_dynamics

Optional. Filename of an anndata object that has had recover_dynamics_clusters(return_adata = True) run on it. Useful if you wish to run recover_dynamics_clusters() separately.

...

Arguments to pass to entrain_cluster_velocities() and scvelo.pl.velocity_embedding_stream().

Value

a Seurat object with ligand velocity results in obj$misc$entrain$velocity_result.