Skip to main content

Split united hierarchy keys into their component columns

Description

prolfqua unites hierarchy columns that are configured as several columns (e.g. ‘proteinID’ and ‘idtype2’ for ‘protein_Id’) with ‘config$sep’. This adds the components back as columns, after each key column, for the hierarchy levels up to ‘config$hierarchy_depth’.

Usage

separate_hierarchy(data, config)

Arguments

data data.frame with the united hierarchy key columns
config [prolfqua::AnalysisConfiguration]

Value

‘data’ with each hierarchy key at the current depth split at ‘config$sep’ into its component columns, which are added after the key column; keys with too few parts fill from the start

Examples

library("prolfquapp")

bb <- prolfqua::sim_lfq_data_protein_config(n_proteins = 3)
lfq <- prolfqua::LFQData$new(bb$data, bb$config)
res <- separate_hierarchy(lfq$data_long(), lfq$get_config())
setdiff(colnames(res), colnames(lfq$data_long()))
[1] "proteinID" "idtype2"