
Consolidate biomarker scores
Source:R/translate_and_consolidate.R
translate_and_consolidate_scores.Rd
This function translates numerical scores of biomarkers to nominal scores and consolidates them for each case.
Usage
translate_and_consolidate_scores(
biomarkers_file,
required_biomarkers = NULL,
get_dict = NULL,
output_file = NULL
)
Arguments
- biomarkers_file
Path to the Excel file containing biomarker data.
- required_biomarkers
A vector of required biomarkers. If NULL, default biomarkers are used.
- get_dict
A function that returns a dictionary for translating numerical scores to nominal scores. If NULL, a default function is used.
- output_file
Optional path to the output file. If NULL, the function will not save the output.
See also
get_default_dict
for the default dictionary function.
Examples
library(TMAtools)
# grab folder with example TMA datasets
tma_dir <- system.file("extdata", "tma1", package = "TMAtools")
# define output files
combined_tma_file <- "combined_tma.xlsx"
deconvoluted_tma_file <- "deconvoluted_tma.xlsx"
consolidated_tma_file <- "consolidated_tma.xlsx"
# combine TMA datasets
combine_tma_spreadsheets(
tma_dir = tma_dir,
output_file = combined_tma_file
)
#> Using TMA map from the file: /home/runner/work/_temp/Library/TMAtools/extdata/tma1/example_er.xlsx
# deconvolute combined TMA dataset
deconvolute(
tma_file = combined_tma_file,
output_file = deconvoluted_tma_file
)
# translate numerical biomarker scores to nominal scores
# and consolidate them for each case
consolidated_data <- translate_and_consolidate_scores(
biomarkers_file = deconvoluted_tma_file,
required_biomarkers = c("ER", "TP53")
)
#> Consolidating ER using columns: ER.c1, ER.c2
#> Consolidating TP53 using columns: TP53.c1, TP53.c2
head(consolidated_data)
#> # A tibble: 6 × 7
#> core_id ER.c1 ER.c2 er TP53.c1 TP53.c2 tp53
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 1 Unk Unk Unk cytoplasmic complete absence mutated
#> 2 5 diffuse (>50%) diffuse (>50%) diffuse (>50%) Unk subclonal mutated
#> 3 9 Unk Unk Unk cytoplasmic subclonal mutated
#> 4 11 Unk Unk Unk subclonal wild type mutated
#> 5 2 Unk focal (1-50%) focal (1-50%) subclonal Unk mutated
#> 6 6 Unk focal (1-50%) focal (1-50%) Unk Unk Unk