- dynamo.vf.sensitivity(adata, regulators=None, effectors=None, cell_idx=None, sampling=None, sample_ncells=1000, basis='pca', Qkey='PCs', vector_field_class=None, method='analytical', projection_method='from_jacobian', store_in_adata=True, **kwargs)
Calculate Sensitivity matrix for each cell with the reconstructed vector field.
If the vector field was reconstructed from the reduced PCA space, the Sensitivity matrix will then be inverse transformed back to high dimension. Note that this should also be possible for reduced UMAP space and will be supported shortly. Note that we compute the Sensitivity for the RKHS kernel vector field analytically, which is much more computationally efficient than the numerical method.
AnnData) – AnnData object that contains the reconstructed vector field in .uns.
List]) – The list of genes that will be used as regulators when calculating the cell-wise Jacobian matrix. The Jacobian is the matrix consisting of partial derivatives of the vector field wrt gene expressions. It can be used to evaluate the change in velocities of effectors (see below) as the expressions of regulators increase. The regulators are the denominators of the partial derivatives.
int) – The number of cells to be sampled. If sampling is None, this parameter is ignored.
str) – The embedding data in which the vector field was reconstructed. If None, use the vector field function that was reconstructed directly from the original unreduced gene expression space.
str) – The key of the PCA loading matrix in .uns.
str) – The method that will be used for calculating Jacobian, either ‘analytical’ or ‘numerical’. ‘analytical’ method uses the analytical expressions for calculating Jacobian while ‘numerical’ method uses numdifftools, a numerical differentiation tool, for computing Jacobian. ‘analytical’ method is much more efficient.
The method that will be used to project back to original gene expression space for calculating gene-wise sensitivity matrix:
’from_jacobian’: first calculate jacobian matrix and then calculate sensitivity matrix. This method will take the combined regulator + effectors gene set for calculating a square Jacobian matrix required for the sensitivity matrix calculation.
’direct’: The sensitivity matrix on low dimension will first calculated and then projected back to original gene expression space in a way that is similar to the gene-wise jacobian calculation.
cores – Number of cores to calculate Jacobian. If cores is set to be > 1, multiprocessing will be used to parallel the Jacobian calculation.
kwargs – Any additional keys that will be passed to elementwise_jacobian_transformation function.
- AnnData object that is updated with the ‘sensitivity’ key in the .uns. This is a 3-dimensional tensor
with dimensions n_obs x n_regulators x n_effectors.
- Return type: