Get the provenance of fits stored in a SummarizedExperiment
Source:R/fit_provenance.R
fit_provenance.Rdapply_fit and apply_fits record a recipe for
every fit in metadata(se)$provenance. These functions read it back.
Usage
get_SE_provenance(se)
get_fit_provenance(se, assay, fit_source, data_source = NULL)
summarize_fit_provenance(se)Arguments
- se
- assay
string; name of the assay holding the fit results.
- fit_source
string; value of the
fit_sourcecolumn.- data_source
string; for an SE built by
merge_SE, the name of the merged object the rows come from (thedata_sourcecolumn).NULLreads the fits done onseitself.
Value
get_SE_provenance(): the whole provenance entry, or
NULL for objects without one. get_fit_provenance(): one
recipe. summarize_fit_provenance(): a data.table with one
row per recorded fit.
Details
A recipe contains:
fn,summary_fnrecord of the function:
name,package,version,git_shaandhashfor a function from an installed package;source,captured(values the function uses from its environment),helpers(source of helper functions it calls) anddependencies(versions of the packages it calls) for any other function;infoset withset_fit_fn_info;envfor declared runtime dependencies.fit_argsarguments passed to the fit function.
called_by,data_type,input_assay,output_assay,summary_assay,slicing_cols,slicing_values,mergesettings of the call.
runR and gDRutils versions, hash of the input assay and the number of rows written.
Names listed under not_stored or args_not_stored were too
large or not plain data, so the fit cannot be fully reproduced from the
object alone.
For a summary assay, get_fit_provenance() returns the recipe of the
fit that wrote it. For an SE built by merge_SE, the recipes of
the merged objects are kept per data_source.
Examples
mae <- get_synthetic_data("finalMAE_small.qs2")
se <- mae[["single-agent"]]
se <- apply_fit(
se, fit_drug_response_metrics, "single-agent",
output_assay = "custom_hill", fit_source = "hill_loose",
fit_args = list(pcutoff = 0.1)
)
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
summarize_fit_provenance(se)
#> assay fit_source fn
#> <char> <char> <char>
#> 1: custom_hill hill_loose gDRutils::fit_drug_response_metrics (1.11.18)
#> fit_args
#> <char>
#> 1: pcutoff = 0.1
#> model
#> <char>
#> 1: 3-parameter log-logistic (drc::LL.3u), upper asymptote fixed at 1
get_fit_provenance(se, "custom_hill", "hill_loose")$fit_args
#> $pcutoff
#> [1] 0.1
#>