# mantel: Apply the Mantel test to two distance matrices¶

Citations

 [diversity:mantel:Man67] Nathan Mantel. The detection of disease clustering and a generalized regression approach. Cancer research, 27(2 Part 1):209–220, 1967.
 [diversity:mantel:Pea95] Karl Pearson. Note on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58:240–242, 1895.
 [diversity:mantel:Spe04] Charles Spearman. The proof and measurement of association between two things. The American journal of psychology, 15(1):72–101, 1904.

#### Docstring:

Usage: qiime diversity mantel [OPTIONS]

Apply a two-sided Mantel test to identify correlation between two distance
matrices.

Note: the directionality of the comparison has no bearing on the results.
Thus, comparing distance matrix X to distance matrix Y is equivalent to
comparing Y to X.

Note: the order of samples within the two distance matrices does not need
to be the same; the distance matrices will be reordered before applying
the Mantel test.

See the scikit-bio docs for more details about the Mantel test:

http://scikit-
bio.org/docs/latest/generated/generated/skbio.stats.distance.mantel.html

Options:
--i-dm1 ARTIFACT PATH DistanceMatrix
Matrix of distances between pairs of
samples.  [required]
--i-dm2 ARTIFACT PATH DistanceMatrix
Matrix of distances between pairs of
samples.  [required]
--p-method [pearson|spearman]   The correlation test to be applied in the
Mantel test.  [default: spearman]
--p-permutations INTEGER RANGE  The number of permutations to be run when
computing p-values. Supplying a value of
zero will disable permutation testing and
p-values will not be calculated (this
results in *much* quicker execution time if
p-values are not desired).  [default: 999]
--p-intersect-ids / --p-no-intersect-ids
distance matrices will be discarded before
applying the Mantel test. Default behavior
is to error on any mismatched IDs.
[default: False]
--p-label1 TEXT                 Label for dm1 in the output visualization.
[default: Distance Matrix 1]
--p-label2 TEXT                 Label for dm2 in the output visualization.
[default: Distance Matrix 2]
--o-visualization VISUALIZATION PATH
[required if not passing --output-dir]
--output-dir DIRECTORY          Output unspecified results to a directory
--cmd-config FILE               Use config file for command options
--verbose                       Display verbose output to stdout and/or
stderr during execution of this action.
[default: False]
--quiet                         Silence output if execution is successful
(silence is golden).  [default: False]
--citations                     Show citations and exit.
--help                          Show this message and exit.

#### Import:

from qiime2.plugins.diversity.visualizers import mantel


#### Docstring:

Apply the Mantel test to two distance matrices

Apply a two-sided Mantel test to identify correlation between two distance
matrices.  Note: the directionality of the comparison has no bearing on the
results. Thus, comparing distance matrix X to distance matrix Y is
equivalent to comparing Y to X.  Note: the order of samples within the two
distance matrices does not need to be the same; the distance matrices will
be reordered before applying the Mantel test.  See the scikit-bio docs for
more details about the Mantel test:  http://scikit-
bio.org/docs/latest/generated/generated/skbio.stats.distance.mantel.html

Parameters
----------
dm1 : DistanceMatrix
Matrix of distances between pairs of samples.
dm2 : DistanceMatrix
Matrix of distances between pairs of samples.
method : Str % Choices({'pearson', 'spearman'}), optional
The correlation test to be applied in the Mantel test.
permutations : Int % Range(0, None), optional
The number of permutations to be run when computing p-values. Supplying
a value of zero will disable permutation testing and p-values will not
be calculated (this results in *much* quicker execution time if
p-values are not desired).
intersect_ids : Bool, optional
If supplied, IDs that are not found in both distance matrices will be
discarded before applying the Mantel test. Default behavior is to error
on any mismatched IDs.
label1 : Str, optional
Label for dm1 in the output visualization.
label2 : Str, optional
Label for dm2 in the output visualization.

Returns
-------
visualization : Visualization