Skip to contents

This function wraps the monocle3 method for data projection and label transfer into a function. This function takes in reference and query cds objects plus a character vector of label column names and returns the query CDS with the new labels.

bb_monocle_anno and bb_monocle_project use similar inputs and methods and both return cds objects, but the cds objects are different. Both wrap around the monocle3 mehtod for data projection and label transfer.

bb_monocle_anno takes in reference and query cds objects plus a character vector of label column names to transfer. It returns the query CDS with new cell metadata contining one or more columns with the labels corresponding to the nearest neighbor in the reference data. A suffix is appended to the new column name in the result. By default this is "_ref" but it can be changed using the suffix parameter.

bb_monocle_project also takes in reference and query cds objects and character vector of label column names. In this case, a combined cds object is returned carrying the query and reference data projected int the reference data space. New column names are added indicating the reference and query data. The query cells are given the label of their nearest neighbor in the reference. These label column(s) are prepended with "merged_".

Importantly, for both of these to work, the reference and query genes must have a shared namespace.

Usage

bb_monocle_(cds_qry, cds_ref, labels, suffix, use_aligned)

bb_monocle_anno(cds_qry, cds_ref, labels, suffix = "_ref", use_aligned = TRUE)

bb_monocle_project(
  cds_qry,
  cds_ref,
  labels,
  suffix = "_ref",
  use_aligned = TRUE
)

Arguments

cds_qry

A query cell data set.

cds_ref

A reference cell data set.

labels

A character vector of cell metadata column names to transfer.

suffix

A character string of length 1 to append to all of the tranferred column names. There is no checking for name conflicts, so use this sensibly to prevent overwriting preexisting columns. Default = "_ref".

use_aligned

Whether to use aligned PCA coordinates from cds_ref, if they are available. Default = TRUE.

Value

A cell data set

Details

see https://cole-trapnell-lab.github.io/monocle3/docs/projection/

Examples

if (FALSE) { # \dontrun{
if(interactive()){
 #EXAMPLE1
 }
} # }