Package 'mina'

Title: Microbial community dIversity and Network Analysis
Description: An increasing number of microbiome datasets have been generated and analyzed with the help of rapidly developing sequencing technologies. At present, analysis of taxonomic profiling data is mainly conducted using composition-based methods, which ignores interactions between community members. Besides this, a lack of efficient ways to compare microbial interaction networks limited the study of community dynamics. To better understand how community diversity is affected by complex interactions between its members, we developed a framework (Microbial community dIversity and Network Analysis, mina), a comprehensive framework for microbial community diversity analysis and network comparison. By defining and integrating network-derived community features, we greatly reduce noise-to-signal ratio for diversity analyses. A bootstrap and permutation-based method was implemented to assess community network dissimilarities and extract discriminative features in a statistically principled way.
Authors: Rui Guan [aut, cre], Ruben Garrido-Oter [ctb]
Maintainer: Rui Guan <[email protected]>
License: GPL
Version: 1.15.0
Built: 2024-10-30 08:51:28 UTC
Source: https://github.com/bioc/mina

Help Index


Calculate the correlation adjacacency matrix.

Description

Calculate the correlation adjacacency matrix.

Usage

adj(x, method, ...)

Arguments

x

An object of the class mina with 'norm' defined or a 'norm' matrix.

method

The correlation coeffient used for adjacacency matrix.

...

Additional parameters.

Value

Adjacency matrix.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman", sig = FALSE)

List of adjacency matix calculation methods/ orrelations supported in adj

Description

Correlation methods should be specified by exact string match.

Usage

adj_method_list

Format

A list of character vectors.

pearson

Pearson correlation.

spearman

Spearman correlation.

sparcc

SparCC correlation by spearman.

See Also

adj

Examples

? adj_method_list

Calculate the adjacency matrix of 'norm' by correlation with matrix as input.

Description

Calculate the adjacency matrix of 'norm' by correlation with matrix as input.

Usage

## S4 method for signature 'matrix,ANY'
adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)

## S4 method for signature 'matrix,character'
adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)

Arguments

x

An object of the class mina with 'norm' defined or a 'norm' matrix.

method

The correlation coeffient used for adjacacency matrix.

sig

(optional) The asymtotic P-values, only applicable for Pearson and Spearman methods with 'mina' object as input, alwasy FALSE here.

threads

The number of threads used for parallel running, 80 by default.

nblocks

The number of row/column for splitting sub-matrix, 400 by default.

...

Additional parameters.

Value

y The adjacency matrix.

Examples

asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_adj <- adj(asv_norm, method = "pearson")

Calculate the adjacency matrix of 'norm' by correlation with 'mina' class object as input.

Description

Calculate the adjacency matrix of 'norm' by correlation with 'mina' class object as input.

Usage

## S4 method for signature 'mina,ANY'
adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)

## S4 method for signature 'mina,character'
adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)

Arguments

x

An object of the class mina with 'norm' defined or a 'norm' matrix.

method

The correlation coeffient used for adjacacency matrix.

sig

The asymtotic P-values, only applicable for Pearson and Spearman methods, FALSE by default.

threads

The number of threads used for parallel running, 80 by default.

nblocks

The number of row/column for splitting sub-matrix, 400 by default.

...

Additional parameters.

Value

x The same 'mina' object with 'adj' added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman", sig = FALSE)

Inferring the network of different group of samples and test significance by permutation.

Description

Inferring the network of different group of samples and test significance by permutation.

Usage

bs_pm(x, group, ...)

Arguments

x

An object of class 'mina' with 'norm' and 'des' defined.

group

The column name of descriptive file 'des' for comparison.

...

Additional parameters.

Value

The network bootstrap and permutation result.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- get_rep(maize, top = 5)
maize <- bs_pm(maize, group = "Compartment", per = 0.5)

Inferring the network of different group of samples and test significance by permutation.

Description

Inferring the network of different group of samples and test significance by permutation.

Usage

## S4 method for signature 'mina,ANY'
bs_pm(
  x,
  group,
  g_size = 88,
  s_size = 30,
  rm = TRUE,
  per = 0.1,
  sig = TRUE,
  bs = 6,
  pm = 6,
  individual = FALSE,
  out_dir = "./",
  ...
)

## S4 method for signature 'mina,character'
bs_pm(
  x,
  group,
  g_size = 88,
  s_size = 30,
  rm = TRUE,
  per = 0.1,
  sig = TRUE,
  bs = 6,
  pm = 6,
  individual = FALSE,
  out_dir = "./",
  ...
)

Arguments

x

An object of class 'mina' with @norm and @des defined.

group

The column name of descriptive file @des for comparison.

g_size

The cutoff of group size used for filtering, default is 88.

s_size

The number of samples used for network inference during bootstrap and permutation (when 'sig' is TRUE), it should be smaller than g_size / 2 to make sure the randomness; default is 30.

rm

Filtering the components present in less than 'per' of the samples from compared groups, default TRUE.

per

The percentage of present samples for filtering, default is 0.1.

sig

Whether to test the significance, skip the permutation when set as FALSE, default is TRUE.

bs

The times for bootstrap network inference, default is 6.

pm

