This function computes the Rank Invariance value for each gene, from the cell and group ranks computed by rank_cells() and rank_group() respectively. Genes with high RI values are considered good candidate TREGs.

rank_invariance(group_rank, cell_rank)

Arguments

group_rank

A data.frame() created with rank_group().

cell_rank

A data.frame() created with rank_cells().

Value

A numeric() with the rank of invariance for each gene. High values represent low Rank Invariance, these genes are considered good candidate TREGs.

See also

Other invariance functions: rank_cells(), rank_group(), rank_invariance_express()

Examples

## Get the rank of the gene in each group
group_rank_test <- rank_group(sce_zero_test, group_col = "group")

## Get the rank of the gene for each cell
cell_rank_test <- rank_cells(sce_zero_test, group_col = "group")

## Use both rankings to calculate rank_invariance
rank_invar_test <- rank_invariance(group_rank_test, cell_rank_test)
## Highest RI value is best candidate TREG
sort(rank_invar_test, decreasing = TRUE)
#>     g0    g50   g100   gVar gOffOn 
#>      5      4      3      2      1