Skip to contents

Classification function that takes in input dataset (in BPCells format), alongside created models and the tree structure and provides a vector of classifications.

Usage

Classify(bpcells_query, models, tree_struc, prop_max_threshold = 0.66)

Arguments

bpcells_query

Query dataset already aligned to reference dataset used to find marker genes and create models.

models

Models created through GetMarkerGenes function.

prop_max_threshold

Proportion of evidence required for a test

tree

Tree used in model creation.

Value

A vector providing classifications of cells in bpcells_query in the same order. Performs specific unit testing on each run through. Unit test 1: all remaining cells assigned to internal nodes Unit test 2: expected number of elements returned

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_label_column = "cell_label")
#> Error in FindMarkerGenes(ref_bpcells = train_ex_data_bpcells, ref_metadata = train_ex_metadata,     tree = equal_tree, metadata_cluster_column = "seurat_annotations",     metadata_cell_label_column = "cell_label"): unused argument (metadata_cell_label_column = "cell_label")
models <- GetModels(marker_genes = marker_genes, ref_bpcells = train_ex_data_bpcells, ref_metadata = train_ex_metadata, tree = equal_tree, metadata_cluster_column = "seurat_annotations", metadata_cell_label_column = "cell_label")
#> Error in GetModels(marker_genes = marker_genes, ref_bpcells = train_ex_data_bpcells,     ref_metadata = train_ex_metadata, tree = equal_tree, metadata_cluster_column = "seurat_annotations",     metadata_cell_label_column = "cell_label"): unused argument (metadata_cell_label_column = "cell_label")
query_classifications = Classify(bpcells_query = test_ex_data_bpcells,models = models,tree_struc = equal_tree)
#> Error in UseMethod("rootnode"): no applicable method for 'rootnode' applied to an object of class "treedata"