Learn R Programming

cellGeometry (version 0.5.7)

tune_deconv: Tune deconvolution parameters

Description

Performs an exhaustive grid search over a tuning grid of cell marker and deconvolution parameters for either updateMarkers() (e.g. expfilter or nsubclass) or deconvolute() (e.g. comp_amount).

Usage

tune_deconv(
  mk,
  test,
  samples,
  grid,
  output = "output",
  metric = "RMSE",
  method = "top",
  verbose = TRUE,
  cores = 1,
  ...
)

Value

Dataframe with class 'tune_deconv' whose columns include: the parameters being tuned via grid, cell subclass and R squared.

Arguments

mk

cellMarkers class object

test

matrix of bulk RNA-Seq to be deconvoluted. Passed to deconvolute().

samples

matrix of cell amounts with subclasses in columns and samples in rows. Note that if this has been generated by simulate_bulk(), using a value of times other than 1, then it is important that this is adjusted for here.

grid

Named list of vectors for the tuning grid similar to expand.grid(). Names represent the parameter to be tuned which must be an argument in either updateMarkers() or deconvolute(). The elements of each vector are the values to be tuned for each parameter.

output

Character value, either "output" or "percent" specifying which output from the subclass results element resulting from a call to deconvolute(). This deconvolution result is compared against the actual sample cell numbers in samples, using metric_set().

metric

Specifies tuning metric to choose optimal tune: either "RMSE", "Rsq" or "pearson".

method

Either "top" or "overall". Determines how best parameter values are chosen. With "top" the single top configuration is chosen. With "overall", the average effect of varying each parameter is calculated using the mean R-squared across all variations of other parameters. This can give a more stable choice of final tuning.

verbose

Logical whether to show progress.

cores

Number of cores for parallelisation via parallel::mclapply(). Parallelisation is not available on windows.

...

Optional arguments passed to deconvolute() to control fixed settings.

Details

Tuning plots on the resulting object can be visualised using plot_tune(). If best_tune is set to "overall", this corresponds to setting subclass = NULL in plot_tune().

Once the results output has been generated, arguments such as metric or method can be changed to see different best tunes using summary() (see summary.tune_deconv()).

test and samples matrices can be generated by simulate_bulk() and generate_samples() based on the original scRNA-Seq count dataset.

See Also

plot_tune() summary.tune_deconv()