variable_correlation_network: Create a node network ggplot object of the correlation of...

View source: R/variable_correlation_network.R

variable_correlation_networkR Documentation

Create a node network ggplot object of the correlation of taxa and sample variables 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

variable_correlation_network(phyloseq_obj, variables, classification = NULL,
treatment = NULL, subset = NULL, correlation_table = NULL, method = 'spearman',
rho_threshold = c(-0.01, 0.01), p_threshold = 0.05, colors = 'default',
negative_positive_colors = c('tomato3', 'gray22'))

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.

variables

Numerical factors within the in the sample_data to correlate with the abundance data.

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.

correlation_table

Table of the correlation of taxa/variables in the phyloseq_obj, computed using variable_correlation. If no table is given, it will be computed with the phyloseq_obj, using the given treatment and p = 0.05.

method

Which correlation method to calculate, "pearson", "spearman", "kendall.

rho_threshold

Cutoffs to use to subset the 'correlation_table' by correlation values.

p_threshold

Cutoffs to use to subset the 'correlation_table' by singnificance values.

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.

Value

ggplot-object


schuyler-smith/phyloschuyler documentation built on Aug. 16, 2024, 5:36 a.m.