Retrieves a fully-specified AnalysisSpec object from a Cohort's registry by name. Useful for accessing all properties of a registered analysis (description, path_template, key_cols, etc.).
See also
analysis_register() for registering specs,
analysis_list() for listing all registered specs
Examples
# Create and register a spec
study <- study_new(study_id = "STUDY001", title = "My Study")
manifest <- data.frame(
subject_id = c("S1", "S1", "S2", "S2"),
species = c("rat", "rat", "rat", "rat"),
assay = c("wes", "wes", "wes", "wes"),
sample_id = c("WES_T1", "WES_N1", "WES_T2", "WES_N2"),
role = c("tumor", "normal", "tumor", "normal")
)
parsed <- validate_manifest(manifest)
cohort <- cohort_new(
subject_tbl = parsed$subject_tbl,
sample_map = parsed$sample_map,
study = study
)
spec <- analysis_spec_new(
name = "somatic_vars",
assay = "wes",
level = "pair",
format = "tsv",
reader = "read_tsv",
key_cols = c("pair_id")
)
cohort_with_spec <- analysis_register(cohort, spec)
# Retrieve the spec
retrieved_spec <- analysis_spec(cohort_with_spec, "somatic_vars")
print(retrieved_spec@reader) # "read_tsv"
#> [1] "read_tsv"