Extends base::sort() to reorder the samples of a qseaSet
using gtools::mixedsort() so that numeric parts sort naturally
(e.g., "2" comes before "10").
# S3 method for class 'qseaSet'
sort(x, decreasing = FALSE, ...)qseaSet.
A qseaSet object to reorder.
logical(1).
Whether to reverse the order.
Default: FALSE.
Additional arguments passed on to gtools::mixedsort().
Default: none.
A qseaSet object with reordered samples. The content of all slots
(e.g., count_matrix, sampleTable) is updated consistently.
data(exampleTumourNormal, package = "mesa")
# Sort samples in natural (mixed) order
exampleTumourNormal %>% sort()
#> 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
# Sort in reverse order
exampleTumourNormal %>% sort(decreasing = TRUE)
#> qseaSet
#> =======================================
#> 10 Samples:
#> Lung3_T, Lung3_N, Lung2_T, Lung2_N, Lung1_T, Lung1_N, Colon2_T, Colon2_N, Colon1_T, Colon1_N
#> 819 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38