The times for permuatated samples network inference, default is 6.

individual

Whether to output the bootstrap and permutation results of each comparison individually, default is FALSE.

out_dir

The output directory if 'individual' is TRUE, default is the current working directory

...

Additional parameters.

Value

x The same object with @multi and @perm defined.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment", per = 0.5)

Check the tab and des file. Return TRUE if they are NULL or both quantitative and descriptive files of same samples are included (i.e. the object is valid).

Description

Check the tab and des file. Return TRUE if they are NULL or both quantitative and descriptive files of same samples are included (i.e. the object is valid).

Usage

check_mina(x)

Arguments

x

An object of class mina.

Value

TRUE if the object is valid.

Examples

data(maize)
check_mina(maize)

Check the object and return TRUE if the object includes descriptive table contains the same samples as quantitative table.

Description

Check the object and return TRUE if the object includes descriptive table contains the same samples as quantitative table.

Usage

check_mina_de(x)

Arguments

x

An object of class mina with 'tab' and 'des' defined.

Value

TRUE if the object contains non-empty descriptive table and has the same samples as quantitative table.

Examples

data(maize)
check_mina_de(maize)

Check the object and return TRUE if the object includes quantitative table.

Description

Check the object and return TRUE if the object includes quantitative table.

Usage

check_mina_qu(x)

Arguments

x

An object of class mina with 'tab' defined.

Value

TRUE if the object contains quantitative table and is not empty.

Examples

data(maize)
check_mina_qu(maize)

Get the slot 'cls_tab'.

Description

Get the slot 'cls_tab'.

Usage

cls_tab(x)

Arguments

x

The 'mina' object.

Value

The 'cls_tab' slot of the object.

Examples

cls_tab(maize)

Calculate the community dissimilarity / distance matrix.

Description

Calculate the community dissimilarity / distance matrix.

Usage

com_dis(x, method = "bray", ...)

Arguments

x

An object of the class mina with 'norm' defined or any quantitative matrix.

method

The dissimilarity / distance method used, default 'bray'.

...

Additional parameters.

Value

The distance / dissimilarity matrix.

Examples

asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_dis <- com_dis(asv_norm, method = "bray")

List of dissimilarity / distance supported in com_dis. Dissimilarity / distance should be specified by exact string match.

Description

List of dissimilarity / distance supported in com_dis. Dissimilarity / distance should be specified by exact string match.

Usage

com_dis_list

Format

A list of character vectors indicate the dissimilarity / distance method used.

tina

TINA from Schmidt_et_al_2016

Jaccard

Jaccard defined by vegdist

weighted

Dissimilarity / distance method for weighted matrix:

bhjattacharyya

from parDist

canberra

from parDist

bray

from parDist

chord

from parDist

divergence

from parDist

euclidean

from parDist

fJaccard

from parDist

geodesic

from parDist

hellinger

from parDist

kullback

from parDist

manhattan

from parDist

maximum

from parDist

minkowski

from parDist

podani

from parDist

soergel

from parDist

wave

from parDist

whittaker

from parDist

unweighted

Dissimilarity / Distance for unweighted matrix:

binary

from parDist

braun-blanquet

from parDist

consine

from parDist

dice

from parDist

fager

from parDist

faith

from parDist

hamman

from parDist

hamming

from parDist

kulczynski1

from parDist

kulczynski2

from parDist

michael

from parDist

mountford

from parDist

mozley

from parDist

ochiai

from parDist

phi

from parDist

russel

from parDist

simple matching

from parDist

simpson

from parDist

stiles

from parDist

tanimoto

from parDist

yule

from parDist

yule2

from parDist

Examples

? com_dis_list

Calculate the community dissimilarity / distance matrix of the input matrix.

Description

Calculate the community dissimilarity / distance matrix of the input matrix.

Usage

## S4 method for signature 'matrix,ANY'
com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)

## S4 method for signature 'matrix,character'
com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)

Arguments

x

A matrix of the quantitative table.

method

The dissimilarity / distance method used, default 'bray'.

threads

(optional, only needed when method == "tina") The number of threads used for parallel running.

nblocks

(optional, only needed when method == "tina") The number of row / column for splitted sub-matrix.

...

Additional parameters.

Value

y The dissimilarity / distance matrix.

Examples

asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_dis <- com_dis(asv_norm, method = "bray")

Calculate the community dissimilarity / distance matrix of 'norm' with 'mina' class object as input.

Description

Calculate the community dissimilarity / distance matrix of 'norm' with 'mina' class object as input.

Usage

## S4 method for signature 'mina,ANY'
com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)

## S4 method for signature 'mina,character'
com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)

Arguments

x

An object of the class 'mina' with 'norm' defined.

method

The dissimilarity / distance method used, default 'bray'.

threads

(optional, only needed when method == "tina") The number of threads used for parallel running.

nblocks

(optional, only needed when method == "tina") The number of row / column for splitted sub-matrix.

...

Additional parameters.

Value

x The same 'mina' object with @dis added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "total")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")

Visulization of components distance / dissimilarity in k dimension.

Description

Visulization of components distance / dissimilarity in k dimension.

Usage

com_plot(x, match, ...)

Arguments

x

