allpy
diff allpy/base.py @ 273:bda87d4c525e
Converted base.Sequence.from_string to conform with new design
author | Daniil Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Wed, 15 Dec 2010 18:58:54 +0300 |
parents | 4e6e85851133 |
children | 9ea5099309b8 |
line diff
1.1 --- a/allpy/base.py Wed Dec 15 18:40:38 2010 +0300 1.2 +++ b/allpy/base.py Wed Dec 15 18:58:54 2010 +0300 1.3 @@ -214,14 +214,12 @@ 1.4 self.pdb_secstr = {} # FIXME 1.5 self.pdb_files = {} # FIXME 1.6 1.7 - @staticmethod 1.8 - def from_str(fasta_str, name='', description='', monomer_kind=AminoAcidType): 1.9 - """ Import data from one-letter code 1.10 - 1.11 - monomer_kind is class, inherited from MonomerType 1.12 - """ 1.13 - monomers = [monomer_kind.from_code1(aa).instance() for aa in fasta_str] 1.14 - return Sequence(monomers, name, description) 1.15 + @classmethod 1.16 + def from_string(cls, string, name='', description=''): 1.17 + """Create sequences from string of one-letter codes.""" 1.18 + monomer = cls.monomer_type.from_code1 1.19 + monomers = [monomer(letter) for letter in string] 1.20 + return cls(monomers, name, description) 1.21 1.22 @staticmethod 1.23 def from_pdb_chain(chain):