plotOrdination, plotJointRPCA and modification to plotRDA - #191
Conversation
|
@antagomir Any further ideas visualizing PCA/PCoA results? |
|
Seems great.
|
|
2.-3. This is working just like scater::plotReducedDim(). This does not do any calculations. |
Oh yes. |
|
Remember to update Check also that the naming of arguments is harmonized. Currently, some of the arguments are passed to plotReducedDim without touching them, leading to usage of to naming conventions. For instance, this does not work
but this works
|
|
Add option for adding sample names:
It can take either TRUE, FALSE or vector value that has the displayed sample names. |
|
in plotRDA (and plotOrdination) make sure that axis labels are from reducedDim() results. Currently, plotRDA overwrites somewhere the axis labels. In the example below, y axis should be MDS1 as there is only one constrained axis (dbRDA1). However, they are now dbRDA1 and dbRDA2. |
|
Add support for joint-RPCA: microbiome/mia#808 Check also plotLoadings and joint-RPCA |
|
We can add ellipses this way: colnames(p$data)
# r$> colnames(p$data)
# [1] "X" "Y" "colour_by" "order_by"
p <- plotReducedDim(tse, "MDS_Bray", color_by = "group") +
stat_ellipse(aes(color = colour_by))The ellipses functionality can be implemented like in the |
|
Thanks! This is very true, but requires knowledge on ggplot class, thus it is little bit "hacky" way |
| #' @rdname plotCCA | ||
| #' @aliases plotRDA | ||
| #' @export | ||
| setMethod("plotCCA", signature = c(x = "matrix"), | ||
| function(x, ...){ | ||
| # Reproduce plotRDA function | ||
| return(plotRDA(x, ...)) | ||
| } | ||
| ) | ||
|
|
There was a problem hiding this comment.
I removed matrix method.
This method just converts matrix to TreeSE first and then applies TreeSE-method.
This is just causing maintenance overhead without adding much value (the whole idea of the package is to provide SE-based methods)
| plot_args[["ellipse_data"]] <- do.call(.get_rda_ellipse_data, args) | ||
| plot_args[["vector_data"]] <- do.call(.get_rda_vector_data, args) | ||
| plot_args[["centroids"]] <- do.call(.get_rda_centroids_data, args) | ||
| plot_args[["species_scores"]] <- do.call(.get_rda_species_data, args) | ||
| plot_args[["plot"]] <- do.call(.create_rda_baseplot, args) | ||
| p <- plotOrdination(x, dimred = dimred, ...) | ||
| # Create a final plot | ||
| p <- .rda_plotter(plot_args, ...) |
There was a problem hiding this comment.
These comes from plotOrdination in the new version
There was a problem hiding this comment.
Lots of the functionality comes now from shared plotOrdination function.
TuomasBorman
left a comment
There was a problem hiding this comment.
Good to go.
This PR is expecting that changes from microbiome/mia#841 are merged. So that must be done first.
We have been using scater::plotReducedDim() to visualize reduced dimensionalities. However, it has couple limitations. For instance, it does not have functionality to add ellipses or to connect paired samples. The idea of plotOrdination() is to create a method that allows us to create easily visualizations commonly used in microbiome context. This can be easily extended later if needed.
I checked the literature, and identified the plots below. Is there other layouts that should be implemented?