analyseTaxaInA: Compute edge statistics for an interaction matrix with...

View source: R/analyseTaxaInA.R

analyseTaxaInAR Documentation

Compute edge statistics for an interaction matrix with taxonomic information

Description

The function expects an interaction matrix with taxon names given as row and column names and their assignment to a higher taxonomic level given in the first column (can be generated with assignTaxonLevelsToA). Either the edge number or the p-value of the edge number given the number of taxa in both higher-level taxon groups is reported. The p-value is computed by randomizing the interaction matrix while preserving the total number of its entries. Entries (i,j) and (j,i) in the interaction matrix are counted as one interaction by default.

Usage

analyseTaxaInA(taxonA, count.entries = FALSE, count.loops = FALSE,
  report.pval = FALSE, report.rand = FALSE, pos.only = FALSE,
  neg.only = FALSE, iters = 100, p.threshold = 0.05, sig = FALSE)

Arguments

taxonA

an interaction matrix with taxonomy (first column contains higher-level taxa)

count.entries

instead of interactions, count links (so entries (i,j) and (j,i) are not combined, but counted separately)

count.loops

count link of a node to itself

report.pval

if true, entries in the resulting interaction matrix are p-values of edge number between taxonomic groups, else edge numbers

report.rand

return the mean number of links found in randomized matrices

pos.only

only consider positive entries in taxonA

neg.only

only consider negative entries in taxonA

iters

number of randomizations for report.pval

p.threshold

only report higher-level links with p-values below given threshold

sig

convert p-values into significances

Value

an interaction matrix with as many rows and columns as there are distinct higher-level taxa in the first column of the input

Examples

data("david_stool_lineages")
# make a random OTU interaction matrix as an example
N=30
A=generateA(N=N,c=0.1)
randomOTUIndices=sample(1:nrow(david_stool_lineages))[1:N]
rownames(A)=david_stool_lineages[randomOTUIndices,1]
colnames(A)=rownames(A)
A.otu=assignTaxonLevelsToA(A,lineages=david_stool_lineages, taxon.level="genus",no.merge=TRUE)
A.phylum=analyseTaxaInA(A.otu,count.loops=TRUE, count.entries=TRUE)

hallucigenia-sparsa/seqtime documentation built on Jan. 9, 2023, 11:53 p.m.