Skip to contents

Finds marker genes at each hierarchical level specified by the tree, using the GE matrix provided in the ref_bpcells parameter, and the celltype labels provided in the input to ref_metadata. It identifies marker genes by using a function provided in the BPCells package, marker_features, which finds genes using the Wilcoxon test.

Usage

FindMarkerGenes(
  ref_bpcells,
  ref_metadata,
  tree,
  n_genes = 50,
  metadata_cluster_column = "cell_type",
  metadata_cell_id_column = "cellid",
  n_cells_sampled = 500
)

Arguments

ref_bpcells

A GE reference dataset in BPCells format.

ref_metadata

A dataframe with metadata that includes a column providing celltype labels used for classification and a column providing cell ids.

tree

A tree structure (in treedata format) to find marker genes for. Will find marker genes that distinguish pairs of classes at each level of the hierarchy.

n_genes

Number of marker genes, per pairwise class, you want to find.

metadata_cluster_column

The name of the column in the metadata giving the celltype labels.

metadata_cell_id_column

The name of the column in the metadata giving the cell IDs.

n_cells_sampled

Number of cells per class used to find marker genes.

Value

A list providing marker genes that distinguish each pairwise combination of celltypes, at each level of the hierarchy in the tree you provided.

Examples

data("train_ex_data_bpcells")
data("train_ex_metadata")
data("test_ex_data_bpcells")
data("test_ex_metadata")
possible_cell_classes = train_ex_metadata$seurat_annotations %>% unique()
equal_tree = CreateEqualTree(cell_labels = possible_cell_classes)
marker_genes = FindMarkerGenes(ref_bpcells = train_ex_data_bpcells, ref_metadata = train_ex_metadata, tree = equal_tree, metadata_cluster_column = "seurat_annotations", metadata_cell_id_column = "cell_label")
#> Test passed ๐Ÿฅ‡
#> Test passed ๐ŸŽŠ
#> Test passed ๐ŸŒˆ
#> Test passed ๐ŸŽŠ
#> Test passed ๐Ÿฅ‡
#> Error in loadNamespace(x): there is no package called โ€˜BPCellsโ€™