An object of class 'mina' with 'dmr' and 'des' defined.

match

The column name of the components IDs in 'des' which exactly the same indicated in 'dmr'.

...

Additional parameters.

Value

The PCoA plot.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 5000)
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)
p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment")
p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4,
color = "Compartment")
p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype")
p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color =
"Host_genotype")
p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape =
"Soil")
p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color =
"Compartment", shape = "Soil")

Visulization of components distance / dissimilarity in k dimension.

Description

Visulization of components distance / dissimilarity in k dimension.

Usage

## S4 method for signature 'mina,ANY'
com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...)

## S4 method for signature 'mina,character'
com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...)

## S4 method for signature 'mina,character'
com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...)

Arguments

x

An object of 'mina' with list 'dmr' defined.

match

The column name of the components IDs in 'des' with exactly the same as rownames in x.

d1

The dimension be visualized in x-axis, default '1'.

d2

The dimension be visualized in y-axis, default '2'.

color

The column name in 'des' to be used for different color groups.

shape

The column name in 'des' to be used for different shape groups, default 'NULL'.

...

Additional parameters.

Value

p The plotted figure.

The PCoA plot.

Examples

maize <- new("mina", tab = maize_asv, des = maize_des)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)
p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment")
p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4,
color = "Compartment")
p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype")
p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color =
"Host_genotype")
p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape =
"Soil")
p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color =
"Compartment", shape = "Soil")

Calculate the unexplained variance ratio using formula indicated in: Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Description

Calculate the unexplained variance ratio using formula indicated in: Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Usage

com_r2(x, group)

Arguments

x

An object of class 'mina' with 'dis' and 'des' defined.

group

The name(s) of column(s) defined as experimental setup group(s).

Value

Unexplained variance ratio.

Examples

data(maize)
maize <- norm_tab(maize, method = "raref", depth = 5000)
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))

Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Description

Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Usage

## S4 method for signature 'mina,ANY'
com_r2(x, group)

## S4 method for signature 'mina,character'
com_r2(x, group)

Arguments

x

An mina object with 'dis' and 'des' defined.

group

The name(s) of column(s) defined as experimental setup group(s).

Value

r2 The variance ratio cannot be explained by given groups.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))

Function for correlation coefficient calculation.

Description

Function for correlation coefficient calculation.

Usage

cp_cor(mat)

Arguments

mat

The input matrix for correlation calculation.

Value

The output correlation matrix.


Internal testing data of HMP project, including quantitative table (hmp_otu) and descriptive table (hmp_des) for testing.

Description

Internal testing data of HMP project, including quantitative table (hmp_otu) and descriptive table (hmp_des) for testing.

Examples

data(hmp)

Internal testing data of maize project, vegetative stage samples only, including quantitative table (maize_asv.rds) and descriptive table (maize_des.txt) for testing.

Description

Internal testing data of maize project, vegetative stage samples only, including quantitative table (maize_asv.rds) and descriptive table (maize_des.txt) for testing.

Examples

data(maize)

Setter and getter for the slot 'des', which is the description and meta data of rows in 'tab'.

Description

Setter and getter for the slot 'des', which is the description and meta data of rows in 'tab'.

Usage

des(x) <- value

## S4 replacement method for signature 'mina'
des(x) <- value

des(x)

## S4 method for signature 'mina'
des(x)

Arguments

x

The 'mina' object.

value

The value to set for the slot of the 'mina' object 'x'.

Value

The 'des' slot of the 'mina' object.

Examples

des(maize) <- maize_des2
head(des(maize))

Getter for the slots 'dis_bs', 'dis_pm' and 'dis_stat'.

Description

Getter for the slots 'dis_bs', 'dis_pm' and 'dis_stat'.

Usage

dis_bs(x)

dis_pm(x)

dis_stat(x)

Arguments

x

The 'mina' object.

Value

The 'dis_bs', 'dis_pm' and 'dis_stat' slots of the 'mina' object.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment", per = 0.5)
maize <- net_dis(maize, method = "Jaccard")
dis_bs(maize)
dis_pm(maize)
dis_stat(maize)

Setter and getter for the slot 'dis'.

Description

Setter and getter for the slot 'dis'.

Get the slot 'dis'

Usage

dis(x) <- value

dis(x)

## S4 replacement method for signature 'mina'
dis(x) <- value

## S4 method for signature 'mina'
dis(x)

Arguments

x

The 'mina' object.

value

The value to set for the slot of the 'mina' object 'x'.

Value

The 'dis' slot of the 'mina' object.

Examples

maize_norm <- norm_tab(maize_asv2, method = "total")
dis(maize) <- com_dis(maize_norm, method = "bray")
dis(maize)[1:5, 1:5]

Dimensionality reduction of community dissimilarity / distance for visulization.

Description

Dimensionality reduction of community dissimilarity / distance for visulization.

Usage

dmr(x, k = 2)

Arguments

x

An object of class 'mina' with 'dis' defined or a distance matrix.

k

The dimension number after reduction.

Value

The dimentionality reduction results.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)

Dimensionality reduction of the distance matrix.

Description

Dimensionality reduction of the distance matrix.

Usage

## S4 method for signature 'matrix'
dmr(x, k = 4)

