Skip to content

Commit

Permalink
Using the clue that the coordinates are perfectly overlapped.
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniekmateusz committed Jul 2, 2023
1 parent 1fb634f commit 7faa5d9
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 256 deletions.
16 changes: 11 additions & 5 deletions ties/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ def command_line_script():
'If more than 2 ligands are provided, '
'Lead Optimisation Mapping (TIES MAP) will be used.')
parser.add_argument('-dir', '--ties-output-dir', metavar='directory', dest='workdir',
type=pathlib.Path, required=False,
help='If not provided, "ties20" directory will be created in the current directory. ')
type=pathlib.Path, required=False, default="ties",
help='The destination directory for the output. Default: "ties".')
parser.add_argument('-nc', '--ligand-net-charge', metavar='integer', dest='ligand_net_charge',
type=int, required=False,
help='An integer representing the net charge of each ligand. '
'All ligands must have the same charge.')
'All ligands must have the same charge. Default: 0.1e.')
parser.add_argument('-p', '--protein', metavar='file', dest='protein',
type=ArgparseChecker.existing_file, required=False,
help='The protein file')
help='The protein file. Not necessary. ')
parser.add_argument('-qtol', '--q-pair-tolerance', metavar='decimal', dest='atom_pair_q_atol',
type=float, required=False, default=0.1,
type=float, required=False,
help='The maximum difference in charge between any two paired atoms (electron unit). '
'Default 0.1e')
parser.add_argument('-netqtol', '--q-net-tolerance', metavar='decimal', dest='net_charge_threshold',
Expand Down Expand Up @@ -133,6 +133,12 @@ def command_line_script():
parser.add_argument('-elements', '--compare-elements', metavar='boolean', dest='use_element',
type=ArgparseChecker.str2bool, required=False, default=False,
help='Ignore the specific atom types in the superimposition. Use only the elements. ')
parser.add_argument('-weights', '--mcs-rmsd-weights', metavar='str', dest='weights_ratio',
type=ArgparseChecker.ratio, required=False,
help='The weights for the weighted sum of 1) MCS overlap size to 2) RMSD '
'when coordinates are used for selection of the best structure. '
'Default it is "1:1" for "MCS:RMSD". '
'MCS is defined (1 - MCS fraction), so lower value is better.')

# initialise the config class
args = parser.parse_args()
Expand Down
9 changes: 7 additions & 2 deletions ties/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, **kwargs):
# use only the element in the superimposition rather than the specific atom type
self._use_element = False
self._use_element_in_superimposition = True
# weights in choosing the best MCS, the weighted sum of "(1 - MCS fraction) and RMSD".
self.weights = [1, 0.5]

# coordinates
self._align_molecules_using_mcs = False
Expand Down Expand Up @@ -82,8 +84,7 @@ def __init__(self, **kwargs):
self.uses_cmd = False

# assign all the initial configuration values
for key, value in kwargs.items():
setattr(self, key, value)
self.set_configs(**kwargs)

@property
def workdir(self):
Expand Down Expand Up @@ -897,4 +898,8 @@ def get_serializable(self):
def set_configs(self, **kwargs):
# set all the configs one by one
for k,v in kwargs.items():
# skip None values, these come from the command line
if v is None:
continue

setattr(self, k, v)
7 changes: 7 additions & 0 deletions ties/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ def str2bool(v):
else:
raise argparse.ArgumentTypeError('Boolean value expected.')

@staticmethod
def ratio(v):
if ':' not in v:
argparse.ArgumentTypeError('The ratio has to be separated by ":".')
mcs, rmsd = v.split(':')
return [float(mcs), float(rmsd)]

@staticmethod
def existing_file(v):
# check ligand arguments
Expand Down
4 changes: 2 additions & 2 deletions ties/pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def superimpose(self, **kwargs):
force_mismatch=new_mismatch_names,
starting_node_pairs=starting_node_pairs,
parmed_ligA=parmed_ligA, parmed_ligZ=parmed_ligZ,
starting_pair_seed=self.config.superimposition_starting_pair)
starting_pair_seed=self.config.superimposition_starting_pair,
config=self.config)

assert len(suptops) == 1
self.set_suptop(suptops[0], parmed_ligA, parmed_ligZ)
# attach the used config to the suptop
suptops[0].config = self.config
Expand Down
Loading

0 comments on commit 7faa5d9

Please sign in to comment.