Generates network plot of taxa and samples based on ggnet2.
amp_otu_network(
data,
min_abundance = 0,
color_by = NULL,
tax_aggregate = "Phylum",
tax_add = NULL,
tax_show = 10,
tax_class = NULL,
tax_empty = "best",
normalise = TRUE,
...
)
(required) Data list as loaded with amp_load
.
Minimum taxa abundance pr. sample. (default: 0
)
A metadata variable to color the samples by.
The taxonomic level to aggregate the OTUs. (default: "Phylum"
)
Additional taxonomic level(s) to display, e.g. "Phylum"
. (default: "none"
)
The number of taxa to show, or a vector of taxa names. (default: 10
)
Converts a specific phylum to class level instead, e.g. "p__Proteobacteria"
.
How to show OTUs without taxonomic information. One of the following:
"remove"
: Remove OTUs without taxonomic information.
"best"
: (default) Use the best classification possible.
"OTU"
: Display the OTU name.
(logical) Transform the OTU read counts to be in percent per sample. (default: TRUE
)
Additional arguments passed on to ggnet2
.
A ggplot2 object. If detailed_output = TRUE
a list with a ggplot2 object and additional data.
See ggnet2
See ?amp_filter_samples
or the ampvis2 FAQ.
# Load example data
data("AalborgWWTPs")
# OTU network plot
amp_otu_network(AalborgWWTPs)
#> Registered S3 method overwritten by 'GGally':
#> method from
#> +.gg ggplot2
#>
#> ‘network’ 1.18.2 (2023-12-04), part of the Statnet Project
#> * ‘news(package="network")’ for changes since last version
#> * ‘citation("network")’ for citation information
#> * ‘https://statnet.org’ for help, support, and other information
#>
#> Attaching package: ‘statnet.common’
#> The following objects are masked from ‘package:base’:
#>
#> attr, order
#> sna: Tools for Social Network Analysis
#> Version 2.7-2 created on 2023-12-05.
#> copyright (c) 2005, Carter T. Butts, University of California-Irvine
#> For citation information, type citation("sna").
#> Type help(package="sna") to get started.
#> Scale for colour is already present.
#> Adding another scale for colour, which will replace the existing scale.
#> Warning: Using size for a discrete variable is not advised.
#> Scale for size is already present.
#> Adding another scale for size, which will replace the existing scale.