Arguments

x

A distance matrix.

k

The number of dimensionality after reduction, 4 by default.

Value

y The coordinates of components indicated in distance matrix in k dimension.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
asv_dis <- dis(maize)
asv_dis_dmr <- dmr(asv_dis, k = 4)

Dimensionality reduction of the 'dis' included in mina.

Description

Dimensionality reduction of the 'dis' included in mina.

Usage

## S4 method for signature 'mina'
dmr(x, k = 4)

Arguments

x

An object of the class 'mina' with 'dis' defined.

k

The number of dimensionality after reduction, 4 by default.

Value

x The same object with 'dmr' added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)

Filter the quantitative and descriptive table to make them have the same samples, the intersect samples will be remained.

Description

Filter the quantitative and descriptive table to make them have the same samples, the intersect samples will be remained.

Usage

fit_tabs(x)

Arguments

x

An object of the class mina with 'tab' and 'des' defined or a quantitative matrix(need parameter des in this case).

Value

Same 'mina' object but fitted 'tab' and 'des' (as well as 'norm' if defined)

Examples

data(maize)
maize <- fit_tabs(maize)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)

Filter the quantitative and descriptive table to make them have the same samples, samples present in both tables are remained. If 'norm' table exist in the 'mina' object, descriptive table will be filtered again to only keep samples present in 'norm'.

Description

Filter the quantitative and descriptive table to make them have the same samples, samples present in both tables are remained. If 'norm' table exist in the 'mina' object, descriptive table will be filtered again to only keep samples present in 'norm'.

Usage

## S4 method for signature 'mina'
fit_tabs(x)

Arguments

x

An object of class mina.

Value

x The same object as input with fitted 'tab', 'des' and 'norm' (if defined).

Examples

{
data(maize)
maize <- fit_tabs(maize)
maize <- norm_tab(maize, method = "total")
maize <- fit_tabs(maize)
}

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Description

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Usage

get_net_cls_tab(x_norm, x_cls, uw = FALSE)

Arguments

x_norm

The normalized quantitative table used for netowrk inference and clustering.

x_cls

The network clustering table.

uw

By summing up the number of present components of each cluster instead of relative abundance, default is FALSE.

Value

x_cls The quantitative table with clusters in rows.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize_norm <- norm(maize)
maize_adj <- adj(maize_norm, method = "spearman")
maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5)
maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Description

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Usage

## S4 method for signature 'matrix,data.frame'
get_net_cls_tab(x_norm, x_cls, uw = FALSE)

Arguments

x_norm

The normalized quantitative table used for netowrk inference and clustering.

x_cls

The network clustering table.

uw

By summing up the number of present components of each cluster instead of relative abundance, default is FALSE.

Value

x_cls The quantitative table with clusters in rows.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize_norm <- norm(maize)
maize_adj <- adj(maize_norm, method = "spearman")
maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5)
maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)

Same function as 'com_r2' with matrix and corresponding descriptive table as input.

Description

Same function as 'com_r2' with matrix and corresponding descriptive table as input.

Usage

get_r2(x, des, group)

Arguments

x

Dissimilarity / distance matrix which indicate variances.

des

The descriptive table of samples which define the groups.

group

The name(s) of column(s) used as experimental setup group(s) in descriptive file.

Value

r2 The variance ratio cannot be explained by given groups.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
get_r2(dis(maize), des(maize), group = c("Compartment", "Soil"))

Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Description

Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

Usage

## S4 method for signature 'matrix,ANY,ANY'
get_r2(x, des, group)

## S4 method for signature 'matrix,data.frame,ANY'
get_r2(x, des, group)

## S4 method for signature 'matrix,data.frame,character'
get_r2(x, des, group = c("Host_genotype", "Compartment", "Soil", "Management"))

Arguments

x

Dissimilarity / distance matrix which indicate variances.

des

The descriptive table of samples which define the groups.

group

The name(s) of column(s) used as experimental setup group(s) in descriptive file.

Value

r2 The variance ratio cannot be explained by given groups.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
x <- dis(maize)
des <- des(maize)
get_r2(x, des, group = c("Compartment", "Soil"))

Get the representative community members by extracting the most abundant and prevalent compositions.

Description

Get the representative community members by extracting the most abundant and prevalent compositions.

Get the representative community members.

Usage

get_rep(x, ...)

## S4 method for signature 'matrix'
get_rep(x, top = 5)

Arguments

x

A quantitative matrix with samples in columns and compositions in rows.

...

Additional parameters.

top

The percent of the most abundant and prevalent members.

Value

The matrix with samples in columns and representative compositions in rows.

The matrix with samples in columns and representative compositions in rows.

Examples

data(maize_asv)
maize_asv_rep <- get_rep(maize_asv)
data(maize_asv)
maize_asv_rep <- get_rep(maize_asv, top = 5)

Get the representative community members.

Description

Get the representative community members.

Usage

## S4 method for signature 'mina'
get_rep(x, top = 5)

Arguments

x

An object of the class 'mina' with @norm define.

top

The percent of the most abundant and prevalent members.

Value

The same object with @norm replaced by the representative members.

Examples

