Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/afe1db2a19a2
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 23:58:13 2012
Кодировка:
allpy: afe1db2a19a2

allpy

changeset 174:afe1db2a19a2

some local var name changes
author boris <bnagaev@gmail.com>
date Wed, 03 Nov 2010 19:08:20 +0300
parents 45573ee48844
children fb3164f03984
files lib/project.py
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/lib/project.py	Wed Nov 03 19:01:50 2010 +0300
     1.2 +++ b/lib/project.py	Wed Nov 03 19:08:20 2010 +0300
     1.3 @@ -33,9 +33,9 @@
     1.4          """overloaded constructor
     1.5  
     1.6          Project() -> new empty Project
     1.7 -        Project(sequences, alignment) -> new Project with sequences and
     1.8 -            alignment initialized from arguments
     1.9 -        Project(fasta_file) -> new Project, read alignment and sequences
    1.10 +        Project(sequences, body) -> new Project with sequences and
    1.11 +            body initialized from arguments
    1.12 +        Project(fasta_file) -> new Project, read body and sequences
    1.13               from fasta file 
    1.14  
    1.15          """
    1.16 @@ -102,12 +102,12 @@
    1.17          monomer_kind is class, inherited from MonomerType
    1.18          
    1.19          >>> import project
    1.20 -        >>> sequences,alignment=project.Project.from_fasta(open("test.fasta"))       
    1.21 +        >>> sequences,body=project.Project.from_fasta(open("test.fasta"))       
    1.22          """
    1.23          import re
    1.24  
    1.25          sequences = []
    1.26 -        alignment = {}
    1.27 +        body = {}
    1.28  
    1.29          raw_sequences = file.read().split(">")
    1.30          if len(raw_sequences) <= 1:
    1.31 @@ -137,17 +137,17 @@
    1.32                  piece_without_whitespace_chars = re.sub("\s", "", piece)
    1.33                  string += piece_without_whitespace_chars
    1.34              monomers = [] #convert into Monomer objects
    1.35 -            alignment_list = [] #create the respective list in alignment dict
    1.36 +            body_list = [] #create the respective list in body dict
    1.37              for current_monomer in string:
    1.38                  if current_monomer not in ["-", ".", "~"]:
    1.39                      monomers.append(monomer_kind.from_code1(current_monomer).instance())
    1.40 -                    alignment_list.append(monomers[-1])
    1.41 +                    body_list.append(monomers[-1])
    1.42                  else:
    1.43 -                    alignment_list.append(None)
    1.44 +                    body_list.append(None)
    1.45              sequence = sequence.Sequence(monomers, name, description)
    1.46              sequences.append(sequence)
    1.47 -            alignment[sequence] = alignment_list
    1.48 -        return sequences, alignment
    1.49 +            body[sequence] = body_list
    1.50 +        return sequences, body
    1.51      
    1.52      
    1.53      @staticmethod
    1.54 @@ -181,7 +181,7 @@
    1.55          self.save_fasta(tmp_file)
    1.56          tmp_file.close()
    1.57          os.system("muscle -in %(tmp)s -out %(tmp)s" % {'tmp': tmp_file.name})
    1.58 -        sequences, alignment = Project.from_fasta(open(tmp_file.name))
    1.59 +        sequences, body = Project.from_fasta(open(tmp_file.name))
    1.60          for sequence in self.sequences:
    1.61              try:
    1.62                  new_sequence = [i for i in sequences if sequence==i][0]
    1.63 @@ -190,7 +190,7 @@
    1.64                  sequence.name)
    1.65              old_monomers = iter(sequence.monomers)
    1.66              self.body[sequence] = []
    1.67 -            for monomer in alignment[new_sequence]:
    1.68 +            for monomer in body[new_sequence]:
    1.69                  if not monomer:
    1.70                      self.body[sequence].append(monomer)
    1.71                  else: