graph_perm_test {phyloseqGraphTest} | R Documentation |
Performs graph-based permutation tests
Description
Performs graph-based tests for one-way designs.
Usage
graph_perm_test(
physeq,
sampletype,
grouping = 1:nsamples(physeq),
distance = "jaccard",
type = c("mst", "knn", "threshold.value", "threshold.nedges"),
max.dist = 0.4,
knn = 1,
nedges = nsamples(physeq),
keep.isolates = TRUE,
nperm = 499
)
Arguments
physeq |
A phyloseq object. |
sampletype |
A string giving the column name of the sample to be tested. This should be a factor with two or more levels. |
grouping |
Either a string with the name of a sample data column or a factor of length equal to the number of samples in physeq. These are the groups of samples whose labels should be permuted and are used for repeated measures designs. Default is no grouping (each group is of size 1). |
distance |
A distance, see |
type |
One of "mst", "knn", "threshold". If "mst", forms the minimum spanning tree of the sample points. If "knn", forms a directed graph with links from each node to its k nearest neighbors. If "threshold", forms a graph with edges between every pair of samples within a certain distance. |
max.dist |
For type "threshold", the maximum distance between two samples such that we put an edge between them. |
knn |
For type "knn", the number of nearest neighbors. |
nedges |
If using "threshold.nedges", the number of edges to use. |
keep.isolates |
In the returned network, keep the unconnected points? |
nperm |
The number of permutations to perform. |
Value
A list with the observed number of pure edges, the vector containing the number of pure edges in each permutation, the permutation p-value, the graph used for testing, and a vector with the sample types used for the test.
Examples
library(phyloseq)
data(enterotype)
gt = graph_perm_test(enterotype, sampletype = "SeqTech", type = "mst")
gt