Source code for schrodinger.application.desmond.starter.ui.bpfep
"""
Binding-pose FEP command line UI
Copyright Schrodinger, LLC. All rights reserved.
"""
import argparse
import sys
from typing import List
from schrodinger.application.desmond import util
from schrodinger.structutils.analyze import validate_asl
from . import cmdline
from .cmdline import Option
[docs]class Args(cmdline.BaseArgs):
[docs] def __init__(self, opt: argparse.Namespace):
self.copy_parser_attributes(opt)
if not self.mut_ligand_asl:
self.mut_ligand_asl = self.ligand_asl
super(Args, self).__init__(opt)
[docs] def validate(self):
if self.RESTART:
if len(self.inp_file):
sys.exit("ERROR: No positional arguments for a restart job.")
return
if 2 != len(self.inp_file):
sys.exit("ERROR: Two MAE files are expected for a new job.")
util.ensure_file_exists(self.inp_file[0])
util.ensure_file_exists(self.inp_file[1])
if not validate_asl(self.ligand_asl):
sys.exit("ERROR: Invalid ASL expression for -ligand-asl: %s" %
self.ligand_asl)
if self.mut_ligand_asl and not validate_asl(self.mut_ligand_asl):
sys.exit("ERROR: Invalid ASL expression for -mut-ligand-asl: %s" %
self.mut_ligand_asl)
if not validate_asl(self.receptor_asl):
sys.exit("ERROR: Invalid ASL expression for -receptor-asl: %s" %
self.receptor_asl)
super().validate()
[docs]def ui(argv: List[str]) -> Args:
usage = """
Binding-pose FEP driver (experimental)
Report issues to Desmond.
* Run a new job:
$SCHRODINGER/fep_binding_pose -HOST <compute-host> -JOBNAME <jobname> -ligand-asl <ASL> <ref-complex>.mae <mut-complex>.mae
* Restart a previously interrupted job:
$SCHRODINGER/fep_binding_pose -HOST <compute-host> -JOBNAME <jobname> -RESTART -checkpoint <multisim-checkpoint-file>
Note that the following options have no effects for a restart job:
-ligand-asl, -mut-ligand-asl, -receptor-asl
* Prepare input files for multisim. Do NOT run job:
$SCHRODINGER/fep_binding_pose -HOST <compute-host> -JOBNAME <jobname> -ligand-asl <ASL> <ref-complex>.mae <mut-complex>.mae -prepare
"""
options = cmdline.get_common_options()
options.extend([
Option(
"inp_file", None, "Two MAE files: The first is the reference "
"complex structure, the second the mutant complex structure. Each "
"file should contain exactly ONE CT block. This argument is "
"required for a from-scratch new job, but should NOT be set for a "
"restart job.", {
"metavar": "<ref-complex>.mae <mut-complex>.mae",
"nargs": "*"
}),
Option(
"-ligand-asl", "",
"ASL expression to specify the alchemical part of the ligand "
"molecule in both complex structures. The selected atoms will be "
"excluded from the atom mapping. If the alchemical part is "
"different between the reference and the mutant ligands, use this "
"option to specify only for the reference, and the -mut-ligand-asl "
"option only for the mutant. This option is required for a "
"from-scratch new job."),
Option(
"-mut-ligand-asl", "",
"ASL expression to specify the alchemical part of the ligand "
"molecule in the mutant complex structure. The selected atoms will "
"be excluded from the atom mapping. Use this option ONLY when the "
"alchemical part is different between the reference and the mutant "
"ligands."),
Option(
"-receptor-asl", "not all",
"ASL expression to specify the alchemical part of the receptor in "
"both complex structures. The selected atoms will be excluded from "
"the atom mapping. Default: All receptor atoms will be mapped."),
])
cmdline.suppress_options(
options,
{"-ppj", "-seed", "-skip_traj", "-buffer", "-ffbuilder", '-ff-host'})
opt = cmdline.parse_options(usage, options, argv[1:], add_subhost=False)
return Args(opt)