Skip to contents

get top calls for each cluster

Usage

cor_to_call_topn(
  cor_mat,
  metadata = NULL,
  col = "cluster",
  collapse_to_cluster = FALSE,
  threshold = 0,
  topn = 2
)

Arguments

cor_mat

input similarity matrix

metadata

input metadata with tsne or umap coordinates and cluster ids

col

metadata column, can be cluster or cellid

collapse_to_cluster

if a column name is provided, takes the most frequent call of entire cluster to color in plot

threshold

minimum correlation coefficent cutoff for calling clusters

topn

number of calls for each cluster

Value

dataframe of cluster, new potential ident, and r info

Examples

res <- clustify(
    input = pbmc_matrix_small,
    metadata = pbmc_meta,
    ref_mat = cbmc_ref,
    query_genes = pbmc_vargenes,
    cluster_col = "classified"
)
#> using # of genes: 599
#> similarity computation completed, matrix of 9 x 13, preparing output

cor_to_call_topn(
    cor_mat = res,
    metadata = pbmc_meta,
    col = "classified",
    collapse_to_cluster = FALSE,
    threshold = 0.5
)
#> # A tibble: 18 × 3
#> # Groups:   classified [9]
#>    classified   type                  r
#>    <chr>        <chr>             <dbl>
#>  1 B            B                 0.909
#>  2 B            CD4 T             0.641
#>  3 CD14+ Mono   CD14+ Mono        0.915
#>  4 CD14+ Mono   CD16+ Mono        0.892
#>  5 CD8 T        NK                0.826
#>  6 CD8 T        CD8 T             0.769
#>  7 DC           DC                0.849
#>  8 DC           CD16+ Mono        0.752
#>  9 FCGR3A+ Mono CD16+ Mono        0.929
#> 10 FCGR3A+ Mono CD14+ Mono        0.843
#> 11 Memory CD4 T CD4 T             0.861
#> 12 Memory CD4 T CD8 T             0.835
#> 13 NK           NK                0.894
#> 14 NK           CD8 T             0.693
#> 15 Naive CD4 T  CD4 T             0.889
#> 16 Naive CD4 T  CD8 T             0.871
#> 17 Platelet     Mk                0.732
#> 18 Platelet     r<0.5, unassigned 0.307