get_sigcell_simple: get_sigcell_simple

View source: R/get_sigcell_simple.R

get_sigcell_simpleR Documentation

get_sigcell_simple

Description

a function to determine statistically trait-enriched cell by permutation test.

Usage

get_sigcell_simple(
  knn_sparse_mat,
  seed_idx,
  topseed_npscore,
  permutation_times = 1000,
  true_cell_significance = 0.05,
  rda_output = FALSE,
  out_rda = tempfile(fileext = "true_cell_df.rda"),
  mycores = 1,
  rw_gamma = 0.05
)

Arguments

knn_sparse_mat

a sparse matrix used for network propagation, which indicates the adjacent matrix (m x m, where m is the cell number) of cell-to-cell network (M-kNN graph)

seed_idx

a logical vector indicating seed cells (TRUE) and non-seed cells (FALSE) with length of m, where m is the cell number. The length and position are corresponding to knn_sparse_mat

topseed_npscore

a numeric vector of real network propagation score

permutation_times

an integer describe times of permutation test for each cell

true_cell_significance

a numeric value between 0-1 indicating the significant threshold used to determine statistically trait-enriched cell

rda_output

if output details of each permutation as a rda

out_rda

if rda_output=T, an rda will be outputed with path and name specified

mycores

how many cores used for permutation test

rw_gamma

gamma from randomWalk_sparse function. Keep the same with what you used in the real setting

Value

A dataframe with two columns, the first one is seed index (the same with input), the second one is significance from permutation test. In addition, an R data is generated, which contains this dataframe and another dataframe depicting the network propagation score for each cell at each permuation.

Examples

knn_sparse_mat <- example_results$mutualknn30
mono_mat <- example_results$mono_mat
ture_cell_df <- get_sigcell_simple(knn_sparse_mat=knn_sparse_mat,
                                   seed_idx=mono_mat$seed_idx,
                                   topseed_npscore=mono_mat$np_score,
                                   permutation_times=100)

sankaranlab/SCAVENGE documentation built on March 2, 2023, 2:17 a.m.