maize <- new("mina", tab = maize_asv, des = maize_des)
maize <- norm_tab(maize, method = "raref")
maize <- get_rep(maize, top = 5)

Design file for HMP project, including 2711 samples in total.

Description

Design file for HMP project, including 2711 samples in total.

Format

A data frame with columns:

Sample_ID

The unique ID of the microbial profiling sample.

Sex

The gender of the host human.

Run_center

The lab proccessing the sample sequencing.

Subsite

The subsite of body where samples were collected.

Site

The site of body where samples were collectec.

Description

The further details about the samples.

Source

HMP project.

Examples

data(hmp_des)

OTU table of HMP project, data downloaded from https://www.hmpdacc.org/hmp/HMQCP/

Description

OTU table of HMP project, data downloaded from https://www.hmpdacc.org/hmp/HMQCP/

Format

A matrix with samples in columns and OTUs in rows.

Source

HMP project.

Examples

data(hmp_otu)

ASV table of maize project, vegetative stage samples only.

Description

ASV table of maize project, vegetative stage samples only.

Format

A matrix with samples in columns and ASVs in rows. Unormalized table including 12765 ASVs from 420 samples.

Source

RECONSTRUCT project, maize microbiome part.

Examples

data(maize_asv)

Subset of ASV table of maize project, ASVs appear in less than 100 samples were filtered for later analysis.

Description

Subset of ASV table of maize project, ASVs appear in less than 100 samples were filtered for later analysis.

Format

A matrix with samples in columns and ASVs in rows. Unormalized table including 1219 ASVs from 313 samples.

Source

RECONSTRUCT project, maize microbiome part.

Examples

data(maize_asv2)

Design file of maize project, vegetative stage samples only, including 528 samples in total.

Description

Design file of maize project, vegetative stage samples only, including 528 samples in total.

Format

A data frame with columns:

Sample_ID

The unique ID of the microbial profiling sample.

Host_genotype

The genotype of the plant host maize.

Compartment

The compartment of the microbial sample comes from.

Soil

The soil of the sampled microbiome.

Management

The management of the soil where microbial sample from.

Source

RECONSTRUCT project, maize microbiome part.

Examples

data(maize_des)

Subset of design file of maize project, 313 samples are included.

Description

Subset of design file of maize project, 313 samples are included.

Format

A data frame with columns:

Sample_ID

The unique ID of the microbial profiling sample.

Host_genotype

The genotype of the plant host maize.

Compartment

The compartment of the microbial sample comes from.

Soil

The soil of the sampled microbiome.

Management

The management of the soil where microbial sample from.

Source

RECONSTRUCT project, maize microbiome part.

Examples

data(maize_des2)

Class "mina" includes the quantitative table and descriptive table.

Description

Class "mina" includes the quantitative table and descriptive table.

Slots

tab

The quantitative table of the dataset.

des

The descriptive table of the samples listed in @tab.

norm

The normalized quantitative table of @tab.

dis

The distance / dissimilarity matrix between samples in @tab.

dmr

The list of dimensionality reduction result, includes points and variance.

adj

The adjacency matrix between pairwise compositions (e.g. OTUs/ASVs)

adj_sig

The P-value matrix of adjacency matrix, only applicable for Pearson and Spearman correlation adjacency matrices.

cls

The cluster information for each composition.

cls_tab

The cluster quantitative table.

multi

The list of subsampled adjacency matrices for each environment.

perm

The list of permutated adjacency matrices for each pairwise environmental comparison.

dis_bs

The distance between networks of different environmental communities.

dis_pm

The distance between networks of permutated groups.

dis_stat

The average distance between subsampled environmental community networks, permutated networks and corresponding significance.

Author(s)

Rui Guan https://github.com/Guan06

Examples

maize <- new("mina", tab = maize_asv, des = maize_des)

Network clustering of sparsed adjacacency matrix.

Description

Network clustering of sparsed adjacacency matrix.

Usage

net_cls(x, method, ...)

Arguments

x

An object of class 'mina' with 'adj' defined.

method

The clustering method used.

...

Additional parameters.

Value

The network clustering results.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman")
maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE)

Get the cluster table 'cls_tab' from 'norm' and 'cls'.

Description

Get the cluster table 'cls_tab' from 'norm' and 'cls'.

Usage

net_cls_tab(x, uw = FALSE)

Arguments

x

An object of class 'mina' with 'norm' and 'cls' defined.

uw

By summing up the number of present components of each cluster instead of relative abundances, default is FALSE.

Value

The network cluster relative abundance table.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman")
maize <- net_cls(maize, method = "ap", cutoff = 0.5)
maize <- net_cls_tab(maize)

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Description

Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.

Usage

## S4 method for signature 'mina'
net_cls_tab(x, uw = FALSE)

Arguments

x

An object of class 'mina' with 'norm' and 'cls' defined.

uw

By summing up the number of present components of each cluster instead of relative abundance, default is FALSE.

Value

x The same 'mina' object with 'cls_tab' added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman")
maize <- net_cls(maize, method = "mcl", cutoff = 0.5)
maize <- net_cls_tab(maize)

Network clustering based on the sparsed adjacacency matrix.

Description

Network clustering based on the sparsed adjacacency matrix.

Usage

