Keeps or renames columns from the sampleTable of a qseaSet. Essential columns sample_name and group are always preserved (and placed at the front of the table if present).

selectQset(qseaSet, ...)

Arguments

qseaSet

qseaSet. A qseaSet object whose sampleTable columns will be selected or renamed.

...

Additional arguments passed to dplyr::select(). Supports tidyselect helpers (e.g., dplyr::matches(), dplyr::starts_with()) and renaming (newName = oldName). Negative selection is supported, but sample_name and group cannot be removed. Default: none.

Value

A qseaSet with its sampleTable updated:

  • contains only the selected/renamed columns,

  • always includes sample_name and group (if available).

See also

select.qseaSet() for the dplyr S3 method, qsea::getSampleTable() to inspect the updated table.

Examples

data(exampleTumourNormal, package = "mesa")

# Keep only sample_name and group
exampleTumourNormal %>%
    selectQset(sample_name, group) %>%
    qsea::getSampleTable()
#>          sample_name    group
#> Colon1_N    Colon1_N Colon1_N
#> Colon1_T    Colon1_T Colon1_T
#> Colon2_N    Colon2_N Colon2_N
#> Colon2_T    Colon2_T Colon2_T
#> Lung1_N      Lung1_N  Lung1_N
#> Lung1_T      Lung1_T  Lung1_T
#> Lung2_N      Lung2_N  Lung2_N
#> Lung2_T      Lung2_T  Lung2_T
#> Lung3_N      Lung3_N  Lung3_N
#> Lung3_T      Lung3_T  Lung3_T

# Select and rename a column
exampleTumourNormal %>%
    selectQset(age, tumour_type = tumour) %>%
    qsea::getSampleTable()
#>          sample_name    group age tumour_type
#> Colon1_N    Colon1_N Colon1_N  80      Normal
#> Colon1_T    Colon1_T Colon1_T  80      Tumour
#> Colon2_N    Colon2_N Colon2_N  67      Normal
#> Colon2_T    Colon2_T Colon2_T  67      Tumour
#> Lung1_N      Lung1_N  Lung1_N  64      Normal
#> Lung1_T      Lung1_T  Lung1_T  64      Tumour
#> Lung2_N      Lung2_N  Lung2_N  71      Normal
#> Lung2_T      Lung2_T  Lung2_T  71      Tumour
#> Lung3_N      Lung3_N  Lung3_N  72      Normal
#> Lung3_T      Lung3_T  Lung3_T  72      Tumour

# Use tidyselect helpers
exampleTumourNormal %>%
    selectQset(matches("s")) %>%
    qsea::getSampleTable()
#>          sample_name    group tissue stage
#> Colon1_N    Colon1_N Colon1_N  Colon  <NA>
#> Colon1_T    Colon1_T Colon1_T  Colon   III
#> Colon2_N    Colon2_N Colon2_N  Colon  <NA>
#> Colon2_T    Colon2_T Colon2_T  Colon    IV
#> Lung1_N      Lung1_N  Lung1_N   Lung  <NA>
#> Lung1_T      Lung1_T  Lung1_T   Lung   IIA
#> Lung2_N      Lung2_N  Lung2_N   Lung  <NA>
#> Lung2_T      Lung2_T  Lung2_T   Lung    IA
#> Lung3_N      Lung3_N  Lung3_N   Lung  <NA>
#> Lung3_T      Lung3_T  Lung3_T   Lung    IB