Beispiel #1
0
def worker(df,
           path_root,
           dbase_name,
           target_name,
           docking_only=False,
           receptor_file=None):
    struct = "input/"
    docker, recept = interface_functions.get_receptr(
        receptor_file=receptor_file)

    for pos in range(int(rank), df.shape[0], int(world_size)):
        pos, smiles, name = pos, df.iloc[pos, 0], df.iloc[pos, 1]
        path = path_root + str(pos) + "/"
        try:
            score, res = interface_functions.RunDocking_A(
                smiles,
                struct,
                path,
                dbase_name,
                target_name,
                dock_obj=docker,
                write=False,
                recept=recept,
                receptor_file=receptor_file,
                name=name,
                docking_only=True)
            interface_functions.ParameterizeOE(path)
            mscore = interface_functions.RunMinimization_(path,
                                                          path,
                                                          write=True,
                                                          gpu=True)
            print(smiles, score, mscore)
            if mscore < -500:
                escore = interface_functions.RunMMGBSA_(path,
                                                        path,
                                                        gpu=True,
                                                        niter=5000)  # 5n
                print(smiles, score, mscore, escore)
        except KeyboardInterrupt:
            exit()
        except subprocess.CalledProcessError as e:
            print("Error rank", rank, e)
        except IndexError as e:
            print("Error rank", rank, e)
        except RuntimeError as e:
            print("Error rank", rank, e)
        with open(path + "done.txt", 'w') as f:
            f.write("t")
Beispiel #2
0
def worker(df):

    struct = "input/"

    start_pos = rank * 100
    for pos in range(start_pos, 100 + start_pos):
        path = "test" + str(pos) + "/"
        smiles = df.iloc[pos, 0]

        # pipline
        comm.send([smiles], dest=0, tag=11)
        r = comm.recv(source=0, tag=11)
        print("Rank", rank, "should I run docking on", smiles, "?",
              "\t my model says", bool(r))

        # pipeline
        if r:
            print("Rank", rank, "running docking...")
            score = interface_functions.RunDocking_(smiles, struct, path)
            comm.send([smiles, score], dest=0, tag=11)
            r = comm.recv(source=0, tag=11)
            print("Rank", rank,
                  "should I run minimize, given the docking score", score, "?",
                  "\t my model says", bool(r))

            # pipeline
            if r:
                print("Rank", rank, "running param and mini")
                interface_functions.ParameterizeOE(path)
                mscore = interface_functions.RunMinimization_(path, path)

                comm.send([smiles, score, mscore], dest=0, tag=11)
                r = comm.recv(source=0, tag=11)
                print(
                    "Rank", rank,
                    "should I run mmgbsa for 1 ns given a energy minmization result of",
                    mscore, "?\t my model says", bool(r))
                if r:
                    print("Rank", rank, "running simulation")
                    escore = interface_functions.RunMMGBSA_(path, path)
                    print("Rank", rank, "ran simulation and got", escore)
Beispiel #3
0
def worker2(df,
            path_root,
            dbase_name,
            target_name,
            docking_only=False,
            receptor_file=None):
    size = comm.Get_size()
    struct = "input/"
    #docker,recept = interface_functions.get_receptr(receptor_file=receptor_file)

    for pos in range(rank, len(df), size):
        pos = pos
        path = df[pos]
        try:
            with open(path + "/metrics.csv", 'w') as f:
                f.write("path\n")
                f.write(path + "\n")

            interface_functions.ParameterizeOE(path)

            mscore = interface_functions.RunMinimization_(path,
                                                          path,
                                                          write=True,
                                                          gpu=True)

            print("FINAL", mscore)
        except KeyboardInterrupt:
            exit()
        except subprocess.CalledProcessError as e:
            print("Error rank", rank, e)
        except IndexError as e:
            print("Error rank", rank, e)
        except RuntimeError as e:
            print("Error rank", rank, e)
        with open(path + "done.txt", 'w') as f:
            f.write("t")
"""INSPIRE Parameterization - Parameterize a docked ligand-protein system

Usage:
  param.py -i=<PATH> [-a]
  param.py (-h | --help)
  param.py --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  -i=<PATH>     Path to directory containing a PDBs of the ligand, receptor, and complex.
  -a            Parameterize the docked system with AMBER [default uses OpenEye].

"""
from docopt import docopt
from impress_md import interface_functions
import timeit
start = timeit.default_timer()

if __name__ == '__main__':
    arguments = docopt(__doc__, version='INSPIRE Param 0.0.1')
    path = arguments['-i']

    if arguments['-a']:
        interface_functions.ParameterizeAMBER(path)
    else:
        interface_functions.ParameterizeOE(path)

with open(f'{path}/param.log', "w+") as logf:
    logf.write("Param time (sec): {}\n".format(timeit.default_timer() - start))