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

allpy

changeset 816:d137df18a8bf

structure: create method superimpose of SequenceMixin Most of code of AlignmentMixin.superimpose was moved to SequenceMixin. Structures of sequences can be superimposed manually (in custom order, or with additions action such as loading/unloading of structure).
author boris (kodomo) <bnagaev@gmail.com>
date Fri, 15 Jul 2011 02:06:23 +0400
parents 2c0391cca127
children 835efa2a8c71
files allpy/structure.py
diffstat 1 files changed, 27 insertions(+), 19 deletions(-) [+]
line diff
     1.1 --- a/allpy/structure.py	Fri Jul 15 03:03:39 2011 +0400
     1.2 +++ b/allpy/structure.py	Fri Jul 15 02:06:23 2011 +0400
     1.3 @@ -232,6 +232,32 @@
     1.4          self.set_pdb_chain(pdb_file, code, chain, model, xyz_only=xyz_only,
     1.5              resi_begin=resi_begin, resi_end=resi_end)
     1.6  
     1.7 +    def superimpose(self, main_sequence, gc, extra_columns=False):
     1.8 +        """ Superimpose structure of this to main_sequence
     1.9 +
    1.10 +         * gc -- collection of columns to use as for superimposition
    1.11 +         * extra_columns -- allow columns with gaps or without structure
    1.12 +        """
    1.13 +        fixed_gc = []
    1.14 +        moving_gc = []
    1.15 +        for column in gc:
    1.16 +            if main_sequence in column and self in column:
    1.17 +                if hasattr(column[main_sequence], 'pdb_residue') \
    1.18 +                and hasattr(column[self], 'pdb_residue'):
    1.19 +                    fixed_gc.append(column[main_sequence].pdb_residue['CA'])
    1.20 +                    moving_gc.append(column[self].pdb_residue['CA'])
    1.21 +                else:
    1.22 +                    assert extra_columns
    1.23 +            else:
    1.24 +                assert extra_columns
    1.25 +        sup = Superimposer()
    1.26 +        sup.set_atoms(fixed_gc, moving_gc)
    1.27 +        moving = self.pdb_chain.get_atoms()
    1.28 +        sup.apply(moving)
    1.29 +        for monomer in self:
    1.30 +            if hasattr(monomer, 'pdb_residue'):
    1.31 +                monomer.ca_xyz = monomer.pdb_residue['CA'].get_vector()
    1.32 +
    1.33      def save_pdb(self, out_filename, new_chain=None, new_model=None):
    1.34          """ Save pdb_chain to out_file """
    1.35          chain = self.pdb_chain
    1.36 @@ -428,25 +454,7 @@
    1.37              sequences = copy(self.sequences)
    1.38              main_sequence = sequences.pop()
    1.39              for sequence in sequences:
    1.40 -                fixed_gc = []
    1.41 -                moving_gc = []
    1.42 -                for column in gc:
    1.43 -                    if main_sequence in column and sequence in column:
    1.44 -                        if hasattr(column[main_sequence], 'pdb_residue') \
    1.45 -                        and hasattr(column[sequence], 'pdb_residue'):
    1.46 -                            fixed_gc.append(column[main_sequence].pdb_residue['CA'])
    1.47 -                            moving_gc.append(column[sequence].pdb_residue['CA'])
    1.48 -                        else:
    1.49 -                            assert extra_columns
    1.50 -                    else:
    1.51 -                        assert extra_columns
    1.52 -                sup = Superimposer()
    1.53 -                sup.set_atoms(fixed_gc, moving_gc)
    1.54 -                moving = sequence.pdb_chain.get_atoms()
    1.55 -                sup.apply(moving)
    1.56 -                for monomer in sequence:
    1.57 -                    if hasattr(monomer, 'pdb_residue'):
    1.58 -                        monomer.ca_xyz = monomer.pdb_residue['CA'].get_vector()
    1.59 +                sequence.superimpose(main_sequence, gc, extra_columns=extra_columns)
    1.60  
    1.61      def save_pdb(self, out_file):
    1.62          """ Save all sequences