## S4 method for signature 'matrix,ANY'
net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)

## S4 method for signature 'matrix,character'
net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)

Arguments

x

Adjacency matrix used for clustering.

method

The clustering method used.

cutoff

The cutoff for the sparsed adjacacency matrix, default 0.4.

neg

Whether to keep the negative edges, cannot be TRUE when using 'mcl' for clustering. Default FALSE.

...

Additional parameters.

Value

y The cluster table.

Examples

asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_adj <- adj(asv_norm, method = "spearman")
asv_cls <- net_cls(asv_adj, method = "mcl")

Network clustering based on the sparsed adjacacency matrix.

Description

Network clustering based on the sparsed adjacacency matrix.

Usage

## S4 method for signature 'mina,ANY'
net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)

## S4 method for signature 'mina,character'
net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)

Arguments

x

An object of class 'mina' with 'adj' defined.

method

The clustering method used.

cutoff

The cutoff for the sparsed adjacacency matrix, default 0.4.

neg

Whether to keep the negative edges, cannot be TRUE when using 'mcl' for clustering. Default FALSE.

...

Additional parameters.

Value

x The same 'mina' class with @cls added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000)
maize <- fit_tabs(maize)
maize <- adj(maize, method = "spearman")
maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE)
maize <- net_cls(maize, method = "ap", cutoff = 0.4, neg = FALSE)

Calculate the network distance of 'multi' and test the significance when 'perm' is defined.

Description

Calculate the network distance of 'multi' and test the significance when 'perm' is defined.

Usage

net_dis(x, method, ...)

Arguments

x

An object of class 'mina' with 'multi' (and 'perm' if 'sig' is TRUE) defined.

method

The distance to be calculated, "spectra" and "Jaccard" are available.

...

Additional parameters.

Value

The netowrk comparison result.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- get_rep(maize, top = 5)
maize <- bs_pm(maize, group = "Compartment")
maize <- net_dis(maize, method = "spectra", evk = 30)

Calculate the network distance of bootstrap and permutation when appliable.

Description

Calculate the network distance of bootstrap and permutation when appliable.

Calculate the network distance of bootstrap and permutation when appliable.

Usage

net_dis_indi(x, method, ...)

## S4 method for signature 'character,ANY'
net_dis_indi(
  x,
  method,
  evk = 100,
  sig = TRUE,
  skip = TRUE,
  egv = TRUE,
  dir = "./",
  ...
)

## S4 method for signature 'character,character'
net_dis_indi(
  x,
  method,
  evk = 100,
  sig = TRUE,
  skip = TRUE,
  egv = TRUE,
  dir = "./",
  ...
)

Arguments

x

The folder store the network inference results. defined.

method

The distance to be calculated, "spectra" and "Jaccard" are available.

...

Additional parameters.

evk

The first 'evk' eigenvalues will be used for 'spectra' distance, the default is 100.

sig

Whether to test the significance, if TRUE (by default), permutation results should be included in the folder 'x'.

skip

Whether to skip the comparison when the dimenstion of adjacency matrix is smaller than setted 'evk', default TRUE.

egv

Wheather to output the eigenvectors for Spectral distance, the defult is TRUE, only validate when 'method == "spectra"'.

dir

The folder to output the eigenvectors, only validate when 'egv == TRUE'.

Value

y The 'mina' object with 'dis_bs', 'dis_pm' and 'dis_stat'.

y The 'mina' object with 'dis_bs', 'dis_pm' and 'dis_stat'.

Examples

## Not run: 
data(maize)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- get_rep(maize, top = 5)
maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir =
"./individual_bs_pm/")
maize_stat1 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra")
maize_stat2 <- net_dis_indi(x = "./individual_bs_pm/", method = "Jaccard")
maize_stat3 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra",
evk = 100, skip = TRUE)

## End(Not run)
## Not run: 
data(maize)
norm(maize) <- maize_asv2
maize <- fit_tabs(maize)
maize <- get_rep(maize, top= 5)
maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir =
"./individual_bs_pm/")
maize_stat1 <- net_dis_indi("./individual_bs_pm/", method = "spectra")
maize_stat2 <- net_dis_indi("./individual_bs_pm/", method = "Jaccard")
maize_stat3 <- net_dis_indi("./individual_bs_pm/", method = "spectra",
evk = 100, skip = TRUE)

## End(Not run)

Visulization of spectra network distance as PCoA.

Description

Visulization of spectra network distance as PCoA.

Visulization of spectra network distance as PCoA.

Usage

net_dis_pcoa(x)

## S4 method for signature 'character'
net_dis_pcoa(x)

Arguments

x

The folder with all egv files generated by net_dis_indi().

Value

p The plotted figure.

p The plotted figure.

Examples

## Not run: 
data(maize)
norm(maize) <- maize_asv2
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir =
"./individual_bs_pm/")
maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE,
dir = "./egv_folder/")
p <- net_dis_pcoa("./egv_folder/")

## End(Not run)
## Not run: 
data(maize)
maize <- norm_tab(maize)
maize <- fit_tabs(maize)
maize <- get_rep(maize, top = 5)
maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir =
"./individual_bs_pm/")
maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE,
dir = "./egv_folder/")
p <- net_dis_pcoa("./egv_folder/")

