assignTaxonLevelsToA: Assign Taxon Levels

View source: R/assignTaxonLevelsToA.R

assignTaxonLevelsToAR Documentation

Assign Taxon Levels

Description

Assign OTU identifiers or higher-level taxon names to an interaction matrix

Usage

assignTaxonLevelsToA(A, lineages, taxon.level = "genus",
  pos.only = FALSE, neg.only = FALSE, uniqueNames = FALSE,
  higherLevelNames = TRUE, no.merge = FALSE)

Arguments

A

an interaction matrix

lineages

a matrix with lineages, for the format please see data david_stool_lineages

taxon.level

the taxon level to be assigned as row and column names, supported: otu, species, genus, family, order, class, phylum

pos.only

merge only positive entries such that final interaction matrix only contains positive entries (not carried out if uniqueNames is TRUE)

neg.only

merge only negative entries such that final interaction matrix only contains negative entries (not carried out if uniqueNames is TRUE)

uniqueNames

make names unique by appending a counter if needed (prevents merging of entries belonging to the same taxon)

higherLevelNames

if given level is not known, assign the highest level that is known

no.merge

suppress merging (in this case, taxon names are returned in a separate column of the matrix, not as row and column names)

Details

By default, interactions will be merged to the given higher-level taxon level by adding 1 for a positive entry and subtracting 1 for a negative entry. If only positive or only negative entries are merged, the sum of positive or negative entries will be returned. If uniqueNames is set to TRUE, merging is not carried out. Merging can also be suppressed with option no.merge. In this case, since non-unique row and column names are not allowed, taxon names are returned as a separate column in the interaction matrix.

Value

an interaction matrix with taxon names assigned

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)
Aclass=assignTaxonLevelsToA(A,lineages=david_stool_lineages, taxon.level="class")
classnetwork=plotA(Aclass,method="network")

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