Plot multi-dimensional scaling plot using algorithm of limma::plotMDS(). It is recommended this be done with the log-methylation-ratio matrix generated by bsseq_to_log_methy_ratio().
Arguments
- x
the log-methylation-ratio matrix.
- top
the number of top genes used to calculate pairwise distances.
- plot_dims
the numeric vector of the two dimensions to be plotted.
- labels
the character vector of labels for data points. By default uses column names of x, set to NULL to plot points.
- groups
the character vector of groups the data points will be coloured by. Colour palette can be adjusted using scale_colour_*() functions from ggplot2. If groups is numeric, the points will be coloured by a continuous colour palette. By default, groups is NULL and the points will not be coloured.
- legend_name
the name for the legend.
Examples
nmr <- load_example_nanomethresult()
bss <- methy_to_bsseq(nmr)
#> [2024-08-22 04:06:05] creating intermediate files...
#> [2024-08-22 04:06:05] parsing chr11...
#> [2024-08-22 04:06:05] parsing chr12...
#> [2024-08-22 04:06:05] parsing chr18...
#> [2024-08-22 04:06:05] parsing chr5...
#> [2024-08-22 04:06:05] parsing chr7...
#> [2024-08-22 04:06:05] parsing chrX...
#> [2024-08-22 04:06:05] samples found: B6Cast_Prom_3_cast B6Cast_Prom_3_bl6 B6Cast_Prom_2_cast B6Cast_Prom_2_bl6 B6Cast_Prom_1_cast B6Cast_Prom_1_bl6
#> [2024-08-22 04:06:05] creating bsseq object...
#> [2024-08-22 04:06:05] reading in parsed data...
#> [2024-08-22 04:06:05] constructing matrices...
#> [2024-08-22 04:06:06] done
lmr <- bsseq_to_log_methy_ratio(bss)
plot_mds(lmr)