File: PDBChecker.py

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 239,924 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (48 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (8)
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
40
41
42
43
44
45
46
47
48
# Lara Schneider 2010-04-22

import sys
from BALL import *

#print a usage message, if called with the wrong number
#of arguments
if (len(sys.argv) != 2):
  print sys.argv[0], " <pdbfile>"
  print "  checks the PDB file for consistency."
  exit()

#create a System and read the contents of the PDB file
S = System()
pdb_file = PDBFile(sys.argv[1])
if (not pdb_file):
  print "cannot open file ", argv[1]
  exit()
pdb_file.read(S)
pdb_file.close()

#create a fragment database
#The fragment database contains information on
#all amino acids: structure, names, bond distances, and so on.
db = FragmentDB("")

#normalize the names
#This processor converts the atom names from several naming
#conventions to the standard PDB names
S.apply(db.normalize_names)

#build bonds
#Since PDB files normally do not contain bond information
#we have to reconstruct the bonds from the templates in
# the fragment database
S.apply(db.build_bonds)
	
#now we create a ResidueChecker object and apply it
#This object checks all residues it is given and 
#prints warnings to Log if 
#  - bond distances deviate from their usual values
#  - non integral charges of a residues (does not apply here)
#  - missing or superfluous atoms in a residue
check = ResidueChecker(db)
S.apply(check)

#done.
print "done."