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

allpy

changeset 690:df624c729ab5

Implemented SequenceCaseMarkup along with the required changes to Monomer.
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Tue, 05 Jul 2011 18:30:42 +0400
parents f8518f3822b8
children 450cbb7bcf51
files allpy/base.py allpy/markups.py
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/allpy/base.py	Tue Jul 05 16:55:34 2011 +0400
     1.2 +++ b/allpy/base.py	Tue Jul 05 18:30:42 2011 +0400
     1.3 @@ -68,7 +68,9 @@
     1.4      @classmethod
     1.5      def from_code1(cls, code1):
     1.6          """Create new monomer from 1-letter code."""
     1.7 -        return cls.by_code1[code1.upper()]()
     1.8 +        monomer = cls.by_code1[code1.upper()]()
     1.9 +        monomer.input_code1 = code1
    1.10 +        return monomer
    1.11  
    1.12      @classmethod
    1.13      def from_code3(cls, code3):
     2.1 --- a/allpy/markups.py	Tue Jul 05 16:55:34 2011 +0400
     2.2 +++ b/allpy/markups.py	Tue Jul 05 18:30:42 2011 +0400
     2.3 @@ -32,4 +32,15 @@
     2.4          for index, column in enumerate(self.alignment.columns):
     2.5              self[column] = index
     2.6  
     2.7 +class SequenceCaseMarkup(base.SequenceMarkup):
     2.8 +
     2.9 +    name = 'case'
    2.10 +
    2.11 +    def refresh(self):
    2.12 +        for monomer in self.sequence:
    2.13 +            if monomer.input_code1.isupper():
    2.14 +                monomer.case = 'upper'
    2.15 +            elif monomer.input_code1.islower():
    2.16 +                monomer.case = 'lower'
    2.17 +
    2.18  # vim: set ts=4 sts=4 sw=4 et: