allpy
changeset 235:346a6cd4fc1d
allpy: start moving to new class interfaces
author | boris (netbook) <bnagaev@gmail.com> |
---|---|
date | Tue, 30 Nov 2010 17:10:25 +0300 |
parents | 866af8d04b7f |
children | 4f3d6b0af90b |
files | allpy/alignment.py allpy/monomer.py allpy/sequence.py |
diffstat | 3 files changed, 17 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/allpy/alignment.py Sun Nov 28 17:40:11 2010 +0300 1.2 +++ b/allpy/alignment.py Tue Nov 30 17:10:25 2010 +0300 1.3 @@ -15,17 +15,13 @@ 1.4 import block 1.5 from fasta import save_fasta 1.6 1.7 -class Alignment(object): 1.8 +class Alignment(dict): 1.9 """ Alignment 1.10 1.11 - Mandatory data: 1.12 - * body -- dict 1.13 {<Sequence object>:[<Monomer object>,None,<Monomer object>]} 1.14 keys are the Sequence objects, values are the lists, which 1.15 contain monomers of those sequences or None for gaps in the 1.16 - corresponding sequence of 1.17 - alignment 1.18 - 1.19 + corresponding sequence of alignment 1.20 """ 1.21 # _sequences -- list of Sequence objects. Sequences don't contain gaps 1.22 # - see sequence.py module
2.1 --- a/allpy/monomer.py Sun Nov 28 17:40:11 2010 +0300 2.2 +++ b/allpy/monomer.py Tue Nov 30 17:10:25 2010 +0300 2.3 @@ -89,10 +89,14 @@ 2.4 """ Amino acid """ 2.5 pass 2.6 2.7 -class DNA(Monomer): 2.8 +class DNABase(Monomer): 2.9 """ Deoxyribonucleic acid """ 2.10 pass 2.11 2.12 +class RNABase(Monomer): 2.13 + """ Ribonucleic acid """ 2.14 + pass 2.15 + 2.16 # prepare all aminoacids 2.17 2.18 for code3, data in AAdict.items():
3.1 --- a/allpy/sequence.py Sun Nov 28 17:40:11 2010 +0300 3.2 +++ b/allpy/sequence.py Tue Nov 30 17:10:25 2010 +0300 3.3 @@ -14,15 +14,17 @@ 3.4 import os 3.5 3.6 3.7 -class Sequence(object): 3.8 +class Sequence(list): 3.9 """ Sequence of Monomers 3.10 + 3.11 + list of monomer objects (aminoacids or nucleotides) 3.12 3.13 Mandatory data: 3.14 * name -- str with the name of sequence 3.15 * description -- str with description of the sequence 3.16 - * monomers -- list of monomer objects (aminoacids or nucleotides) 3.17 3.18 Optional (may be empty): 3.19 + * source -- source of sequence 3.20 * pdb_chains -- list of Bio.PDB.Chain's 3.21 * pdb_files -- dictionary like {Bio.PDB.Chain: file_obj} 3.22 3.23 @@ -212,3 +214,9 @@ 3.24 n = len(line) 3.25 s += line[(n_from - number_user):(n_to - number_user)] 3.26 return Sequence.from_str(s, name, description, monomer_kind) 3.27 + 3.28 +class ProteinSequence(Sequence): 3.29 + """ """ 3.30 + pass 3.31 + 3.32 +