bin_specificity_into_quantiles is an internal function used to convert add '$specificity_quantiles' to a ctd

bin_specificity_into_quantiles(
  ctdIN,
  numberOfBins,
  matrix_name = "specificity_quantiles",
  as_sparse = TRUE,
  verbose = TRUE
)

Arguments

ctdIN

A single annotLevel of a ctd, i.e. ctd[[1]] (the function is intended to be used via apply).

numberOfBins

Number of quantile 'bins' to use (40 is recommended).

matrix_name

Name of the specificity matrix to create (default: "specificity_quantiles").

as_sparse

Convert to sparseMatrix.

verbose

Print messages.

Value

A ctd with "specificity_quantiles" matrix in each level (or whatever matrix_name was set to.).

Examples

ctd <- ewceData::ctd()
#> see ?ewceData and browseVignettes('ewceData') for documentation
#> loading from cache
ctd <- lapply(ctd, EWCE::bin_specificity_into_quantiles, numberOfBins = 40)
#> Converting to sparse matrix.
#> Converting to sparse matrix.
print(ctd[[1]]$specificity_quantiles[1:3, ])
#> 3 x 7 sparse Matrix of class "dgCMatrix"
#>         astrocytes_ependymal endothelial-mural interneurons microglia
#> Tspan12                   33                38           19        16
#> Tshz1                     31                33           24        32
#> Fnbp1l                    15                33           31        16
#>         oligodendrocytes pyramidal CA1 pyramidal SS
#> Tspan12                9            10            5
#> Tshz1                 21             3           18
#> Fnbp1l                 9            12           37