## End(Not run)

Visulization of network distance, average distances are used for tile plot.

Description

Visulization of network distance, average distances are used for tile plot.

Visulization of network distance, average distances are used for tile plot.

Usage

net_dis_plot(x, d = "BS", ...)

## S4 method for signature 'mina'
net_dis_plot(x, d = "BS", sig = TRUE)

Arguments

x

An object of 'mina' with slot 'dis_stat' defined.

d

The distance to be plotted, could be "BS" or "PM".

...

Additional parameters.

sig

If 'TRUE', indicating significant distance with gold guild.

Value

p The plotted figure.

p The plotted figure.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment")
maize <- net_dis(maize, method = "Jaccard")
p <- net_dis_plot(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment")
maize <- net_dis(maize, method = "Jaccard")
p <- net_dis_plot(maize, d = "BS")

Calculate the network distance of 'multi' and test the significance when 'perm' is defined.

Description

Calculate the network distance of 'multi' and test the significance when 'perm' is defined.

Usage

## S4 method for signature 'mina,ANY'
net_dis(
  x,
  method,
  evk = 100,
  egv = TRUE,
  dir = "./",
  sig = TRUE,
  skip = TRUE,
  ...
)

## S4 method for signature 'mina,character'
net_dis(
  x,
  method,
  evk = 100,
  egv = TRUE,
  dir = "./",
  sig = TRUE,
  skip = TRUE,
  ...
)

Arguments

x

An object of class 'mina' with 'multi' (and 'perm' if sig is TRUE) defined.

method

The distance to be calculated, "spectra" and "Jaccard" are available.

evk

The first 'evk' eigenvalues will be used for 'spectra' distance, the default is 100.

egv

Wheather to output the eigenvectors for Spectral distance, the defult is TRUE, only validate when 'method == "spectra"'.

dir

The folder to output the eigenvectors, only validate when 'egv == TRUE'.

sig

Whether to test the significance, if TRUE (by default), 'perm' is needed.

skip

Whether to skip the comparison when the dimenstion of adjacency matrix is smaller than setted 'evk'.

...

Additional parameters.

Value

x The same 'mina' object with 'net_dis' defined.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- bs_pm(maize, group = "Compartment")
maize <- net_dis(maize, method = "Jaccard")

Compare the group features between networks.

Description

Compare the group features between networks.

Compare the group features between networks.

Usage

net_grp_cmp(x, cmp = "contrast", dir = "./", grp)

## S4 method for signature 'character'
net_grp_cmp(x, cmp = "contrast", dir = "./", grp)

Arguments

x

The folder with all network inference results generated by bs_pm()

cmp

The compared feature of grp, default 'contrast'.

dir

The directory to store the alculated node features.

grp

The table with group information.

Examples

## Not run: 
net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp =
cls_tab(maize))

## End(Not run)
## Not run: 
net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp =
cls_tab(maize))

## End(Not run)

Compare the node features between networks.

Description

Compare the node features between networks.

Compare the node features between networks.

Usage

net_node_cmp(x, cmp = "contrast", dir = "./")

## S4 method for signature 'character,character'
net_node_cmp(x, cmp = "contrast", dir = "./")

Arguments

x

The folder with all network inference results generated by bs_pm()

cmp

The compared feature of node, default 'contrast'.

dir

The directory to store the alculated node features.

Examples

## Not run: 
net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./")

## End(Not run)
## Not run: 
net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./")

## End(Not run)

Normalize the slot 'tab' for later analysis.

Description

Normalize the slot 'tab' for later analysis.

Usage

norm_tab(x, method, ...)

Arguments

x

The input mina object with quantitative tab / a matrix needed to be normalized.

method

The method used for the normalization of quantitative table.

...

Additional parameters.

Value

Normalized quantitative table.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "total")

List of normalization methods supported in norm_tab

Description

Normalization methods should be specified by exact string match.

Usage

norm_tab_method_list

Format

A list of character vectors.

raref

By downsampling all samples to specific depth.

total

Devided by the total read of each sample.

See Also

norm_tab

Examples

? norm_tab_method_list

Normalize the quantitative matrix.

Description

Normalize the quantitative matrix.

Usage

## S4 method for signature 'matrix,character'
norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)

Arguments

x

A quantitative matrix with samples in columns and compositions in rows.

method

The method used for normalization.

depth

The depth for rarefying, 1000 by default.

replace

Whether to sample with replacement (TRUE by default) or without replacement (FALSE) when using method 'raref'.

multi

Rarefy the table for multiple times, 1 by default, indicate the times of rarefaction want to be repeated, only validate for rarefaction.

...

Additional parameters.

Value

The normalized quantitative matrix.

x_norm Normalized matrix of the quantitative table.

Examples

data(maize_asv2)
maize_asv_norm <- norm_tab(maize_asv2, method = "total")
maize_asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000,
replace = TRUE, multi = 3)

Normalize the quantitative table with mina input.

Description

Normalize the quantitative table with mina input.

Usage

## S4 method for signature 'mina,ANY'
norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)

## S4 method for signature 'mina,character'
norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)

Arguments

