Skip to content

Instantly share code, notes, and snippets.

@sverhoeven
Created January 10, 2018 16:15
Show Gist options
  • Save sverhoeven/1fdb27c2d0418895101a3eba3274461d to your computer and use it in GitHub Desktop.
Save sverhoeven/1fdb27c2d0418895101a3eba3274461d to your computer and use it in GitHub Desktop.
"""Script to swap donor/acceptor in pharmacophore database file
original enum is
Enum({'LIPO': 0, 'POSC': 1, 'HACC': 4, 'NEGC': 2, 'AROM': 5, 'HDON': 3})
corrected enum is
Enum({'LIPO': 0, 'POSC': 1, 'HACC': 3, 'NEGC': 2, 'AROM': 5, 'HDON': 4})
"""
import sys
from kripodb.pharmacophores import PharmacophoresDb
orig_fn = sys.argv[1]
swapped_fn = sys.argv[2]
with PharmacophoresDb(orig_fn) as orig:
with PharmacophoresDb(swapped_fn, 'w', expectedrows=len(orig.points)) as swapped:
row = swapped.points.table.row
for orig_row in orig.points.table.iterrows():
row['frag_id'] = orig_row['frag_id']
row['x'] = orig_row['x']
row['y'] = orig_row['y']
row['z'] = orig_row['z']
row['type'] = orig_row['type']
row.append()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment