Extract the top genes from the Cepo output

topGenes(object, n = 5, returnValues = FALSE)

Arguments

object

Output from the Cepo function

n

Number of top genes to extract

returnValues

Whether to return the numeric value associated with the top selected genes

Value

Returns a list of key genes.

Examples

set.seed(1234)
n <- 50 ## genes, rows
p <- 100 ## cells, cols
exprsMat <- matrix(rpois(n * p, lambda = 5), nrow = n)
rownames(exprsMat) <- paste0('gene', 1:n)
colnames(exprsMat) <- paste0('cell', 1:p)
cellTypes <- sample(letters[1:3], size = p, replace = TRUE)
cepo_output <- Cepo(exprsMat = exprsMat, cellTypes = cellTypes)
cepo_output
#> $stats
#> DataFrame with 50 rows and 3 columns
#>                a          b           c
#>        <numeric>  <numeric>   <numeric>
#> gene38  0.551471  -0.441176 -0.11029412
#> gene41  0.404412  -0.411765  0.00735294
#> gene29  0.330882   0.117647 -0.44852941
#> gene21  0.325980  -0.181373 -0.14460784
#> gene32  0.321078  -0.289216 -0.03186275
#> ...          ...        ...         ...
#> gene1  -0.370098 0.05637255   0.3137255
#> gene24 -0.375000 0.12500000   0.2500000
#> gene45 -0.379902 0.00245098   0.3774510
#> gene2  -0.448529 0.33088235   0.1176471
#> gene4  -0.531863 0.57107843  -0.0392157
#> 
#> $pvalues
#> NULL
#> 
#> attr(,"class")
#> [1] "Cepo" "list"
topGenes(cepo_output, n = 2)
#> $a
#> [1] "gene38" "gene41"
#> 
#> $b
#> [1] "gene4"  "gene34"
#> 
#> $c
#> [1] "gene8"  "gene45"
#> 
topGenes(cepo_output, n = 2, returnValues = TRUE)
#> $a
#>    gene38    gene41 
#> 0.5514706 0.4044118 
#> 
#> $b
#>     gene4    gene34 
#> 0.5710784 0.5269608 
#> 
#> $c
#>     gene8    gene45 
#> 0.3897059 0.3774510 
#>