Skip to contents

From per-cell calls, take highest freq call in each cluster

Usage

collapse_to_cluster(res, metadata, cluster_col, threshold = 0)

Arguments

res

dataframe of idents, such as output of cor_to_call

metadata

input metadata with tsne or umap coordinates and cluster ids

cluster_col

metadata column for cluster

threshold

minimum correlation coefficent cutoff for calling clusters

Value

new metadata with added columns

Examples

res <- clustify(
    input = pbmc_matrix_small,
    metadata = pbmc_meta,
    cluster_col = "classified",
    ref_mat = cbmc_ref,
    per_cell = TRUE
)
#> Variable features not available, using all genes instead
#> consider supplying variable features to `query_genes` argument.
#> using # of genes: 599
#> similarity computation completed, matrix of 2638 x 13, preparing output

res2 <- cor_to_call(res)

collapse_to_cluster(
    res2,
    metadata = pbmc_meta,
    cluster_col = "classified",
    threshold = 0
)
#> # A tibble: 9 × 4
#> # Groups:   classified [9]
#>   classified   type    sum     n
#>   <fct>        <chr> <dbl> <int>
#> 1 Naive CD4 T  CD4 T 95.3    237
#> 2 Memory CD4 T CD4 T 66.9    165
#> 3 CD14+ Mono   CD4 T 67.2    169
#> 4 B            CD4 T 37.4     95
#> 5 CD8 T        CD4 T 31.1     79
#> 6 FCGR3A+ Mono CD4 T 17.5     44
#> 7 NK           CD4 T 17.7     45
#> 8 DC           NK     3.96     9
#> 9 Platelet     CD4 T  1.62     4