Extends dplyr::arrange() to reorder samples of a qseaSet based on columns in its sampleTable.

# S3 method for class 'qseaSet'
arrange(.data, ..., .by_group = FALSE)

Arguments

.data

qseaSet. The qseaSet whose samples will be reordered.

...

Expressions. Variables or helper functions passed to dplyr::arrange() to define the ordering. Default: none (no reordering).

.by_group

logical(1). Grouped arrangement is not implemented for qseaSet; this argument is ignored. Default: FALSE.

Value

A qseaSet object with samples reordered. Both the count_matrix and the sampleTable are updated consistently.

See also

qsea::getSampleTable(), subsetQset(), sort.qseaSet() (for natural sorting of sample names).

Examples

data(exampleTumourNormal, package = "mesa")

# Reorder samples by age
exampleTumourNormal %>% arrange(age)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Lung1_N, Lung1_T, Colon2_N, Colon2_T, Lung2_N, Lung2_T, Lung3_N, Lung3_T, Colon1_N, Colon1_T
#> 819 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38

# Reorder by tissue
exampleTumourNormal %>% arrange(tissue)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Colon1_N, Colon1_T, Colon2_N, Colon2_T, Lung1_N, Lung1_T, Lung2_N, Lung2_T, Lung3_N, Lung3_T
#> 819 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38

# Reorder by tissue (descending), then tumour type
exampleTumourNormal %>% arrange(desc(tissue), tumour)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Lung1_N, Lung2_N, Lung3_N, Lung1_T, Lung2_T, Lung3_T, Colon1_N, Colon2_N, Colon1_T, Colon2_T
#> 819 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38