get_hub_plots_all_ranks: Create 5 network plots with nodes sized by hub score, each...

Description Usage Arguments Value Examples

View source: R/MDMAnalyzer_v0.R

Description

Networks are created for each rank from Phylum to Genus, coloring nodes by their taxonomic classification at that rank and sizing nodes by their hub score. MDM nodes are always featured in gray.Larger nodes indicate larger hub score value.

Usage

1
get_hub_plots_all_ranks(orig_graph, orig_phylo, met_name)

Arguments

orig_graph

Network including all taxa, produced from get_back_res_meeting_min_occ function

orig_phylo

Phyloseq including all taxa meeting threshold, produced from get_back_res_meeting_min_occ function

met_name

Name of environment

Value

Returns list of 5 ggplot objects visualizing networks at each rank from Phylum to Genus, resizing nodes by hub score.

hub_plot1

Phylum Hub Network

hub_plot2

Class Hub Network

hub_plot3

Order Hub Network

hub_plot4

Family Hub Network

hub_plot5

Genus Hub Network

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (orig_graph, orig_phylo, met_name)
{
    all_plots_l = list()
    for (rank_num in seq_along(colnames(tax_table(orig_phylo))[2:6])) {
        print(rank_num)
        tax_rank_names = c("Phylum", "Class", "Order", "Family",
            "Genus")
        rank_name = colnames(tax_table(orig_phylo))[2:6][rank_num]
        print(rank_name)
        rank_name2 = tax_rank_names[rank_num]
        print(rank_name2)
        g_net_plot <- phyloseq::plot_network(orig_graph, orig_phylo,
            type = "taxa", color = rank_name, label = NULL, point_size = hub_score(orig_graph)$vector *
                10, title = paste(met_name, rank_name2, sep = " ")) +
            theme(legend.position = "none")
        all_plots_l[[rank_name]] = g_net_plot
    }
    return(all_plots_l)
  }

ConesaLab/MDM documentation built on Aug. 1, 2020, 11:47 a.m.