testTree {treekoR} | R Documentation |
This function takes a hierarchical tree of the cluster medians of a cytometry dataset, and then uses this structure to perform t-tests between conditions of patients testing for difference using the proportion of cluster relative to sample's n and proportion of cluster relative to sample's n of hierarchical parent cluster. Takes a ggtree object and returns a ggtree object with testing results appended in the data
testTree( phylo, clusters, samples, classes, pos_class_name = NULL, subjects = NULL, paired = FALSE )
phylo |
a ggtree object |
clusters |
a vector representing the cell type or cluster of each cell (can be character or numeric). If numeric, cluster names need to be consecutive starting from 1. |
samples |
a vector identifying the patient each cell belongs to |
classes |
a vector containing the patient outcome/class each cell belongs to |
pos_class_name |
a character indicating which class is positive |
subjects |
a vector containing which subject the cell belongs to, used to identify matched samples in paired t-tests (not yet tested) |
paired |
a boolean indicating whether to performed paired t-tests (not yet tested) |
a ggtree object with significance testing results in embedded data
library(SingleCellExperiment) data(COVIDSampleData) sce <- DeBiasi_COVID_CD8_samp exprs <- t(assay(sce, "exprs")) clusters <- colData(sce)$cluster_id classes <- colData(sce)$condition samples <- colData(sce)$sample_id clust_tree <- getClusterTree(exprs, clusters, hierarchy_method="hopach") tested_tree <- testTree(clust_tree$clust_tree, clusters=clusters, samples=samples, classes=classes, pos_class_name=NULL, subjects=NULL, paired = FALSE)