co_occurrence_network: Create a node network ggplot object of the co-occurrence from...

View source: R/co_occurrence_network.R

co_occurrence_networkR Documentation

Create a node network ggplot object of the co-occurrence from a phyloseq object. Function from the phylosmith-package.

Description

Inputs a phyloseq-class object and creates a network from the co-occurrence. The co-occurrence can either be input, or it will be calculated with the Spearman-rank correlation. Also, the layout of the graph can be given as an argument as well for reproducibility.

Usage

co_occurrence_network(phyloseq_obj, classification = NULL, 
treatment = NULL, subset = NULL, co_occurrence_table = NULL, layout = NULL,
nodes_of_interest = NULL, node_colors = 'default',
negative_positive_colors = c('tomato3', 'gray22'),
cluster = FALSE, cluster_colors = '#979aaa', buffer = 0.5)

Arguments

phyloseq_obj

A phyloseq-class object. It must contain sample_data()) with information about each sample, and it must contain tax_table()) with information about each taxa/gene.

classification

Column name as a string or number in the tax_table for the factor to use for node colors.

treatment

Column name as a string or number in the sample_data. This can be a vector of multiple columns and they will be combined into a new column.

subset

A factor within the treatment. This will remove any samples that to not contain this factor. This can be a vector of multiple factors to subset on.

co_occurrence_table

Table of the co-occurrence of taxa/genes in the phyloseq_obj, computed using co_occurrence. If no table is given, it will be computed with the phyloseq_obj, using the given treatment and p = 0.05.

layout

(optional) an igraph layout of the network, for reproducibility. Can be created with network_layout_ps.

nodes_of_interest

A vector of names of classes within the classification to be labeled.

node_colors

Name of a color set from the RColorBrewer package or a vector palette of R accepted colors.

negative_positive_colors

colors to use for the edges to represent negative and positive correlations.

cluster

if TRUE, will use igraph's cluster_fast_greedy method. Alternatively, you may pass a vector of cluster assignments with order corresponding to the order of the taxa_names in the phyloseq_obj.

cluster_colors

Name of a color set from the RColorBrewer package or a vector palette of R accepted colors to use for the clusters.

buffer

Amount of space beyond the points to extend the cluster ( aesthetic argument).

Value

ggplot-object

Examples

#co_occurrence_network(soil_column, treatment = c('Matrix', 'Treatment'),
#subset = 'Soil Amended', co_occurrence_table = NULL, layout = NULL,
#classification = 'Phylum')

schuyler-smith/phylosmith documentation built on Aug. 17, 2024, 10:19 a.m.