scvi.external.decipher.utils.Trajectory#

class scvi.external.decipher.utils.Trajectory(rep_key, cluster_locations, cluster_ids, point_density=50)[source]#

A class that defines a trajectory through a latent space.

This class creates a trajectory through a latent space by connecting a sequence of points (e.g., cluster centroids) with straight lines. The trajectory is parameterized by time, where time 0 corresponds to the first point and increases linearly with distance along the trajectory.

Parameters:
  • rep_key (str) – Obsm key for the latent representation being used

  • cluster_locations (np.ndarray) – Array of coordinates for points to connect, shape (n_points, n_dimensions)

  • cluster_ids (List[str]) – List of cluster IDs corresponding to the locations

  • point_density (int, default=50) – Number of interpolated points per unit distance in the latent space

trajectory_latent#

Coordinates of points along the interpolated trajectory

Type:

np.ndarray

trajectory_time#

Time values corresponding to each point in trajectory_latent

Type:

np.ndarray

cumulative_length#

Cumulative distance along the trajectory at each cluster location

Type:

np.ndarray

cluster_locations#

Original cluster locations used to create the trajectory

Type:

np.ndarray

n_points#

Total number of points in the interpolated trajectory

Type:

int

Methods table#

at_time(t)

Get the coordinates at a specific time point along the trajectory.

from_dict(d)

Create a Trajectory object from a dictionary representation.

to_dict()

Convert trajectory object to dictionary representation.

Methods#

Trajectory.at_time(t)[source]#

Get the coordinates at a specific time point along the trajectory.

Parameters:

t (float) – Time point along the trajectory.

Return type:

ndarray

Returns:

np.ndarray Coordinates at the specified time point.

static Trajectory.from_dict(d)[source]#

Create a Trajectory object from a dictionary representation.

Parameters:

d (Dict[str, Any]) – Dictionary containing trajectory data.

Return type:

Trajectory

Returns:

Trajectory New Trajectory object initialized with data from dictionary.

Trajectory.to_dict()[source]#

Convert trajectory object to dictionary representation.

Return type:

dict[str, Any]

Returns:

Dict[str, Any] Dictionary containing trajectory data including cluster locations, cluster IDs, trajectory points, times, point density and representation key.