Skip to contents

[Experimental]

A function to help with merging of MAE to ADTTE.

Usage

h_km_mae_to_adtte(
  adtte,
  mae,
  genes,
  experiment_name = "hd1",
  assay_name = "counts",
  usubjid_var = "USUBJID"
)

Arguments

adtte

(data frame)
an adtte dataset.

mae

(MultiAssayExperiment)
contains AnyHermesData objects.

genes

(GeneSpec)
specification for gene(s) (signature), e.g. using hermes::gene_spec().

experiment_name

(string)
the desired HermesData to use.

assay_name

(string)
the assay to define the groups.

usubjid_var

(string)
variable name of the subject ID variable.

Value

A data frame containing all columns/rows from adtte that match by subject ID with the row names of the MAE and have the gene samples available in the given experiment. The attribute gene_cols contains the column names for the gene columns.

Note

The final gene column names can start with a different string than the original gene IDs (or labels), in particular white space and colons are removed.

Examples

mae <- hermes::multi_assay_experiment
adtte <- scda::synthetic_cdisc_data("rcd_2021_07_07")$adtte %>%
  dplyr::mutate(CNSR = as.logical(CNSR))

new_adtte <- h_km_mae_to_adtte(
  adtte,
  mae,
  genes = hermes::gene_spec("GeneID:1820"),
  experiment_name = "hd2"
)
new_adtte2 <- h_km_mae_to_adtte(
  adtte,
  mae,
  genes = hermes::gene_spec(c("GeneID:1820", "GeneID:94115"), fun = colMeans),
  experiment_name = "hd2"
)
new_adtte3 <- h_km_mae_to_adtte(
  adtte,
  mae,
  genes = hermes::gene_spec(c(A = "GeneID:1820", B = "GeneID:94115")),
  experiment_name = "hd2"
)