-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
neatmap / neatsort #146
Comments
This could go, for instance, in ch. 15 (visualization) / heatmaps. |
After some reading, It seems that sechm does order rows from the angle of the MDS plot by default (just like NeatMap, which is no longer an independent package and it works under the hood of sechm). So OMA chapter 15.3 is already showing how to do that. According to this sechm tutorial section 2.2, It is also possible to change the ordering criterion back to standard hierarchical clustering, which could be added to OMA. However, I personally find ComplexHeatmap good enough for hierarchical clustering. What are your thoughts? |
I agree that sechm is good for neatmaps and ComplexHeatmap for hclust. In fact ch 15.3 could be simplified in this regard.
|
This topic is now under construction in miaViz PR microbiome/miaViz#128 - in fact I forgot we had this issue.. Let us finalize this OMA issue after the miaViz PR is complete. @SHillman836 I gather two points from above:
|
OK thanks - I had a few follow up questions
When you perform an MDS on the z-transformed assay data, then order with the getNeatOrder function, then plot the ordered original z-transformed data, with the scaling parameter in sechm as FALSE, you get this - Then when you sort via sechm directly, passing in the relative abundance data, using the sechm scaling parameter, you get this - So there is some difference. |
|
Code for heatmap 1, with MDS is -
Code for heatmap 2, direct via sechm is -
|
(Though I'm adding your changes over params and method calling now) |
For final examples in the R documentation it will better to have just once the parts in data preparation that are common for both methods (agglom, transf). Code 1: I would simplify this:
Some comments could be added to explain the code. |
Use calculateMDS https://rdrr.io/bioc/scater/man/runMDS.html |
Usually we would recommend the following transformations for this kind of heatmap:
The reason: clr will logarithmize the data (-> becomes more normally distributed -> nice for symmetric visualization) and aims to remove the compositionality bias; then scaling on features will put center on zero and scale variance to unit for all features -> more direct visual comparability -> Check how the plots look after this. |
Ah OK - just to clarify sorry should've made it clearer, so that code wasn't code to be put into the documentation or published anywhere, that was just me exploring differences between sechm and getNeatOrder heatmaps. Which is why it's abit messy and there are no comments - it was just to look at differences in heatmaps. In fact, my code to be put into the documentation uses PCA not MDS - the reason I had to do MDS for this was cause sechm only creates MDS heatmaps. Ok yes, noted about clr. will retest the plots with this. Would you use clr not rel-abundance for PCAs too? Yeah it's not pushed yet but my updated miaViz method example uses scale for the transformAssay method |
Yep I realized afterwards. I think those transformation updates might help |
CLR can be done for both counts or relabundances. If you use CLR + Euclidean distance, then PCA would be the common option. Otherwise, relabundance + Bray-Curtis -> MDS / NMDS |
Ah ok, thanks. So for PCA - clr for samples -> z-transformation for features-> Euclidean distance/PCA Then for MDS - relabundances -> clr for samples -> z transformations for features -> bray-curtis -> MDS Let me know if I'm missing something |
yes ok - although clr you can do directly on counts as well, I think it shouldnt drastically change the outcome (or ideally, you could check that). If it doesn't change the results then I would prefer the simpler sequence (counts -> clr -> z -> ... |
Any chance to troubleshoot where the difference appears exactly? is it the plotting command or some of the preceding steps (ordination, sorting, color palette..) |
@SHillman836 is this issue/PR ready or something still pending? |
@antagomir ah sorry I actually completely forgot about this one! My bad, just got so caught up in all the other stuff. Will add this to the to do list for this week. |
Great! Let's make sure that there are no near-finished pending tasks..! |
It should be possible to enable sorting both rows and columns, and the user should be able to decide if they sort neither, one, or both. |
In terms of the user deciding for what - this issue was just about differences between sechm and neatOrder. With neatOrder you can just transpose the matrix to sort the rows I guess. But the neat order method has been merged in, and just takes in ordinated data to sort. It's very specific. Then in terms of sechm - you can't sort cols, only rows. |
Great - a quickly checked the code and noticed the following at least.
Therefore my suggestion for this issue is that we should experiment a bit with seriation and see if that provides the simple solution for our heatmap sorting needs. If yes, then I would remove getNeatOrder function from mia (and apologize for the extra hassle with that) and add examples on heatmap sorting with seriation in OMA. |
Moving here miaViz issue #40
Row/col sorting based on angle on MDS projection is implemented in SEtools R package.
The vignette says "By default, rows are sorted not with hierarchical clustering, but from the angle on a MDS plot, which tends to give nicer results than bottom-up hierarchical clustering."
Add an example on how to use this to construct so-called neatmaps.
Cite the neatmap publication as well.
The text was updated successfully, but these errors were encountered: