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

allpy

changeset 481:b92cad794578

allpy/structure: remove Sequence.pdb_residues, add Monomer.pdb_residue Information from aequence.pdb_residues[monomer] is now available in monomer.pdb_residue
author boris (netbook) <bnagaev@gmail.com>
date Fri, 18 Feb 2011 18:48:37 +0300
parents 8aa9b2c69e74
children de1d0a17e090
files allpy/structure.py geometrical_core/geometrical-core
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/allpy/structure.py	Fri Feb 18 16:23:54 2011 +0300
     1.2 +++ b/allpy/structure.py	Fri Feb 18 18:48:37 2011 +0300
     1.3 @@ -52,8 +52,8 @@
     1.4      Attributes:
     1.5  
     1.6      *   pdb_chain -- Bio.PDB.Chain
     1.7 -    *   pdb_residues -- {Monomer: Bio.PDB.Residue}
     1.8 -        For missing residues there is no key.
     1.9 +
    1.10 +    Monomers from this sequence get attribute "pdb_residue"
    1.11  
    1.12      ?TODO: global pdb_structures
    1.13      """
    1.14 @@ -66,7 +66,6 @@
    1.15          structure = get_structure(pdb_file, self.name)
    1.16          chain = structure[pdb_model][pdb_chain]
    1.17          self.pdb_chain = chain
    1.18 -        self.pdb_residues = {}
    1.19          pdb_sequence = self.__class__.from_pdb_chain(chain)
    1.20          Alignment = self.types.Alignment
    1.21          a = Alignment()
    1.22 @@ -75,15 +74,16 @@
    1.23          a.process(processors.Muscle())
    1.24          for monomer, pdb_monomer in a.columns_as_lists():
    1.25              try:
    1.26 -                residue = pdb_sequence.pdb_residues[pdb_monomer]
    1.27 -                self.pdb_residues[monomer] = residue
    1.28 +                monomer.pdb_residue = pdb_monomer.pdb_residue
    1.29              except:
    1.30                  pass # gap in pdb_sequence
    1.31  
    1.32      def pdb_unload(self):
    1.33          """ Delete all pdb-connected links """
    1.34          del self.pdb_chain
    1.35 -        del self.pdb_residues
    1.36 +        for monomer in self:
    1.37 +            if hasattr(monomer, 'pdb_residue'):
    1.38 +                delattr(monomer, 'pdb_residue')
    1.39  
    1.40      @classmethod
    1.41      def from_pdb_chain(cls, chain):
    1.42 @@ -97,12 +97,11 @@
    1.43          Monomer = Sequence.types.Monomer
    1.44          sequence = Sequence()
    1.45          sequence.pdb_chain = chain
    1.46 -        sequence.pdb_residues = {}
    1.47          for peptide in peptides:
    1.48              for ca_atom in peptide.get_ca_list():
    1.49                  residue = ca_atom.get_parent()
    1.50                  monomer = Monomer.from_code3(residue.get_resname())
    1.51 -                sequence.pdb_residues[monomer] = residue
    1.52 +                monomer.pdb_residue = residue
    1.53                  sequence.append(monomer)
    1.54          return sequence
    1.55  
    1.56 @@ -158,6 +157,7 @@
    1.57          self.pdb_chain.id = old_chain
    1.58          model.id = old_model
    1.59  
    1.60 +
    1.61  class AlignmentMixin(base.Alignment):
    1.62      """Mixin to add 3D properties to alignments.
    1.63  
    1.64 @@ -212,8 +212,8 @@
    1.65                          if sequence in column1 and sequence in column2:
    1.66                              m1 = column1[sequence]
    1.67                              m2 = column2[sequence]
    1.68 -                            r1 = sequence.pdb_residues[m1]
    1.69 -                            r2 = sequence.pdb_residues[m2]
    1.70 +                            r1 = m1.pdb_residue
    1.71 +                            r2 = m2.pdb_residue
    1.72                              ca1 = r1['CA']
    1.73                              ca2 = r2['CA']
    1.74                              d = ca1 - ca2 # Bio.PDB feature
    1.75 @@ -242,10 +242,10 @@
    1.76          if len(self.sequences) >= 1:
    1.77              sequences = copy(self.sequences)
    1.78              main_sequence = sequences.pop()
    1.79 -            fixed_gc = [main_sequence.pdb_residues[column[main_sequence]]['CA'] \
    1.80 +            fixed_gc = [column[main_sequence].pdb_residue['CA'] \
    1.81                  for column in gc]
    1.82              for sequence in sequences:
    1.83 -                moving_gc = [sequence.pdb_residues[column[sequence]]['CA'] \
    1.84 +                moving_gc = [column[sequence].pdb_residue['CA'] \
    1.85                      for column in gc]
    1.86                  sup = Superimposer()
    1.87                  sup.set_atoms(fixed_gc, moving_gc)
     2.1 --- a/geometrical_core/geometrical-core	Fri Feb 18 16:23:54 2011 +0300
     2.2 +++ b/geometrical_core/geometrical-core	Fri Feb 18 18:48:37 2011 +0300
     2.3 @@ -192,7 +192,7 @@
     2.4                  gc_n = []
     2.5                  for column in gc:
     2.6                      monomer = column[sequence]
     2.7 -                    residue = sequence.pdb_residues[monomer]
     2.8 +                    residue = monomer.pdb_residue
     2.9                      hetero_flag, n, insertion = residue.id
    2.10                      gc_n.append(n)
    2.11                  gc_n.sort()