otu_calc module

assign_otu_membership

Determines the number of OTUs associated with samples using fuzzy sets with membership amount determined by relative abundance.

usage: phylotoast.otu_calc.assign_otu_membership(biom)
biomf:

BIOM format file.

return:

Returns a dictionary of FuzzySet of SampleID’s with OTUID and relative abundance as its elements.


fuzzy_lookup

Return the intersection of a fuzzy set and a collection of keys (presumably a subset).

usage: phylotoast.otu_calc.fuzzy_lookup(orig, keys)
orig:

FuzzySet of SampleID with OTUID and relative abundances.

keys:

Genus-species taxonomic identifier.

return:

Returns a new FuzzySet of genus-species identifier and relative abundance for the given list of keys.


load_core_file

For core OTU data file, returns Genus-species identifier for each data entry.

usage: phylotoast.otu_calc.load_core_file(core_fp)
core_fp:

A file containing core OTU data.

return:

Returns genus-species identifier based on identified taxonomical level.


otu_name_biom

Given an OTU row from a BIOM table, determine a Genus-species identifier from the taxonomic specifier (see otu_name() method).

usage: phylotoast.otu_calc.otu_name_biom(biom_row)
biom_row:

Row entry of a BIOM file containing full taxonomy.

return:

Returns the genus-species identifier.


otu_name

Determine a simple Genus-species identifier for an OTU, if possible. If OTU is not identified to the species level, name it as Unclassified (familly/genus/etc...).

usage: phylotoast.otu_calc.otu_name(tax)
tax:

QIIME-style taxonomy identifiers, e.g. [‘k__Bacteria’, u’p__Firmicutes’, u’c__Bacilli’, ...]

return:

Returns genus-species identifier based on identified taxonomical level.



sdi

Calculate the Shannon Diversity Index.

\[H = -sum(p*ln(p))\]

where p is the relative abundance of a single OTU in the set.

usage: phylotoast.otu_calc.sdi(fset)
fset:

The set of OTUs and their relative abundance values.

return:

The Shannon Diversity Index.

Note

Equitability Index \((E_H = H / H_{max})\) could be easily calculated from the returned array by:

\[diversities = sdi(fset)\]\[equitabilities = diversities/max(diversities)\]