x

An object of the class mina with @tab defined.

method

The method used for normalization.

depth

The depth for subsampling by rarefying, 1000 by default.

replace

Whether to sample with replacement (TRUE by default) or without replacement (FALSE) when using method 'raref'.

multi

Rarefy the table for multiple times, FALSE by default, indicate the times of rarefaction want to be repeated, only validate for rarefaction.

...

Additional parameters.

Value

x An object of the class mina with @norm added.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref", depth = 1000, replace = TRUE,
multi = 3)

Setter and getters for the slot 'norm', normalized 'tab' matrix.

Description

Setter and getters for the slot 'norm', normalized 'tab' matrix.

Usage

norm(x) <- value

## S4 replacement method for signature 'mina'
norm(x) <- value

norm(x)

## S4 method for signature 'mina'
norm(x)

Arguments

x

The 'mina' object.

value

The value to set for the slot of the 'mina' object 'x'.

Value

The 'norm' slot of the 'mina' object.

Examples

norm(maize) <- norm_tab(maize_asv2, method = "total")
norm(maize)[1:5, 1:5]

Visulization of components distance / dissimilarity in k dimension.

Description

Visulization of components distance / dissimilarity in k dimension.

Visulization of components distance / dissimilarity in k dimension.

Usage

pcoa_plot(x, des, match, ...)

## S4 method for signature 'list,data.frame,character'
pcoa_plot(x, des, match, d1 = 1, d2 = 2, color, shape = NULL, ...)

Arguments

x

A list generated by 'dmr'.

des

The corresponding descriptive table.

match

The column name of the components IDs in 'des' with exactly the same as rownames in x.

...

Additional parameters.

d1

The dimension be visualized in x-axis, default '1'.

d2

The dimension be visualized in y-axis, default '2'.

color

The column name in 'des' to be used for different color groups.

shape

The column name in 'des' to be used for different shape groups, default 'NULL'.

Value

p The plotted figure.

p The plotted PCoA.

Examples

maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)
asv_dmr <- .dmr(maize)
des <- des(maize)
p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment")
p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color =
"Compartment")
p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype")
p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color =
"Host_genotype")
p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment",
shape = "Soil")
p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color =
"Compartment", shape = "Soil")
maize <- new("mina", tab = maize_asv2, des = maize_des2)
maize <- norm_tab(maize, method = "raref")
maize <- fit_tabs(maize)
maize <- com_dis(maize, method = "bray")
maize <- dmr(maize)
asv_dmr <- .dmr(maize)
des <- des(maize)
p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment")
p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color =
"Compartment")
p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype")
p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color =
"Host_genotype")
p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment",
shape = "Soil")
p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color =
"Compartment", shape = "Soil")

Setter and getter for the slot 'tab'.

Description

Setter and getter for the slot 'tab'.

Usage

tab(x) <- value

## S4 replacement method for signature 'mina'
tab(x) <- value

tab(x)

## S4 method for signature 'mina'
tab(x)

Arguments

x

The 'mina' object.

value

The value to set for the slot of the 'mina' object 'x'.

Value

The 'tab' slot of the 'mina' object.

The 'tab' slot of the 'mina' object.

The 'tab' slot of the 'mina' object.

The 'tab' slot of the 'mina' object.

Examples

tab(maize) <- maize_asv2
tab(maize)[1:5, 1:5]

TINA community dissimilarity used in com_dis. Function for 'tina' dissimilarity/distance calculation. Modified from Schmidt et al., 2016.

Description

TINA community dissimilarity used in com_dis. Function for 'tina' dissimilarity/distance calculation. Modified from Schmidt et al., 2016.

Usage

tina(x, ...)

Arguments

x

An matrix for dissimilarity calculation.

...

Additional parameters.

Value

The output 'tina' dissimilarity matrix.

Examples

## Not run: 
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_dis <- com_dis(asv_norm, method = "bray")
asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40)
asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja",
threads = 8, nblocks = 40)

## End(Not run)

Function for 'tina' dissimilarity calculation. Modified from Schmidt et al., 2016. Person and Spearman could be used for correlation and weighted and unweighted Jaccard could be used for similarity calculation.

Description

Function for 'tina' dissimilarity calculation. Modified from Schmidt et al., 2016. Person and Spearman could be used for correlation and weighted and unweighted Jaccard could be used for similarity calculation.

Usage

## S4 method for signature 'matrix'
tina(
  x,
  cor_method = "spearman",
  sim_method = "w_ja",
  threads = 80,
  nblocks = 400,
  ...
)

Arguments

x

A matrix for dissimilarity calculation.

cor_method

The method for correlation, "pearson" and "spearman" are available.

sim_method

The method for similarity, "w_ja" and "uw_ja" are available for weighted and unweighted Jaccard similarity respectively.

threads

The number of threads used for parallel running, 80 by default.

nblocks

The number of row and column for splitted sub-matrix, 400 by default.

...

Additional parameters.

Value

t The output 'tina' dissimilarity matrix.

Examples

## Not run: 
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000)
asv_dis <- com_dis(asv_norm, method = "bray")
asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40)
asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja",
threads = 8, nblocks = 40)

## End(Not run)