-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrdkit_process.py
More file actions
35 lines (33 loc) · 1.02 KB
/
Copy pathrdkit_process.py
File metadata and controls
35 lines (33 loc) · 1.02 KB
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
import rdkit
import rdkit.Chem
from rdkit import Chem
import rdkit.Chem.Descriptors
from rdkit.Chem.Descriptors import ExactMolWt,HeavyAtomMolWt
from clean_pdb import clean_pdb
import os
count=0
count_prot=0
f=open('exclude_structs.txt','w')
for dir in sorted(os.listdir('/scratch/rishal/v2019-other-PL')):
if len(dir)!=4:
continue
file=dir+'_protein.pdb'
mol = Chem.MolFromMolFile(
os.path.join('/scratch/rishal/v2019-other-PL', dir, file.replace('protein.pdb', 'ligand.sdf')), sanitize=False)
if mol is None:
f.write(dir + '\n')
count += 1
continue
mol_wt = HeavyAtomMolWt(mol)
if mol_wt > 1000:
f.write(dir + '\n')
count += 1
continue
try:
clean_pdb(os.path.join('/scratch/rishal/v2019-other-PL', dir, file),
os.path.join('/scratch/rishal/v2019-other-PL', dir, file.replace('protein', 'protein_nowat')))
except:
f.write(dir+'\n')
count+=1
continue
print(count)