get_net_plots_all_ranks: Create network plot, with nodes colored by 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. MDM nodes are always featured in gray.

Usage

1
get_net_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

plot1

Phylum Network

plot2

Class Network

plot3

Order Network

plot4

Family Network

plot5

Genus 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
##---- 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, 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.