spateo.tdr.morphometrics.morphofield_dg.differential_geometry#

Module Contents#

Functions#

_generate_vf_class(adata, vf_key[, method])

morphofield_velocity(→ Optional[anndata.AnnData])

Calculate the velocity for each cell with the reconstructed vector field function.

morphofield_acceleration(→ Optional[anndata.AnnData])

Calculate acceleration for each cell with the reconstructed vector field function.

morphofield_curvature(→ Optional[anndata.AnnData])

Calculate curvature for each cell with the reconstructed vector field function.

morphofield_curl(→ Optional[anndata.AnnData])

Calculate curl for each cell with the reconstructed vector field function.

morphofield_torsion(→ Optional[anndata.AnnData])

Calculate torsion for each cell with the reconstructed vector field function.

morphofield_divergence(→ Optional[anndata.AnnData])

Calculate divergence for each cell with the reconstructed vector field function.

morphofield_jacobian(→ Optional[anndata.AnnData])

Calculate jacobian for each cell with the reconstructed vector field function.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry._generate_vf_class(adata: anndata.AnnData, vf_key: str, method: str = 'gaussian_process')[source]#
spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_velocity(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'velocity', inplace: bool = True) anndata.AnnData | None[source]#

Calculate the velocity for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the velocity key in .obsm.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obsm attribute which contains velocities.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_acceleration(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'acceleration', method: str = 'analytical', inplace: bool = True) anndata.AnnData | None[source]#

Calculate acceleration for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the acceleration key in .obs and .obsm.

method

The method that will be used for calculating acceleration field, either 'analytical' or 'numerical'.

'analytical' method uses the analytical expressions for calculating acceleration while 'numerical' method uses numdifftools, a numerical differentiation tool, for computing acceleration. 'analytical' method is much more efficient.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs and .obsm attribute.

The key_added in the .obs which contains acceleration. The key_added in the .obsm which contains acceleration vectors.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_curvature(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'curvature', formula: int = 2, method: str = 'analytical', inplace: bool = True) anndata.AnnData | None[source]#

Calculate curvature for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the curvature key in .obs and .obsm.

formula

Which formula of curvature will be used, there are two formulas, so formula can be either {1, 2}. By default it is 2 and returns both the curvature vectors and the norm of the curvature. The formula one only gives the norm of the curvature.

method

The method that will be used for calculating curvature field, either 'analytical' or 'numerical'.

'analytical' method uses the analytical expressions for calculating curvature while 'numerical' method uses numdifftools, a numerical differentiation tool, for computing curvature. 'analytical' method is much more efficient.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs and .obsm attribute.

The key_added in the .obs which contains curvature. The key_added in the .obsm which contains curvature vectors.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_curl(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'curl', method: str = 'analytical', inplace: bool = True) anndata.AnnData | None[source]#

Calculate curl for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the torsion key in .obs.

method

The method that will be used for calculating torsion field, either 'analytical' or 'numerical'.

'analytical' method uses the analytical expressions for calculating torsion while 'numerical' method uses numdifftools, a numerical differentiation tool, for computing torsion. 'analytical' method is much more efficient.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs and .obsm attribute.

The key_added in the .obs which contains magnitude of curl. The key_added in the .obsm which contains curl vectors.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_torsion(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'torsion', method: str = 'analytical', inplace: bool = True) anndata.AnnData | None[source]#

Calculate torsion for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the torsion key in .obs and .obsm.

method

The method that will be used for calculating torsion field, either 'analytical' or 'numerical'.

'analytical' method uses the analytical expressions for calculating torsion while 'numerical' method uses numdifftools, a numerical differentiation tool, for computing torsion. 'analytical' method is much more efficient.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs and .uns attribute.

The key_added in the .obs which contains torsion. The key_added in the .uns which contains torsion matrix.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_divergence(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'divergence', method: str = 'analytical', vectorize_size: int | None = 1000, inplace: bool = True) anndata.AnnData | None[source]#

Calculate divergence for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the acceleration key in .obs and .obsm.

method

The method that will be used for calculating acceleration field, either 'analytical' or 'numerical'.

'analytical' method uses the analytical expressions for calculating acceleration while 'numerical' method uses numdifftools, a numerical differentiation tool, for computing acceleration. 'analytical' method is much more efficient.

vectorize_size

vectorize_size is used to control the number of samples computed in each vectorized batch.

  • If vectorize_size = 1, there’s no vectorization whatsoever.

  • If vectorize_size = None, all samples are vectorized.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs attribute.

The key_added in the .obs which contains divergence.

spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_jacobian(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'jacobian', method: str = 'analytical', inplace: bool = True) anndata.AnnData | None[source]#

Calculate jacobian for each cell with the reconstructed vector field function.

Parameters:
adata

AnnData object that contains the reconstructed vector field.

vf_key

The key in .uns that corresponds to the reconstructed vector field.

key_added

The key that will be used for the jacobian key in .obs and .obsm.

method

The method that will be used for calculating jacobian field, 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.

inplace

Whether to copy adata or modify it inplace.

Returns:

An AnnData object is updated/copied with the key_added in the .obs and .uns attribute.

The key_added in the .obs which contains jacobian. The key_added in the .uns which contains jacobian tensor.