dynwrap (version 1.2.2)

add_dimred: Add or create a dimensionality reduction

Description

This can also perform dimensionality reduction of

  • The projected expression state with RNA velocity, only if dimred is a function and pair_with_velocity=TRUE

  • The trajectory, by projecting the milestones and some "waypoints" to the reduced space, only if dataset contains a trajectory

Usage

add_dimred(
  dataset,
  dimred,
  dimred_milestones = NULL,
  dimred_segment_progressions = NULL,
  dimred_segment_points = NULL,
  project_trajectory = TRUE,
  connect_segments = FALSE,
  pair_with_velocity = !is.null(dataset$expression_future),
  expression_source = "expression",
  ...
)

is_wrapper_with_dimred(dataset)

get_dimred( dataset, dimred = NULL, expression_source = "expression", return_other_dimreds = FALSE )

Value

A dataset object with dimred, which is a numeric matrix with cells in rows and the different components in columns.

  • If the dataset contained a trajectory, and project_trajectory=TRUE (default), dimred_milestones, dimred_segment_progressions and dimred_segment_points will also be present. These are described in project_trajectory().

Arguments

dataset

A dataset created by wrap_data() or wrap_expression()

dimred

Can be

  • A function which will perform the dimensionality reduction, see dyndimred::list_dimred_methods()

  • A matrix with the dimensionality reduction, with cells in rows and dimensions (comp_1, comp_2, ...) in columns

dimred_milestones

An optional dimensionality reduction of the milestones. A matrix with milestones in rows and components (comp_1, comp_2, ...) in columns

This will be automatically calculated if project_trajectory = TRUE

dimred_segment_progressions, dimred_segment_points

An optional set of points along the trajectory with their dimensionality reduction. dimred_segment_progressions is a dataframe containing the from and to milestones, and their progression. dimred_segment_points is a matrix with points (the same number as in dimred_segment_progressions) in rows and components (comp_1, comp_2, ...) in columns. Both objects have the same number of rows.

These will be automatically calculated if project_trajectory = TRUE

project_trajectory

Whether to also project the trajectory. Only relevant if dataset contains a trajectory, and dimred_segment_progressions and dimred_segment_points are not provided

connect_segments

Whether to connect segments between edges

pair_with_velocity

Can perform dimensionality reduction if dimred is a function.

expression_source

The source of expression, can be "counts", "expression", an expression matrix, or another dataset which contains expression

...

extra information to be stored in the wrapper

return_other_dimreds

Whether or not to return also the milestone dimreds and the segment dimreds, if available.

See Also

dyndimred::list_dimred_methods(), project_trajectory()

Examples

Run this code
if (requireNamespace("dyndimred", quietly = TRUE)) {
  dataset <- example_dataset
  dataset <- add_dimred(
    dataset,
    dyndimred::dimred_landmark_mds
  )
  head(dataset$dimred)
}

Run the code above in your browser using DataCamp Workspace