Create a wide table for ML/visualisation where rows are samples and columns are genomic windows, using one normalisation/measure.

makeTransposedTable(qseaSet, normMethod = "nrpm", ...)

Arguments

qseaSet

qseaSet. A qseaSet object containing methylation-enriched sequencing data. Default: none (must be supplied).

normMethod

character(1). Measure to extract. Common choices include "nrpm" or "beta". Default: "nrpm".

...

tidyselect specification or character(). Optional columns from the sample table to append as additional features (e.g., group, tumour or c("group","tumour")). Default: none.

Value

A tibble with one row per sample and one column per genomic window, plus any appended sample-level metadata.

Details

Internally obtains a window × sample matrix for normMethod, transposes it to sample × window, and (if requested) appends selected sample-table columns. Window columns are typically named "chr:start-end". If measure suffixes are present in column names, they may be cleaned to bare sample/window names (see removeNormMethodSuffix()).

Examples

data(exampleTumourNormal, package = "mesa")

# NRPM features (sample × first few windows) with a group column appended
exampleTumourNormal %>%
  makeTransposedTable(normMethod = "nrpm", group) %>%
  dplyr::select(1:6) %>%
  head()
#> obtaining raw values for 10 samples in 819 windows
#> deriving nrpm values...
#> creating table...
#> Joining with `by = join_by(sample_name)`
#> # A tibble: 6 × 6
#>   sample_name group    chr7_25002001_25002300 chr7_25005001_25005300
#>   <chr>       <chr>                     <dbl>                  <dbl>
#> 1 Colon1_N    Colon1_N                  0                      0.263
#> 2 Colon1_T    Colon1_T                  0.131                  0    
#> 3 Colon2_N    Colon2_N                  0.246                  0    
#> 4 Colon2_T    Colon2_T                  0.178                  0    
#> 5 Lung1_N     Lung1_N                   0.125                  0    
#> 6 Lung1_T     Lung1_T                   0.184                  0    
#> # ℹ 2 more variables: chr7_25008601_25008900 <dbl>,
#> #   chr7_25011301_25011600 <dbl>

# Beta features; inspect dimensions
exampleTumourNormal %>%
  makeTransposedTable(normMethod = "beta") %>%
  dim()
#> obtaining raw values for 10 samples in 819 windows
#> deriving beta values...
#> creating table...
#> Joining with `by = join_by(sample_name)`
#> [1]  10 820