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

« back to all changes in this revision

Viewing changes to cogent/core/alignment.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:
37
37
from numpy.random import randint, permutation
38
38
 
39
39
from cogent.util.dict2d import Dict2D
40
 
import logging
41
 
LOG = logging.getLogger('cogent.data')
42
40
 
43
41
from copy import copy
44
42
from cogent.core.profile import Profile
49
47
                    "Jeremy Widmann", "Catherine Lozupone", "Matthew Wakefield",
50
48
                    "Micah Hamady", "Daniel McDonald"]
51
49
__license__ = "GPL"
52
 
__version__ = "1.4.1"
 
50
__version__ = "1.5.0"
53
51
__maintainer__ = "Rob Knight"
54
52
__email__ = "rob@spot.colorado.edu"
55
53
__status__ = "Production"
1679
1677
        sample = Map(positions, parent_length=len(self))
1680
1678
        return self.gappedByMap(sample, Info=self.Info)
1681
1679
 
1682
 
    def slidingWindows(self, window, step):
 
1680
    def slidingWindows(self, window, step, start=None, end=None):
1683
1681
        """Generator yielding new Alignments of given length and interval.
1684
1682
 
1685
1683
        Arguments:
1686
1684
            - window: The length of each returned alignment.
1687
1685
            - step: The interval between the start of the successive
1688
1686
              alignment objects returned.
 
1687
            - start: first window start position
 
1688
            - end: last window start position
1689
1689
        """
1690
 
        for pos in range(0, len(self)-window+1,step):
1691
 
            yield self[pos:pos+window]
 
1690
        start = [start, 0][start is None]
 
1691
        end = [end, len(self)-window+1][end is None]
 
1692
        end = min(len(self)-window+1, end)
 
1693
        if start < end and len(self)-end >= window-1:
 
1694
            for pos in xrange(start, end, step):
 
1695
                yield self[pos:pos+window]
 
1696
        
 
1697
    
1692
1698
  
1693
1699
def aln_from_array(a, array_type=None, Alphabet=None):
1694
1700
    """Alignment from array of pos x seq: no change, names are integers.