Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lig_extents.append(np.array([float(x) for x in coord[-num_anm_lig:]]))
raw_data = line[last+1:].split()
receptor_id = int(raw_data[0])
ligand_id = int(raw_data[1])
receptor_ids.append(receptor_id)
ligand_ids.append(ligand_id)
log.info("Read %s coordinate lines" % counter)
return translations, rotations, receptor_ids, ligand_ids, rec_extents, lig_extents
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="conformer_conformations")
# Receptor
parser.add_argument("receptor_structures", help="receptor structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="receptor_structure")
# Ligand
parser.add_argument("ligand_structures", help="ligand structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="ligand_structure")
# Lightdock output file
parser.add_argument("lightdock_output", help="lightdock output file",
type=CommandLineParser.valid_file, metavar="lightdock_output")
# Number of glowworms
parser.add_argument("glowworms", help="number of glowworms", type=CommandLineParser.valid_integer_number)
# Optional, setup file
parser.add_argument("--setup", "-setup", "-s", help="Simulation setup file",
dest="setup_file", metavar="setup_file", type=CommandLineParser.valid_file,
default=None)
args = parser.parse_args()
# Load setup configuration if provided
import traceback
py_version = float(platform.python_version()[:3])
if py_version < 2.7:
raise SystemExit("lightdock [ERROR] required Python version is 2.7.x")
from lightdock.util.logger import LoggingManager
from lightdock.util.parser import CommandLineParser
log = LoggingManager.get_logger('lightdock')
if __name__ == "__main__":
try:
parser = CommandLineParser()
mpi_support = parser.args.mpi
if mpi_support:
from docking_mpi import run_simulation as mpi_simulation
mpi_simulation(parser)
else:
from docking_multiprocessing import run_simulation as multiprocessing_simulation
multiprocessing_simulation(parser)
except Exception, e:
log.error("Lightdock has failed, please check traceback:")
traceback.print_exc()
log.info("Read %s coordinate lines" % counter)
return translations, rotations, receptor_ids, ligand_ids, rec_extents, lig_extents
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="conformer_conformations")
# Receptor
parser.add_argument("receptor_structures", help="receptor structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="receptor_structure")
# Ligand
parser.add_argument("ligand_structures", help="ligand structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="ligand_structure")
# Lightdock output file
parser.add_argument("lightdock_output", help="lightdock output file",
type=CommandLineParser.valid_file, metavar="lightdock_output")
# Number of glowworms
parser.add_argument("glowworms", help="number of glowworms", type=CommandLineParser.valid_integer_number)
# Optional, setup file
parser.add_argument("--setup", "-setup", "-s", help="Simulation setup file",
dest="setup_file", metavar="setup_file", type=CommandLineParser.valid_file,
default=None)
args = parser.parse_args()
# Load setup configuration if provided
setup = get_setup_from_file(args.setup_file) if args.setup_file else None
num_anm_rec = DEFAULT_NMODES_REC
num_anm_lig = DEFAULT_NMODES_LIG
if setup and setup['use_anm']:
num_anm_rec = setup['anm_rec']
def run_simulation(parser):
"""Main program"""
try:
parser = CommandLineParser()
args = parser.args
# Read setup and add it to the actual args object
setup = get_setup_from_file(args.setup_file)
for k, v in setup.iteritems():
setattr(args, k, v)
info_file = create_simulation_info_file(args)
log.info("simulation parameters saved to %s" % info_file)
# Read input structures (use parsed ones)
parsed_lightdock_receptor = os.path.join(os.path.dirname(args.receptor_pdb),
DEFAULT_LIGHTDOCK_PREFIX % os.path.basename(args.receptor_pdb))
receptor = read_input_structure(parsed_lightdock_receptor, args.noxt, args.noh, args.verbose_parser)
parsed_lightdock_ligand = os.path.join(os.path.dirname(args.ligand_pdb),
DEFAULT_LIGHTDOCK_PREFIX % os.path.basename(args.ligand_pdb))
from lightdock.pdbutil.PDBIO import parse_complex_from_file, write_pdb_to_file
from lightdock.structure.complex import Complex
from lightdock.structure.nm import read_nmodes
from lightdock.util.parser import CommandLineParser, get_lightdock_structures
from lightdock.prep.simulation import get_setup_from_file
log = LoggingManager.get_logger('lightdock_top')
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="conformer_conformations")
# Receptor
parser.add_argument("receptor_structures", help="receptor structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="receptor_structure")
# Ligand
parser.add_argument("ligand_structures", help="ligand structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="ligand_structure")
# Ranking file
parser.add_argument("lightdock_ranking_file", help="LightDock ranking file",
type=CommandLineParser.valid_file, metavar="lightdock_ranking_file")
# Number of structures to generate
parser.add_argument("top", help="number of structures to generate", type=CommandLineParser.valid_integer_number,
metavar="top")
# Optional, setup file
parser.add_argument("--setup", "-setup", "-s", help="Simulation setup file",
dest="setup_file", metavar="setup_file", type=CommandLineParser.valid_file,
default=None)
args = parser.parse_args()
from lightdock.util.parser import CommandLineParser, get_lightdock_structures
from lightdock.prep.simulation import get_setup_from_file
log = LoggingManager.get_logger('lightdock_top')
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="conformer_conformations")
# Receptor
parser.add_argument("receptor_structures", help="receptor structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="receptor_structure")
# Ligand
parser.add_argument("ligand_structures", help="ligand structures: PDB file or list of PDB files",
type=CommandLineParser.valid_file, metavar="ligand_structure")
# Ranking file
parser.add_argument("lightdock_ranking_file", help="LightDock ranking file",
type=CommandLineParser.valid_file, metavar="lightdock_ranking_file")
# Number of structures to generate
parser.add_argument("top", help="number of structures to generate", type=CommandLineParser.valid_integer_number,
metavar="top")
# Optional, setup file
parser.add_argument("--setup", "-setup", "-s", help="Simulation setup file",
dest="setup_file", metavar="setup_file", type=CommandLineParser.valid_file,
default=None)
args = parser.parse_args()
# Load setup configuration if provided
setup = get_setup_from_file(args.setup_file) if args.setup_file else None
def run_simulation(parser):
"""Main program, includes MPI directives"""
try:
comm = MPI.COMM_WORLD
parser = CommandLineParser()
args = parser.args
# Read setup and add it to the actual args object
setup = get_setup_from_file(args.setup_file)
for k, v in setup.iteritems():
setattr(args, k, v)
minion_id = comm.rank
if minion_id == 0:
info_file = create_simulation_info_file(args)
log.info("simulation parameters saved to %s" % info_file)
comm.Barrier()
# Read input structures (use parsed ones)
parsed_lightdock_receptor = os.path.join(os.path.dirname(args.receptor_pdb),
DEFAULT_LIGHTDOCK_PREFIX % os.path.basename(args.receptor_pdb))
def __init__(self):
parser = argparse.ArgumentParser(prog="lightdock")
# Receptor
parser.add_argument("setup_file", help="Setup file name",
type=CommandLineParser.valid_file, metavar="setup_file")
# Steps
parser.add_argument("steps", help="number of steps of the simulation",
type=CommandLineParser.valid_integer_number)
# Configuration file
parser.add_argument("-f", "--file", help="algorithm configuration file",
dest="configuration_file", type=CommandLineParser.valid_file,
metavar="configuration_file")
# Scoring function
parser.add_argument("-s", "--scoring_function", help="scoring function used",
dest="scoring_function")
# GSO seed
parser.add_argument("-sg", "--seed", help="seed used in the algorithm",
dest="gso_seed", type=int, default=GSO_SEED)
# Translation step
parser.add_argument("-t", "--translation_step", help="translation step",
type=CommandLineParser.valid_float_number, default=DEFAULT_TRANSLATION_STEP)
# Rotation step
parser.add_argument("-r", "--rotation_step", help="normalized rotation step",
type=CommandLineParser.valid_float_number, default=DEFAULT_ROTATION_STEP)
type=CommandLineParser.valid_float_number, default=DEFAULT_ROTATION_STEP)
# Version
parser.add_argument("-V", "-v", "--version", help="show version",
action='version', version="%s %s" % (parser.prog, CURRENT_VERSION))
# Number of cpu cores to use
parser.add_argument("-c", "--cores", help="number of cpu cores to use",
dest="cores", type=CommandLineParser.valid_integer_number)
# Profiling
parser.add_argument("--profile", help="Output profiling data",
dest="profiling", action='store_true', default=False)
# MPI parallel execution
parser.add_argument("-mpi", "--mpi", help="activates the MPI parallel execution",
dest="mpi", action='store_true', default=False)
# Normal modes step
parser.add_argument("-ns", "--nmodes_step", help="normalized normal modes step",
type=CommandLineParser.valid_float_number, default=DEFAULT_NMODES_STEP)
# Local minimization
parser.add_argument("-min", "--min", help="activates the local minimization",
dest="local_minimization", action='store_true', default=False)
# List of available scoring functions
parser.add_argument("--listscoring", help="list all available scoring functions",
action=ListScoringAction, nargs=0)
self.args = parser.parse_args()
type=SetupCommandLineParser.valid_file, metavar="receptor_pdb_file")
# Ligand
parser.add_argument("ligand_pdb", help="Ligand structure PDB file",
type=SetupCommandLineParser.valid_file, metavar="ligand_pdb_file")
# Clusters
parser.add_argument("swarms", help="Number of swarms of the simulation",
type=SetupCommandLineParser.valid_integer_number)
# Glowworms
parser.add_argument("glowworms", help="Number of glowworms per swarm",
type=SetupCommandLineParser.valid_integer_number)
# Starting points seed
parser.add_argument("--seed_points", help="Random seed used in starting positions calculation",
dest="starting_points_seed", type=int, default=STARTING_POINTS_SEED)
# FTDock poses as cluster centers
parser.add_argument("-ft", "--ftdock", help="Use previous FTDock poses as starting positions",
dest="ftdock_file", type=CommandLineParser.valid_file,
metavar="ftdock_file")
# Dealing with OXT atoms
parser.add_argument("--noxt", help="Remove OXT atoms",
dest="noxt", action='store_true', default=False)
# Dealing with hydrogen atoms
parser.add_argument("--noh", help="Remove Hydrogen atoms",
dest="noh", action='store_true', default=False)
# Verbose PDB parser
parser.add_argument("--verbose_parser", help="PDB parsing verbose mode",
dest="verbose_parser", action='store_true', default=False)
# Normal modes
parser.add_argument("-anm", "--anm", help="Activates the use of ANM backbone flexibility",
dest="use_anm", action='store_true', default=False)
# Normal modes extent seed
parser.add_argument("--seed_anm", help="Random seed used in ANM intial extent",
dest="anm_seed", type=int, default=STARTING_NM_SEED)