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.
print_membership¶
Given an entry from a Sample dictionary (see assign_otu_membership) of fuzzy otu membership, pretty-print the members as percentages.
usage: phylotoast.otu_calc.print_membership(entry)
-
entry
:
¶ SampleID’s from the output dict of assign_otu_membership().
-
return
:
¶ Returns OTU name and percentage relative abundance as membership for the given list of SampleID’s.
sdi¶
Calculate the Shannon Diversity Index.
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: