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,
  ...
)

Arguments

data

(required) Data list as loaded with amp_load.

min_abundance

Minimum taxa abundance pr. sample. (default: 0)

color_by

A metadata variable to color the samples by.

tax_aggregate

The taxonomic level to aggregate the OTUs. (default: "Phylum")

tax_add

Additional taxonomic level(s) to display, e.g. "Phylum". (default: "none")

tax_show

The number of taxa to show, or a vector of taxa names. (default: 10)

tax_class

Converts a specific phylum to class level instead, e.g. "p__Proteobacteria".

tax_empty

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.

normalise

(logical) Transform the OTU read counts to be in percent per sample. (default: TRUE)

...

Additional arguments passed on to ggnet2.

Value

A ggplot2 object. If detailed_output = TRUE a list with a ggplot2 object and additional data.

Details

See ggnet2

Preserving relative abundances in a subset of larger data

See ?amp_filter_samples or the ampvis2 FAQ.

See also

Author

Kasper Skytte Andersen ksa@bio.aau.dk

Mads Albertsen MadsAlbertsen85@gmail.com

Examples

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