Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/05983300140a
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:07:09 2012
Кодировка:
allpy: 05983300140a

allpy

changeset 321:05983300140a

Trivial bugfixes in base. Fixed Alignment.from_fasta and Sequence interface
author Daniil Alexeyevsky <me.dendik@gmail.com>
date Fri, 17 Dec 2010 00:32:13 +0300
parents e844812cccc4
children 696d314ad718
files allpy/base.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/allpy/base.py	Fri Dec 17 00:25:46 2010 +0300
     1.2 +++ b/allpy/base.py	Fri Dec 17 00:32:13 2010 +0300
     1.3 @@ -170,11 +170,11 @@
     1.4          return id(self)
     1.5  
     1.6      @classmethod
     1.7 -    def from_string(cls, string, name='', description=''):
     1.8 +    def from_string(cls, string, name='', description='', source=''):
     1.9          """Create sequences from string of one-letter codes."""
    1.10          monomer = cls.monomer_type.from_code1
    1.11          monomers = [monomer(letter) for letter in string]
    1.12 -        return cls(monomers, name, description)
    1.13 +        return cls(monomers, name, description, source)
    1.14  
    1.15      @classmethod
    1.16      def from_fasta(cls, file):
    1.17 @@ -184,7 +184,7 @@
    1.18          """
    1.19          sequence, = fasta.parse_file(file)
    1.20          name, description, body = sequence
    1.21 -        return cls(body, name, description, file.name)
    1.22 +        return cls.from_string(body, name, description, file.name)
    1.23  
    1.24  class Alignment(object):
    1.25      """Alignment. It is a list of Columns."""
    1.26 @@ -219,7 +219,7 @@
    1.27          Sequence = self.sequence_type
    1.28          not_gap = lambda (i, char): char not in gaps
    1.29          without_gaps = util.remove_each(line, gaps)
    1.30 -        sequence = Sequence(without_gaps, name, description, source)
    1.31 +        sequence = Sequence.from_string(without_gaps, name, description, source)
    1.32          # The following line has some simple magic:
    1.33          # 1. attach natural numbers to monomers
    1.34          # 2. delete gaps
    1.35 @@ -248,7 +248,7 @@
    1.36          """Create new alignment from FASTA file."""
    1.37          self = cls()
    1.38          for (name, description, body) in fasta.parse_file(file):
    1.39 -            self.append_gapped_line(body, name, description, gaps)
    1.40 +            self.append_gapped_line(body, name, description, file.name, gaps)
    1.41          return self
    1.42  
    1.43      def to_fasta(self, file):