Create multimedia.qmd - #768
Conversation
There was a problem hiding this comment.
Thanks!
Check the suggestions and the following:
-
increase support for the mia and (Tree)SummarizedExperiment methods when possible, this is very useful for compatibility with many other methods; I added suggestions. Also multimedia seems to support SE so this should be done.
-
Let us try to avoid repetition in the code; this has now two almost identical parts. Shall we prepare example data that is readily usable for the examples?
-
I am wondering if there would be a way to combine the two mediation chapters into one?
-
If we consider these methods widely usable we should consider providing wrappers for the interpretation, summaries, and visualizations of the results; either as contributions to "multimedia" package, or into mia or some other pkg (doesn't matter which pkg as long as it works)
|
Could you resolve the cases you have closed (from the "Resolve" buttons)? |
|
Fixed most of the detailed comments, still working on the more genral ones like creating pkg. Will finish this asap |
|
Can you resolve the completed suggestions above and confirm if this is ready to merge? |
Just fixed some minor inconsistence in the name of variables
|
To be checked in more detail before merge, regarding the following:
|
Hi Leo, thank you for the suggestions. I have added some wrapper functions, especially to where you indicated. For the data cleanning steps, do you mean we can remove those part, and add some texts to explain instead? |
|
The data cleaning part would work best if we include a suitable cleaned demo data in the R pkg, then we can skip the data cleaning steps in OMA. The problem is that if we could do this with every single method but then more than half of the book might easily be data cleaning examples, and this is also shifting the focus from the actual method to general data processing steps -> can we include demo data set/s in the multimedia, mia, or other pkg, or can we use already existing demo data sets? |
|
Regarding the wrappers, we could see if we can include these in a package if they would be generally useful anyway. |
|
Hi Leo – just wanted to quickly chime in here. This dataset is a special case where we don’t have a conventional, well-defined outcome for mediation analysis. Instead, the outcome is a dysbiosis score derived from taxonomic profiles, as described by Lloyd-Price et al. (2019), which, to my knowledge, hasn’t been implemented elsewhere. We are already drawing the data from curatedMetagenomicData, but creating the dysbiosis score is a necessary step to showcase the mediation analysis. |
|
Thanks. I think that dysbiosis score could then stay there. Let's check @TuomasBorman feedback. |
TuomasBorman
left a comment
There was a problem hiding this comment.
Thanks, looks very good! However, there are couple points to discuss.
This book is intended as teaching material to demonstrate specific analyses and tasks. The main focus is on the underlying ideas and concepts rather than implementation details. Therefore, the code is kept as simple as possible to achieve the intended outcomes. More polished analyses, including advanced plots, are better suited for workflow packages (we are also considering creating workflow package to showcase more complex analyses).
There are couple lengthy code chunks that do operations to results. Having these long chunks have opposite effect as readers are exhausted by the amount of code and they cannot focus on the main points. Everything that is not relevant for the main point should be removed even though plots or names would not be optimal.
Ideally, these wrappers will be implemented in a package, but of course it takes some time. At least, we should have plan to implement them. If we just leave it here, these will be never implemented as we are very busy with everything.
|
Can you @YihanLiu4023 confirm when you're ready with the updates? Can you also press the "Update branch" button above to ensure that this PR is in sync with the latest devel branch. |
|
Updated file submitted! |
antagomir
left a comment
There was a problem hiding this comment.
Thanks - some points to clarify still.
Overall this looks good but it will be essential to consider the following:
-
Data cleaning operations should be either ignored, or readily cleaned demo data set should be used (it can be placed to one of our packages). Otherwise OMA would be primarily a data cleaning example collection..
-
We need to check if any ready-made functionality is available to fetch and visualize results from mediation analyses. Now this is done with custom code. Maybe multimedia package has some utilities and if not, we should see if some tasks are so central that they should be standardized (either into multimedia package as contributed PR, or into mia).
|
This seems nearly complete. I picked the following points from above. Can you confirm this is OK @YihanLiu4023 ?
|
|
|
Hi, I uploaded a new version according to the comments but had 1 failing check: Style code. I also ran the style workflow locally in R. However, the automated styler check reformatted the R chunks back to 2-space indentation. Is there any way to solve this? |
|
Thanks! Looks pretty good! I still have a couple of comments. |
RiboRings
left a comment
There was a problem hiding this comment.
Thank you so much, I'm confident we'll be ready in one or two more rounds of review. Please keep up the great work! 🥇
|
Sorry I just realized the data loading is not yet updated (all the other comments till now is updated). I would push a new one right away. |
|
@YihanLiu4023 can you resolve the remaining comments, then we approach completion? |
|
@YihanLiu4023 kindly confirm when this is complete based on the feedback. |
|
@RiboRings you commented, could you resolve responses that are ok? |
|
Hi @YihanLiu4023! I opened a pull request with some adjustments to your branch: YihanLiu4023#1 Please accept it so the changes are reflected here, and check that the code still runs correctly. |
|
Two main considerations: I am not getting what exactly is multi-omic about multimedia. In the chapter, microbiome and pathway experiments are analysed separately (with identical pipelines). In my understanding this isn't considered multi-omics since it isn't combining different omics into a single analysis. If the idea is to study mediation using several features together (from a single omic type), multivariate would be the correct term to use here. But it should not be called multi-omic or multimodal. Also, the chapter is relatively computationally intensive. To keep the book deployment short, reduce bootstrap iterations to the minimum where you still get similar results, and comment that ideally some N iterations should be run. |
Refine multimedia chapter
|
Accepted! |
|
|
Thanks a lot @YihanLiu4023! This is ready from my side. @antagomir @himelmallick @TuomasBorman any other thoughts on the last few comments above or just in general? |
Sounds great, thanks! I'm happy to work on any further comments. |
antagomir
left a comment
There was a problem hiding this comment.
Thanks! Could you clarify the necessity of the second case (pathways)? At a quick look it seems very similar to the first part (taxa).
| na.rm = TRUE | ||
| )) | ||
|
|
||
| is_healthy <- tse$disease == "healthy" |
There was a problem hiding this comment.
Can you incorporate this in the tse data itself?
tse$is_healthy <- ...
then it will be managed together with the other data
| # Plot the bootstrap distribution | ||
| ggplot(boot_overall$indirect, aes(indirect_effect)) + | ||
| geom_histogram(bins = 20, fill = "#69b3a2", color = "black") + | ||
| ggtitle("Bootstrap Distribution of Overall Indirect Effect (B = 10)") + |
There was a problem hiding this comment.
I think ggtitle is nowadays replaced by labs(title=...), can you switch to that?
| # Define mediator-specific indirect effects for bootstrap resampling | ||
| indirect_each <- function(mdl, exper) { | ||
| res <- estimate(mdl, exper) | ||
| alpha <- sapply(res@mediation@estimates, function(m) coef(m)["treatmentT1"]) |
There was a problem hiding this comment.
is there no more direct way to pick the estimates than res@mediation@estimates? Usually there are getters to pick these things and these have advantages.
|
|
||
| # Scale counts to [0, 1] | ||
| assay(se) <- assay(se) / 100 | ||
|
|
There was a problem hiding this comment.
@TuomasBorman should we add this as ready-made demo data set? This processing code takes quite some space.
| the outcome, but pathways abundances as the mediation variables instead of the | ||
| relative species abundance. | ||
|
|
||
| ## Performing multivariate mediation analysis for pathways abundances {#sec-pathways-abundances} |
There was a problem hiding this comment.
This part seems very much like repetition of what was already above.
Is this just a different data type (e.g. pathways), or is there a genuine difference so that it is justified to include this full second example workflow starting here?
No description provided.