Skip to contents

Function to do general pre-processing on top of the BulkCoExp(). Options to do scaling, HVG selection, etc.

Usage

preprocess_bulk_coexp(
  object,
  hvg = NULL,
  mad_threshold = NULL,
  scaling = FALSE,
  scaling_type = c("normal", "robust"),
  .verbose = TRUE
)

Arguments

object

The underlying class, see BulkCoExp().

hvg

Integer or float. If an integer, the top hvg genes will be included; if float, the float has to be between 0 and 1, representing the percentage of genes to include.

mad_threshold

Float. Instead of of selecting number or proportion of genes, you can also provide a mad_threshold.

scaling

Boolean. Shall the data be scaled.

scaling_type

String. You have the option to use normal scaling or robust scaling.

.verbose

Boolean. Controls the verbosity of the function.

Value

Returns the class with the processed_data data slot populated and applied parameters added to the params slot.

Examples

# keep the 200 most variable genes for module detection
syn <- synthetic_bulk_cor_matrix()
mat <- log1p(t(syn$counts))
meta <- data.table::data.table(sample_id = rownames(mat))
object <- BulkCoExp(raw_data = mat, meta_data = meta)
object <- preprocess_bulk_coexp(object, hvg = 200L, .verbose = FALSE)
object
#> Bulk co-expression module class (BulkCoExp).
#>  Pre-processing done: TRUE.
#>   Number of HVG: 200.