A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/grunwaldlab/metacoder/issues/323 below:

Customize sample order heat_tree_matrix? · Issue #323 · grunwaldlab/metacoder · GitHub

Hi,

I am comparing abundance between 5 different salinity ranges (0-10, 10-15, 15-20, 20-25, and 25-36).
I am making a heattree with heat_tree_matrix() as follows:

obj %>%
  metacoder::filter_taxa(taxon_ranks == "f", supertaxa = TRUE, reassign_obs = FALSE) %>%
  mutate_obs("cleaned_names", gsub(taxon_names, pattern = "\\[|\\]", replacement = "")) %>%
  metacoder::filter_taxa(grepl(cleaned_names, pattern = "^[a-zA-Z]+$"), reassign_obs = FALSE) %>%
  heat_tree_matrix(data = "diff_table",
                   node_label = cleaned_names,
                   node_size = n_obs, # number of OTUs
                   node_color = log2_median_ratio, # difference between groups
                   node_color_trans = "linear",
                   node_color_interval = c(-3, 3), # symmetric interval
                   edge_color_interval = c(-3, 3), # symmetric interval
                   node_color_range = diverging_palette(), # diverging colors
                   node_size_axis_label = "OTU count",
                   node_color_axis_label = "Log 2 ratio of median counts",
                   layout = "da", initial_layout = "re",
                   key_size = 0.67,
                   seed = 2)

And this is the output:

To get a better insight into the gradient, however, I would like the sample order to be as follows:

Is there a way to customize the order of the samples in the matrix? I already tried reordering the levels of the factor, but that didn't influence the matrix.

Best regards,
Luna


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4