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

allpy

changeset 808:497de2152849

Moved SequencePdbResiMarkup to allpy.markups, since it is used frequently
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Thu, 14 Jul 2011 16:15:21 +0400
parents 3312472eb920
children b12d3f40a5cb
files allpy/markups.py utils/extract_pfam.py
diffstat 2 files changed, 30 insertions(+), 26 deletions(-) [+]
line diff
     1.1 --- a/allpy/markups.py	Thu Jul 14 14:44:58 2011 +0400
     1.2 +++ b/allpy/markups.py	Thu Jul 14 16:15:21 2011 +0400
     1.3 @@ -91,4 +91,33 @@
     1.4                  markup += monomer.code1.lower()
     1.5          return {'markup': "'%s'" % markup, 'io-class': 'SequenceCaseMarkup'}
     1.6  
     1.7 +class SequencePdbResiMarkup(base.SequenceMarkup, IntMarkupMixin):
     1.8 +    name = 'pdb_resi'
     1.9 +
    1.10 +    def from_pdb(self):
    1.11 +        for monomer in self.sequence:
    1.12 +            try:
    1.13 +                monomer.pdb_resi = monomer.pdb_residue.id[1]
    1.14 +            except Exception:
    1.15 +                pass
    1.16 +
    1.17 +    def add_pdb(self, download_pdb=None, xyz_only=False):
    1.18 +        import structure
    1.19 +        if download_pdb is None:
    1.20 +            download_pdb = structure.cached_download_pdb
    1.21 +
    1.22 +        match = structure.pdb_id_parse(self.sequence.name)
    1.23 +        code, model , chain = match['code'], match['model'], match['chain']
    1.24 +        pdb_file = download_pdb(code)
    1.25 +        pdb_structure = structure.get_structure(pdb_file, self.sequence.name)
    1.26 +        pdb_chain = pdb_structure[0][chain]
    1.27 +        if not xyz_only:
    1.28 +            self.sequence.pdb_chain = pdb_chain
    1.29 +        for monomer in self.sequence:
    1.30 +            if monomer in self:
    1.31 +                pdb_residue = pdb_chain[' ', monomer.pdb_resi, ' ']
    1.32 +                monomer.ca_xyz = pdb_residue['CA'].get_vector()
    1.33 +                if not xyz_only:
    1.34 +                    monomer.pdb_residue = pdb_residue
    1.35 +
    1.36  # vim: set ts=4 sts=4 sw=4 et:
     2.1 --- a/utils/extract_pfam.py	Thu Jul 14 14:44:58 2011 +0400
     2.2 +++ b/utils/extract_pfam.py	Thu Jul 14 16:15:21 2011 +0400
     2.3 @@ -55,31 +55,6 @@
     2.4  types.Monomer = Monomer
     2.5  Monomer._initialize([('.', False, '~~~', 'No monomer')])
     2.6  
     2.7 -class SequencePdbResiMarkup(base.SequenceMarkup, markups.IntMarkupMixin):
     2.8 -    name = 'pdb_resi'
     2.9 -
    2.10 -    def from_pdb(self):
    2.11 -        for monomer in self.sequence:
    2.12 -            try:
    2.13 -                monomer.pdb_resi = monomer.pdb_residue.id[1]
    2.14 -            except Exception:
    2.15 -                pass
    2.16 -
    2.17 -    def add_pdb(self, download_pdb=download_pdb, xyz_only=False):
    2.18 -        match = structure.pdb_id_parse(self.sequence.name)
    2.19 -        code, model , chain = match['code'], match['model'], match['chain']
    2.20 -        pdb_file = download_pdb(code)
    2.21 -        pdb_structure = structure.get_structure(pdb_file, self.sequence.name)
    2.22 -        pdb_chain = pdb_structure[0][chain]
    2.23 -        if not xyz_only:
    2.24 -            self.sequence.pdb_chain = pdb_chain
    2.25 -        for monomer in self.sequence:
    2.26 -            if monomer in self:
    2.27 -                pdb_residue = pdb_chain[' ', monomer.pdb_resi, ' ']
    2.28 -                monomer.ca_xyz = pdb_residue['CA'].get_vector()
    2.29 -                if not xyz_only:
    2.30 -                    monomer.pdb_residue = pdb_residue
    2.31 -
    2.32  re_range = re.compile(r'(-?\d+)-(-?\d+)')
    2.33  def parse_dbxref(dbxref):
    2.34      db, pdb_chain, range, null = (part.strip() for part in dbxref.split(";"))
    2.35 @@ -125,7 +100,7 @@
    2.36          print seq.name, seq.description
    2.37          print code.pdb_id
    2.38          raise AssertionError()
    2.39 -    SequencePdbResiMarkup(seq).from_pdb()
    2.40 +    markups.SequencePdbResiMarkup(seq).from_pdb()
    2.41  
    2.42  def remove_trailing_monomers(seq, columns):
    2.43      for column in columns: