~ubuntu-branches/ubuntu/natty/python-cogent/natty

« back to all changes in this revision

Viewing changes to tests/test_maths/test_stats/test_alpha_diversity.py

  • Committer: Bazaar Package Importer
  • Author(s): Steffen Moeller
  • Date: 2010-12-04 22:30:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101204223035-j11kinhcrrdgg2p2
Tags: 1.5-1
* Bumped standard to 3.9.1, no changes required.
* New upstream version.
  - major additions to Cookbook
  - added AlleleFreqs attribute to ensembl Variation objects.
  - added getGeneByStableId method to genome objects.
  - added Introns attribute to Transcript objects and an Intron class.
  - added Mann-Whitney test and a Monte-Carlo version
  - exploratory and confirmatory period estimation techniques (suitable for
    symbolic and continuous data)
  - Information theoretic measures (AIC and BIC) added
  - drawing of trees with collapsed nodes
  - progress display indicator support for terminal and GUI apps
  - added parser for illumina HiSeq2000 and GAiix sequence files as 
    cogent.parse.illumina_sequence.MinimalIlluminaSequenceParser.
  - added parser to FASTQ files, one of the output options for illumina's
    workflow, also added cookbook demo.
  - added functionality for parsing of SFF files without the Roche tools in
    cogent.parse.binary_sff
  - thousand fold performance improvement to nmds
  - >10-fold performance improvements to some Table operations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
#file test_alpha_diversity.py
 
3
from __future__ import division
3
4
from numpy import array, log, sqrt, exp
4
5
from math import e
5
6
from cogent.util.unit_test import TestCase, main
9
10
    strong, kempton_taylor_q, fisher_alpha, \
10
11
    mcintosh_e, heip_e, simpson_e, robbins, robbins_confidence, \
11
12
    chao1_uncorrected, chao1_bias_corrected, chao1, chao1_var, \
12
 
    chao1_confidence, ACE
 
13
    chao1_confidence, ACE, michaelis_menten_fit
13
14
 
14
15
__author__ = "Rob Knight"
15
16
__copyright__ = "Copyright 2007-2009, The Cogent Project"
16
 
__credits__ = ["Rob Knight"]
 
17
__credits__ = ["Rob Knight","Justin Kuczynski"]
17
18
__license__ = "GPL"
18
 
__version__ = "1.4.1"
 
19
__version__ = "1.5.0"
19
20
__maintainer__ = "Rob Knight"
20
21
__email__ = "rob@spot.colorado.edu"
21
22
__status__ = "Production"
250
251
        self.assertFloatEqual(ACE(array([12,3,2,1])), 4.6, eps=0.001)
251
252
        self.assertFloatEqual(ACE(array([12,3,6,1,10])), 5.62749672, eps=0.001)
252
253
 
 
254
    def test_michaelis_menten_fit(self):
 
255
        """ michaelis_menten_fit should match hand values in limiting cases"""
 
256
        res = michaelis_menten_fit([22])
 
257
        self.assertFloatEqual(res,1.0,eps=.01)
 
258
        res =  michaelis_menten_fit([42])
 
259
        self.assertFloatEqual(res,1.0,eps=.01)
 
260
        res =  michaelis_menten_fit([34],num_repeats=3,params_guess=[13,13])
 
261
        self.assertFloatEqual(res,1.0,eps=.01)
 
262
        res =  michaelis_menten_fit([70,70],num_repeats=5)
 
263
        self.assertFloatEqual(res,2.0,eps=.01)
253
264
 
254
265
 
255
266
if __name__ == '__main__':