File: validate-outputs.py

package info (click to toggle)
python-modelcif 1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 688 kB
  • sloc: python: 6,746; makefile: 14; sh: 6
file content (28 lines) | stat: -rwxr-xr-x 766 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
#!/usr/bin/python3

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

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

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

with urllib.request.urlopen(
        'https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_ma.dic') as fh:
    pdbx_mcif = ihm.dictionary.read(fh)

for script in ('mkmodbase.py', 'ligands.py'):
    print(script)
    subprocess.check_call([sys.executable, '../examples/' + script])
    with open('output.cif') as fh:
        try:
            pdbx_mcif.validate(fh)
        except ihm.dictionary.ValidatorError as exc:
            print(exc)
os.unlink('output.cif')