Skip to content

Commit 4395c83

Browse files
authored
Update generate_counterexample_typeslines.py
Added the ability to change the ranges of what is considered a "good pose" and a "bad pose". Before the script only labeled good poses as <2 RMSD, and all other poses as bad. Now you can set the good pose threshold with --good_pose_thresh, and set the bad pose threshold with --bad_pose_thresh. This means poses <good_pose_thresh are labelled with 1, poses >=bad_pose_thresh are labelled with 0, and poses with RMSD between good_pose_thresh and bad_pose_thresh are discarded.
1 parent 7b91c02 commit 4395c83

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: generate_counterexample_typeslines.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def run_obrms(ligand_file,crystal_file):
9090
rmsds=[float(x.split()[-1]) for x in rmsds]
9191
return rmsds
9292

93-
def get_lines_towrite(crystal_lookup,list_of_docked,affinity_lookup,crystal_suffix):
93+
def get_lines_towrite(crystal_lookup,list_of_docked,affinity_lookup,crystal_suffix,good_pose_thresh,bad_pose_thresh):
9494
'''
9595
This function will calculate the RMSD of every input pose, to the provided crystal pose.
9696
@@ -110,12 +110,15 @@ def get_lines_towrite(crystal_lookup,list_of_docked,affinity_lookup,crystal_suff
110110
counter=0
111111
lines[docked]=[]
112112
for r in rmsds:
113-
if r < 2:
113+
if r < good_pose_thresh:
114114
label='1'
115115
neg_aff=''
116-
else:
116+
elif r >= bad_pose_thresh:
117117
label='0'
118118
neg_aff='-'
119+
else:
120+
#if the pose is in (good_pose_thesh, bad_pose_thresh) it will be skipped
121+
continue
119122

120123
rec_gninatypes=docked.split('rec')[0]+'rec_0.gninatypes'
121124
lig_gninatypes=docked.replace('.sdf','_'+str(counter)+'.gninatypes')
@@ -144,6 +147,8 @@ def run_obrms_cross(filename):
144147
parser.add_argument('--unique_threshold',default=0.25,help='RMSD threshold for unique poses. IE poses with RMSD > thresh are considered unique. Defaults to 0.25.')
145148
parser.add_argument('--lower_confusing_threshold',default=0.5,help='CNNscore threshold for identifying confusing good poses. Score < thresh & under 2RMSD is kept and labelled 1. 0<thresh<1. Default 0.5')
146149
parser.add_argument('--upper_confusing_threshold',default=0.9,help='CNNscore threshold for identifying confusing poor poses. If CNNscore > thresh & over 2RMSD pose is kept and labelled 0. lower<thresh<1. Default 0.9')
150+
parser.add_argument('--good_pose_thresh',default=2.0,help='RMSD threshold to identify a good pose. If ligand RMSD to crystal < this value, the pose is labeled good. Defaults to 2.0')
151+
parser.add_argument('--bad_pose_thresh',default=2.0,help='RMSD threshold to identify a bad pose. If the ligand RMSD to crystal >= this value, the pose is labelled as bad. Defaults to 2.0')
147152
parser.add_argument('-o','--outname',type=str,required=True,help='Name of the text file to write the new lines in. DO NOT WRITE THE FULL PATH!')
148153
parser.add_argument('-a','--affinity_lookup',default='pdbbind2017_affs.txt',help='File mapping the PDBid and ligname of the ligand to its pK value. Assmes space delimited "PDBid ligname pK". Defaults to pdbbind2017_affs.txt')
149154
args=parser.parse_args()
@@ -185,7 +190,7 @@ def run_obrms_cross(filename):
185190
os.remove(sdf_name)
186191

187192
#1) Figure out ALL of the lines to write
188-
line_dic=get_lines_towrite(crystal_lookup=docked_to_crystal_lookup,list_of_docked=list_o_ligs,affinity_lookup=affinity_lookup,crystal_suffix=args.crystal_suffix)
193+
line_dic=get_lines_towrite(crystal_lookup=docked_to_crystal_lookup,list_of_docked=list_o_ligs,affinity_lookup=affinity_lookup,crystal_suffix=args.crystal_suffix, good_pose_thresh=args.good_pose_thresh, bad_pose_thresh=args.pad_pose_thresh)
189194

190195
#2) Set up the 'working sdf' for the obrms -x calculations, consisting of the confusing examples + any possible previously generated examples
191196
# i) iterate over the possible lines for this ligand, keep only the confusing ones,

0 commit comments

Comments
 (0)