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

« back to all changes in this revision

Viewing changes to cogent/db/ensembl/name.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:
6
6
__copyright__ = "Copyright 2007, The Cogent Project"
7
7
__credits__ = ["Gavin Huttley"]
8
8
__license__ = "GPL"
9
 
__version__ = "1.4.1"
 
9
__version__ = "1.5.0"
10
10
__maintainer__ = "Gavin Huttley"
11
11
__email__ = "Gavin.Huttley@anu.edu.au"
12
12
__status__ = "alpha"
14
14
_release = re.compile("\d+")
15
15
def get_version_from_name(name):
16
16
    """returns the release and build identifiers from an ensembl db_name"""
17
 
    name = _name_delim.split(name)
18
 
    # if last entry has a release and build
19
 
    release, build = None, None
20
 
    if _release.findall(name[-2]):
21
 
        release = _release.findall(name[-2])[0]
22
 
        build = name[-1]
23
 
    else:
24
 
        release = _release.findall(name[-1])[0]
25
 
    return release, build
 
17
    r = _release.search(name)
 
18
    if r is None:
 
19
        return None, None
 
20
    
 
21
    # first number run is release, followed by build
 
22
    # note, for the ensemblgenomes naming system, the second digit run is the
 
23
    # standard Ensembl release and the first is for the specified genome
 
24
    release = name[r.start(): r.end()]
 
25
    b = [s for s in _name_delim.split(name[r.end():]) if s]
 
26
    
 
27
    return release, b
26
28
 
27
29
_name_delim = re.compile("_")
28
30
def get_dbtype_from_name(name):
29
31
    """returns the data base type from the name"""
30
32
    try:
31
 
        name = _name_delim.split(name)
 
33
        name = _release.split(name)
 
34
        name = [s for s in _name_delim.split(name[0]) if s]
32
35
    except TypeError, msg:
33
36
        print "Error:"
34
37
        print name, type(name), msg
37
40
    if name[0] == "ensembl":
38
41
        dbtype = name[1]
39
42
    else:
40
 
        dbtype = "_".join(name[2:-2])
 
43
        dbtype = "_".join(name[2:])
41
44
    return dbtype
42
45
 
43
46
def get_db_prefix(name):
61
64
        self.Name = db_name
62
65
        self.Type = get_dbtype_from_name(db_name)
63
66
        self.Prefix = get_db_prefix(db_name)
 
67
        
64
68
        release, build = get_version_from_name(db_name)
65
69
        self.Release = release
66
 
        self.Build = build
 
70
        self.GeneralRelease = self.Release
 
71
        
 
72
        if len(build) == 1:
 
73
            if self.Type != 'compara':
 
74
                self.Build = build[0]
 
75
            else:
 
76
                self.Build = None
 
77
                self.GeneralRelease = build[0]
 
78
        elif build:
 
79
            self.Build = build[1]
 
80
            self.GeneralRelease = build[0]
 
81
        else:
 
82
            self.Build  = None
 
83
        
67
84
        self.Species = None
68
85
        self.Species = Species.getSpeciesName(self.Prefix)
69
86