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

allpy

changeset 1075:3c32489fcb3b

Hidded the misbehaved not-to-be-released-publically SequenceSecondaryStructureMarkup class into allpy.structure to postpone the problem of introducing the proper secondary structure markup to after the release while not breaking the added functionality of blocks3d; please note, this is a very dirty hack
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Fri, 25 May 2012 20:53:18 +0400
parents 87ba56d634cf
children 452ac0c16295
files allpy/markups.py allpy/structure.py
diffstat 2 files changed, 47 insertions(+), 46 deletions(-) [+]
line diff
     1.1 --- a/allpy/markups.py	Fri May 25 20:28:00 2012 +0400
     1.2 +++ b/allpy/markups.py	Fri May 25 20:53:18 2012 +0400
     1.3 @@ -1,8 +1,3 @@
     1.4 -import os
     1.5 -from tempfile import NamedTemporaryFile
     1.6 -
     1.7 -from Bio.PDB import DSSP
     1.8 -
     1.9  import base
    1.10  
    1.11  by_name = {}
    1.12 @@ -278,47 +273,6 @@
    1.13                  if not xyz_only:
    1.14                      monomer.pdb_residue = pdb_residue
    1.15  
    1.16 -class SequenceSecondaryStructureMarkup(base.SequenceMarkup, MarkupIOMixin):
    1.17 -    """ WARNING! WARNING! WARNING!
    1.18 -    This class will soon be eliminated and replaced with totally incompatible one.
    1.19 -    Only use on your own risk!
    1.20 -
    1.21 -    Secondary structure markup for sequence.
    1.22 -
    1.23 -    Depends on dsspcmbi program.
    1.24 -    Sequence should be structure.SequenceMixin, pdb should be loaded.
    1.25 -    Note that DSSP cannot handle mutiple models!
    1.26 -    Note that dssp executable name is hardcoded (=dsspcmbi).
    1.27 -    Note that new version of dssp can not be used, so use DSSPold.
    1.28 -
    1.29 -    Notation:
    1.30 -     * H -- alpha-helix
    1.31 -     * B -- Isolated beta-bridge residue
    1.32 -     * E -- Strand
    1.33 -     * G -- 3-10 helix
    1.34 -     * I -- pi-helix
    1.35 -     * T -- Turn
    1.36 -     * S -- Bend
    1.37 -     * - -- Other
    1.38 -    """
    1.39 -
    1.40 -    name = 'ss'
    1.41 -    io_class = 'SequenceSecondaryStructureMarkup'
    1.42 -
    1.43 -    def refresh(self):
    1.44 -        chain = self.sequence.pdb_chain
    1.45 -        model = chain.get_parent()
    1.46 -        pdb_file = NamedTemporaryFile(delete=False)
    1.47 -        self.sequence.save_pdb(pdb_file)
    1.48 -        pdb_file.close()
    1.49 -        dssp=DSSP(model, pdb_file.name, dssp='dsspcmbi')
    1.50 -        for monomer in self.sequence:
    1.51 -            try:
    1.52 -                monomer.ss = dssp[(chain.get_id(), monomer.pdb_residue.get_id())][1]
    1.53 -            except:
    1.54 -                monomer.ss = '?' # FIXME
    1.55 -        os.unlink(pdb_file.name)
    1.56 -
    1.57  # This MUST be the last statement in this module.
    1.58  update()
    1.59  
     2.1 --- a/allpy/structure.py	Fri May 25 20:28:00 2012 +0400
     2.2 +++ b/allpy/structure.py	Fri May 25 20:53:18 2012 +0400
     2.3 @@ -17,13 +17,17 @@
     2.4  from Bio.PDB import PDBParser
     2.5  from Bio.PDB import Select
     2.6  from Bio.PDB import Superimposer, CaPPBuilder, PDBIO
     2.7 +from Bio.PDB import DSSP
     2.8  
     2.9  import base
    2.10 +import markups
    2.11  import processors
    2.12  import config
    2.13  from graph import Graph
    2.14  from homology import MonomerHomology
    2.15  
    2.16 +from tempfile import NamedTemporaryFile
    2.17 +
    2.18  
    2.19  # for pdb-codes
    2.20  pdb_file_pattern = re.compile(r"^file:(?P<path>[^:]+)(:(?P<chain>[0-9a-z ])(:(?P<model>[0-9]{1,3})(:(?P<resi_begin>-?\d+)(:(?P<resi_end>-?\d+))?)?)?)?", re.I)
    2.21 @@ -871,4 +875,47 @@
    2.22                      result.append(column[sequence])
    2.23          return result
    2.24  
    2.25 +class _SequenceSecondaryStructureMarkup(base.SequenceMarkup):
    2.26 +    """ WARNING! WARNING! WARNING!
    2.27 +    This class will soon be eliminated and replaced with totally incompatible one.
    2.28 +    Only use on your own risk!
    2.29 +
    2.30 +    Secondary structure markup for sequence.
    2.31 +
    2.32 +    Depends on dsspcmbi program.
    2.33 +    Sequence should be structure.SequenceMixin, pdb should be loaded.
    2.34 +    Note that DSSP cannot handle mutiple models!
    2.35 +    Note that dssp executable name is hardcoded (=dsspcmbi).
    2.36 +    Note that new version of dssp can not be used, so use DSSPold.
    2.37 +
    2.38 +    Notation:
    2.39 +     * H -- alpha-helix
    2.40 +     * B -- Isolated beta-bridge residue
    2.41 +     * E -- Strand
    2.42 +     * G -- 3-10 helix
    2.43 +     * I -- pi-helix
    2.44 +     * T -- Turn
    2.45 +     * S -- Bend
    2.46 +     * - -- Other
    2.47 +    """
    2.48 +
    2.49 +    name = 'ss'
    2.50 +    io_class = 'SequenceSecondaryStructureMarkup'
    2.51 +
    2.52 +    def refresh(self):
    2.53 +        chain = self.sequence.pdb_chain
    2.54 +        model = chain.get_parent()
    2.55 +        pdb_file = NamedTemporaryFile(delete=False)
    2.56 +        self.sequence.save_pdb(pdb_file)
    2.57 +        pdb_file.close()
    2.58 +        dssp=DSSP(model, pdb_file.name, dssp='dsspcmbi')
    2.59 +        for monomer in self.sequence:
    2.60 +            try:
    2.61 +                monomer.ss = dssp[(chain.get_id(), monomer.pdb_residue.get_id())][1]
    2.62 +            except:
    2.63 +                monomer.ss = '?' # FIXME
    2.64 +        os.unlink(pdb_file.name)
    2.65 +markups.SequenceSecondaryStructureMarkup = _SequenceSecondaryStructureMarkup
    2.66 +markups.update()
    2.67 +
    2.68  # vim: set ts=4 sts=4 sw=4 et: