File: validate-outputs.py

package info (click to toggle)
python-ihm 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,368 kB
  • sloc: python: 30,422; ansic: 5,990; sh: 24; makefile: 20
file content (33 lines) | stat: -rwxr-xr-x 976 bytes parent folder | download
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
#!/usr/bin/python3

"""Check the output of each example for validity against the PDBx
   and IHM dictionaries.

   This should be periodically rechecked in case the PDBx and IHM dictionaries
   are updated.
"""

import sys
import os
import subprocess
import ihm.dictionary
import urllib.request

with urllib.request.urlopen(
        'http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic') as fh:
    d_pdbx = ihm.dictionary.read(fh)
with urllib.request.urlopen(
        'http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_ihm.dic') as fh:
    d_ihm = ihm.dictionary.read(fh)
pdbx_ihm = d_pdbx + d_ihm

for script in ('simple-docking.py', 'ligands_water.py',
               'non_standard_residues.py'):
    print(script)
    subprocess.check_call([sys.executable, '../examples/' + script])
    with open('output.cif') as fh:
        try:
            pdbx_ihm.validate(fh)
        except ihm.dictionary.ValidatorError as exc:
            print(exc)
os.unlink('output.cif')