Testing multiple K for RUV4 batch correction to find the best K.

findBestK(
  spe,
  maxK = 10,
  factor_of_int,
  factor_batch,
  NCGs,
  point_size = 3,
  line_col = "black",
  point_col = "black",
  text_size = 13
)

Arguments

spe

A Spatial Experiment object.

maxK

Integer. The max k to test, will test k from 1 to maxK, by default is 10.

factor_of_int

Column name(s) to indicate the factors of interest. This is required for the RUV4 method.

factor_batch

Column name to indicate the batch.

NCGs

Negative control genes. This is required for the RUV4 method.

point_size

Numeric. Plotting parameter.

line_col

Character. Plotting parameter.

point_col

Character. Plotting parameter.

text_size

Numeric. Plotting parameter.

Value

A ggplot object.

Examples

data("dkd_spe_subset")
spe <- findNCGs(dkd_spe_subset, top_n = 100)
#> New names:
#>  `cv` -> `cv...1`
#>  `cv` -> `cv...2`
#>  `cv` -> `cv...3`
#>  `cv` -> `cv...4`
#>  `cv` -> `cv...5`
#>  `cv` -> `cv...6`
#>  `cv` -> `cv...7`
findBestK(spe,
  factor_of_int = c("disease_status"),
  factor_batch = "SlideName", NCGs = S4Vectors::metadata(spe)$NCGs
)