File: PDBExportFilters.py

package info (click to toggle)
python-scientific 2.8-1.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 6,456 kB
  • ctags: 7,038
  • sloc: python: 16,436; ansic: 4,379; makefile: 135; sh: 18; csh: 1
file content (39 lines) | stat: -rw-r--r-- 837 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Export filters for PDB output.
#

#
# A convenient base class...
#
class PDBExportFilter:

    def processLine(self, type, data):
        return type, data

    def processResidue(self, name, number, terminus):
        return name, number

    def processChain(self, chain_id, segment_id):
        return chain_id, segment_id

    def terminateChain(self):
        pass

#
# XPlor export filter

import string

class XPlorExportFilter(PDBExportFilter):

    xplor_atom_names = {' OXT': 'OT2'}

    def processLine(self, type, data):
        if type == 'TER':
            return None, data
        if type == 'ATOM' or type == 'HETATM' or type == 'ANISOU':
            name = self.xplor_atom_names.get(data['name'], data['name'])
            data['name'] = name
        return type, data


export_filters = {'xplor': XPlorExportFilter}