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

« back to all changes in this revision

Viewing changes to cogent/struct/dihedral.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:
27
27
__contributors__ = ["Kristian Rother", "Sandra Smit"]
28
28
__credits__ = ["Janusz Bujnicki", "Daniel McDonald"]
29
29
__license__ = "GPL"
30
 
__version__ = "1.4.1"
 
30
__version__ = "1.5.0"
31
31
__maintainer__ = "Kristian Rother"
32
32
__email__ = "krother@rubor.de"
33
33
__status__ = "Production"
61
61
    angle = acos(fix_rounding_error(cosine))
62
62
    return angle
63
63
 
 
64
 
 
65
def calc_angle(vec1,vec2,vec3):
 
66
    """Calculates a flat angle from three coordinates."""
 
67
    if len(vec1) == 3:
 
68
        v1, v2, v3 = map(create_vector,[vec1,vec2,vec3])
 
69
    else:
 
70
        v1, v2, v3 = map(create_vector2d,[vec1,vec2,vec3])
 
71
    v12 = v2 - v1
 
72
    v23 = v2 - v3
 
73
    return angle(v12, v23)
 
74
 
 
75
def create_vector2d(vec):
 
76
    """Returns a vector as a numpy array."""
 
77
    return array([vec[0],vec[1]])
 
78
    
 
79
 
64
80
def create_vector(vec):
65
81
    """Returns a vector as a numpy array."""
66
82
    return array([vec[0],vec[1],vec[2]])