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

« back to all changes in this revision

Viewing changes to cogent/app/cd_hit.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:
14
14
__copyright__ = "Copyright 2007-2009, The Cogent Project"
15
15
__credits__ = ["Daniel McDonald"]
16
16
__license__ = "GPL"
17
 
__version__ = "1.4.1"
 
17
__version__ = "1.5.0"
18
18
__maintainer__ = "Daniel McDonald"
19
19
__email__ = "mcdonadt@colorado.edu"
20
20
__status__ = "Development"
223
223
    """
224
224
    # keys are not remapped. Tested against seq_ids of 100char length
225
225
    seqs = SequenceCollection(seqs, MolType=moltype)
226
 
 
 
226
    #Create mapping between abbreviated IDs and full IDs
 
227
    int_map, int_keys = seqs.getIntMap()
 
228
    #Create SequenceCollection from int_map.
 
229
    int_map = SequenceCollection(int_map,MolType=moltype)
 
230
    
227
231
    # setup params and make sure the output argument is set
228
232
    if params is None:
229
233
        params = {}
242
246
        raise ValueError, "Moltype must be either PROTEIN, RNA, or DNA"
243
247
 
244
248
    # grab result
245
 
    res = app(seqs.toFasta())
 
249
    res = app(int_map.toFasta())
246
250
    clusters = parse_cdhit_clstr_file(res['CLSTR'].readlines())
247
251
 
 
252
    remapped_clusters = []
 
253
    for c in clusters:
 
254
        curr = [int_keys[i] for i in c]
 
255
        remapped_clusters.append(curr)
 
256
 
248
257
    # perform cleanup
249
258
    res.cleanUp()
250
259
    shutil.rmtree(working_dir)
251
260
    remove(params['-o'] + '.bak.clstr')
252
261
 
253
 
    return clusters
 
262
    return remapped_clusters
254
263
 
255
264
def cdhit_from_seqs(seqs, moltype, params=None):
256
265
    """Returns the CD-HIT results given seqs