testTree {treekoR} | R Documentation

## testTree

### Description

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

### Usage

    testTree(
      phylo,
      clusters,
      samples,
      classes,
      sig_test = "ttest",
      pos_class_name = NULL
    )

### Arguments

`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
`sig_test` | a character, either "ttest" or "wilcox" indicating the significance test to be used
`pos_class_name` | a character indicating which class is positive

### Value

a ggtree object with significance testing results in embedded data

### Examples

    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,
                            sig_test="ttest",
                            pos_class_name=NULL)

[Package treekoR version 1.2.1 Index]