Commit f2e3df8a by Aurélie Bonin

--no commit message

parent 7f76bce2
#!/usr/local/bin/python
'''
Created on 2 fevr. 2010
:py:mod:`obistat`: Computes basic statistics for attribute values
=================================================================
@author: coissac
'''
.. codeauthor:: Eric Coissac <eric.coissac@metabarcoding.org>
:py:mod:`obistats` computes basic statistics for attribute values of sequence records.
The sequence records can be categorized or not using the ``-c`` option, and several ``-c`` options can be combined.
By default, only the number of sequence records and the total count are computed for each category.
Additional statitics can be computed for attribute values in each category, like
minimum value (``-m`` option), maximum value (``-M`` option), mean value
(``-a`` option), variance (``-v`` option) or standard deviation (``-s`` option).
The result is a contingency table with the different categories in rows, and the
computed statistics in columns.
'''
from obitools.options import getOptionManager
from obitools.format.options import addInputFormatOption
from obitools.ecopcr.options import addTaxonomyDBOptions, loadTaxonomyDatabase
import math
def addStatOptions(optionManager):
optionManager.add_option('-c','--category-attribute',
group = optionManager.add_option_group('Obistat specific options')
group.add_option('-c','--category-attribute',
action="append", dest="categories",
metavar="<Attribute Name>",
default=[],
help="Add one attribute to the list of"
" attribute used for categorizing sequences")
help="Attribute used to categorize the sequence records.")
optionManager.add_option('-m','--min',
group.add_option('-m','--min',
action="append", dest="minimum",
metavar="<Attribute Name>",
default=[],
help="compute minimum of attribute")
help="Computes the minimum value of attribute for each category.")
optionManager.add_option('-M','--max',
group.add_option('-M','--max',
action="append", dest="maximum",
metavar="<Attribute Name>",
default=[],
help="compute maximum of attribute")
help="Computes the maximum value of attribute for each category.")
optionManager.add_option('-a','--mean',
group.add_option('-a','--mean',
action="append", dest="mean",
metavar="<Attribute Name>",
default=[],
help="compute mean of attribute")
help="Computes the mean value of attribute for each category.")
optionManager.add_option('-v','--variance',
group.add_option('-v','--variance',
action="append", dest="var",
metavar="<Attribute Name>",
default=[],
help="compute the estimator of variance of the attribute")
help="Computes the variance of attribute for each category.")
optionManager.add_option('-s','--std-dev',
group.add_option('-s','--std-dev',
action="append", dest="sd",
metavar="<Attribute Name>",
default=[],
help="compute the estimator of standard deviation of attribute")
help="Computes the standard deviation of attribute for each category.")
def statistics(values,attribute,func):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment