dynamo.tl.recipe_kin_data

dynamo.tl.recipe_kin_data(adata, tkey=None, reset_X=True, X_total_layers=False, splicing_total_layers=False, n_top_genes=1000, keep_filtered_cells=None, keep_filtered_genes=None, keep_raw_layers=None, del_2nd_moments=None, ekey='M_t', vkey='velocity_T', basis='umap', rm_kwargs={})[source]

An analysis recipe that properly pre-processes different layers for an kinetics experiment with both labeling and splicing or only labeling data.

Parameters:
  • adata (AnnData) – An AnnData object that stores data for the kinetics experiment, must include uu, ul, su, sl four different layers.

  • tkey (Optional[str]) – The column key for the labeling time of cells in .obs. Used for labeling based scRNA-seq data (will also support for conventional scRNA-seq data). Note that tkey will be saved to adata.uns[‘pp’][‘tkey’] and used in dyn.tl.dynamics in which when group is None, tkey will also be used for calculating 1st/2st moment or covariance. We recommend to use hour as the unit of time. Defaults to None.

  • reset_X (bool) – Whether do you want to let dynamo reset adata.X data based on layers stored in your experiment. One critical functionality of dynamo is about visualizing RNA velocity vector flows which requires proper data into which the high dimensional RNA velocity vectors will be projected. (1) For kinetics experiment, we recommend the use of total layer as adata.X; (2) For degradation/conventional experiment scRNA-seq, we recommend using splicing layer as adata.X. Set reset_X to True to set those default values if you are not sure. Defaults to True.

  • X_total_layers (bool) – Whether to also normalize adata.X by size factor from total RNA. Parameter to recipe_monocle function. Defaults to False.

  • splicing_total_layers (bool) – Whether to also normalize spliced / unspliced layers by size factor from total RNA. Parameter to recipe_monocle function. Defaults to False.

  • n_top_genes (int) – The number of top genes based on scoring method (specified by sort_by) will be selected as feature genes. Arguments required by the recipe_monocle function. Defaults to 1000.

  • keep_filtered_cells (Optional[bool]) – Whether to keep genes that don’t pass the filtering in the returned adata object. Used in recipe_monocle. If None, would be set according to DynamoAdataConfig. Defaults to None.

  • keep_filtered_genes (Optional[bool]) – Whether to keep genes that don’t pass the filtering in the returned adata object. Used in recipe_monocle. If None, would be set according to DynamoAdataConfig. Defaults to None.

  • keep_raw_layers (Optional[bool]) – Whether to keep layers with raw measurements in the returned adata object. Used in recipe_monocle. If None, would be set according to DynamoAdataConfig. Defaults to None.

  • del_2nd_moments (Optional[bool]) – Whether to remove second moments or covariances. Argument used for dynamics function. If None, would be set according to DynamoAdataConfig. Defaults to None.

  • ekey (str) – The dictionary key that corresponds to the gene expression in the layer attribute. ekey and vkey will be automatically detected from the adata object. Parameters required by cell_velocities. Defaults to “M_t”.

  • vkey (str) – The dictionary key that corresponds to the estimated velocity values in the layers attribute. Parameters required by cell_velocities Defaults to “velocity_T”.

  • basis (str) – The dictionary key that corresponds to the reduced dimension in .obsm attribute. Can be X_spliced_umap or X_total_umap, etc. Parameters required by cell_velocities. Defaults to “umap”.

  • rm_kwargs (Dict[str, Any]) – Other kwargs passed into the pp.recipe_monocle function. Defaults to {}.

Raises:

Exception – The recipe is only applicable to kinetics experiment datasets with labeling data.

Return type:

AnnData

Returns:

An updated adata object that went through a proper and typical time-resolved RNA velocity analysis.