R/rank_invariance.R
rank_invariance.Rd
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)
A data.frame()
created with rank_group()
.
A data.frame()
created with rank_cells()
.
A numeric()
with the rank of invariance for each gene. High values
represent low Rank Invariance, these genes are considered good candidate TREGs.
Other invariance functions:
rank_cells()
,
rank_group()
,
rank_invariance_express()
## 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