This function finds the rank of each gene's expression for each cell, grouped by the user defined variable. This data is used to compute the rank invariance value for each gene later with rank_invariance().

rank_cells(sce, group_col = "cellType", assay = "logcounts")

Arguments

sce

SummarizedExperiment-class object with the assay (defaults to logcounts).

group_col

name of the column in the colData() of sce that defines the group of interest.

assay

A character(1) specifying the name of the assay() in the sce object to use to rank expression values. Defaults to logcounts since it typically contains the normalized expression values.

Value

A named list() of matrix() objects. Each matrix() contains the rank values for the cells belonging to one group.

See also

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

Examples

## Rank the genes for each cell, organized by "group" column
rank_cells(sce_zero_test, group_col = "group")
#> $A_Back
#>        S011 S012 S013 S014 S015 S016 S017 S018 S019 S020 S051 S052 S053 S054
#> g100      1    2  1.5    2    1    2  1.5    2    1    2  1.5    2  1.5  2.5
#> g50       3    2  3.5    2    3    2  3.5    2    3    2  3.5    2  3.5  2.5
#> g0        5    5  5.0    5    5    5  5.0    5    5    5  5.0    5  5.0  5.0
#> gOffOn    3    4  3.5    4    3    4  3.5    4    3    4  1.5    2  1.5  2.5
#> gVar      3    2  1.5    2    3    2  1.5    2    3    2  3.5    4  3.5  2.5
#>        S055 S056 S057 S058 S059 S060 S071 S072 S073 S074 S075
#> g100    1.5  2.5  1.5  2.5    2    2  1.5    2  1.5  2.5  1.5
#> g50     3.5  2.5  3.5  2.5    4    2  3.5    2  3.5  2.5  3.5
#> g0      5.0  5.0  5.0  5.0    5    5  5.0    5  5.0  5.0  5.0
#> gOffOn  1.5  2.5  1.5  2.5    2    2  1.5    2  1.5  2.5  1.5
#> gVar    3.5  2.5  3.5  2.5    2    4  3.5    4  3.5  2.5  3.5
#> 
#> $A_Front
#>        S001 S002 S003 S004 S005 S006 S007 S008 S009 S010 S021 S022 S023 S024
#> g100    1.5    2  1.5    2  1.5    2  1.5    2  1.5  2.0  1.5    2  1.5    2
#> g50     3.5    2  3.5    2  3.5    2  3.5    2  3.5  2.0  3.5    2  3.5    2
#> g0      5.0    5  5.0    5  5.0    5  5.0    5  5.0  4.5  5.0    5  5.0    5
#> gOffOn  3.5    4  3.5    4  3.5    4  3.5    4  3.5  4.5  3.5    4  3.5    4
#> gVar    1.5    2  1.5    2  1.5    2  1.5    2  1.5  2.0  1.5    2  1.5    2
#>        S025 S061 S062 S063 S064 S065 S066 S067 S068 S069 S070
#> g100      1    2    2  1.5  2.5  1.5  2.5  1.5    2  1.5    2
#> g50       3    4    2  3.5  2.5  3.5  2.5  3.5    2  3.5    2
#> g0        5    5    5  5.0  5.0  5.0  5.0  5.0    5  5.0    5
#> gOffOn    3    2    2  1.5  2.5  1.5  2.5  1.5    2  1.5    2
#> gVar      3    2    4  3.5  2.5  3.5  2.5  3.5    4  3.5    4
#> 
#> $B_Back
#>        S031 S032 S033 S034 S035 S036 S037 S038 S039 S040 S076 S077 S078 S079
#> g100    1.5  1.5  1.5    2    1    2  1.5    2  1.5  1.5    2  1.5  2.5  1.5
#> g50     3.5  1.5  3.5    2    3    2  3.5    2  3.5  1.5    2  3.5  2.5  3.5
#> g0      5.0  5.0  5.0    5    5    5  5.0    5  5.0  5.0    5  5.0  5.0  5.0
#> gOffOn  3.5  3.5  3.5    4    3    4  3.5    4  3.5  3.5    2  1.5  2.5  1.5
#> gVar    1.5  3.5  1.5    2    3    2  1.5    2  1.5  3.5    4  3.5  2.5  3.5
#>        S080 S091 S092 S093 S094 S095 S096 S097 S098 S099 S100
#> g100      2  1.5    2  1.5    2  1.5    2  1.5    2  1.5    2
#> g50       2  3.5    2  3.5    2  3.5    2  3.5    2  3.5    2
#> g0        5  5.0    5  5.0    5  5.0    5  5.0    5  5.0    5
#> gOffOn    2  1.5    2  1.5    2  1.5    2  1.5    2  1.5    2
#> gVar      4  3.5    4  3.5    4  3.5    4  3.5    4  3.5    4
#> 
#> $B_Front
#>        S026 S027 S028 S029 S030 S041 S042 S043 S044 S045 S046 S047 S048 S049
#> g100    1.5    1  1.5  1.5    2  1.5    2    1    2  1.5    2    1  1.5  1.5
#> g50     1.5    3  1.5  3.5    2  3.5    2    3    2  3.5    2    3  1.5  3.5
#> g0      5.0    5  5.0  5.0    5  5.0    5    5    5  5.0    5    5  5.0  5.0
#> gOffOn  3.5    3  3.5  3.5    4  3.5    4    3    4  3.5    4    3  3.5  3.5
#> gVar    3.5    3  3.5  1.5    2  1.5    2    3    2  1.5    2    3  3.5  1.5
#>        S050 S081 S082 S083 S084 S085 S086 S087 S088 S089 S090
#> g100    1.5  1.5  2.5  1.5    2  1.5    2    2    2  1.5    2
#> g50     1.5  3.5  2.5  3.5    2  3.5    2    4    2  3.5    2
#> g0      5.0  5.0  5.0  5.0    5  5.0    5    5    5  5.0    5
#> gOffOn  3.5  1.5  2.5  1.5    2  1.5    2    2    2  1.5    2
#> gVar    3.5  3.5  2.5  3.5    4  3.5    4    2    4  3.5    4
#>