Beispiel #1
0
 def do_run(self, line):
     """run
     run PoC module"""
     _fb = self._set_argument()
     if not _fb:
         print_info("wrong", "[-]", "red")
         return
     fb = prepare(_fb)
     results = osprey.start(fb)
     self._print_result(results)
Beispiel #2
0
def main(args):
    # Record relevant parameters
    data = dict.fromkeys(design.HEADERS)
    print args
    data["status"] = design.STATUS.ESTIMATING.value
    data["slurm out"] = args.slurm_out
    data["slurm err"] = args.slurm_err
    data["design name"] = design.get_emat_name(args.cfsfile)
    data["host"] = socket.gethostname()
    data["memory (GB)"] = design.HEAP_GB
    data["epsilon"] = args.epsilon

    data["algorithm"] = design.ALGO_LIST[args.algo]

    # Print out misc information
    print("Output_file: %s" % args.output)
    print("Emat id for this design: %s" % data["design name"])
    print("Running on host: %s" % socket.gethostname())
    sys.stdout.flush()

    osprey.start(
        heapSizeMiB=floor(design.HEAP_GB * 953.674),  # Convert to MiB
        allowRemoteManagement=False)
    conf_spaces = design.make_confspace(args.cfsfile, data)
    shark = design.setup_design(args.num_cores, conf_spaces, args.epsilon,
                                args.numseqs, args.algo, data)

    # Write out JSON file before beginning computation
    with open(os.path.abspath(args.output), 'w') as f:
        f.write(json.dumps(data, indent=4, sort_keys=True) + '\n')

    design.run(shark, data)

    # Print out JSON output
    with open(os.path.abspath(args.output), 'w') as f:
        f.write(json.dumps(data, indent=4, sort_keys=True) + '\n')

    print("Finished writing")
Beispiel #3
0
import osprey

osprey.start()

osprey.printGpuInfo()

def main(args):
    # Record relevant parameters
    data = dict.fromkeys(design.HEADERS)
    print args
    data["status"] = design.STATUS.ESTIMATING.value
    data["slurm out"] = args.slurm_out
    data["slurm err"] = args.slurm_err
    data["design name"] = design.get_emat_name(args.cfsfile)
    data["host"] = socket.gethostname()
    data["memory (GB)"] = design.HEAP_GB
    data["epsilon"] = args.epsilon

    data["algorithm"] = design.ALGO_LIST[args.algo]

    # Print out misc information
    print("Output_file: %s" % args.output)
    print("Emat id for this design: %s" % data["design name"])
    print("Running on host: %s" % socket.gethostname())
    sys.stdout.flush()

    osprey.start(heapSizeMiB=floor(design.HEAP_GB * 953.674),
                 allowRemoteManagement=False)  # Convert to MiB
    conf_spaces = design.make_confspace(args.cfsfile, data)

    # Write out JSON file before beginning computation
    with open(os.path.abspath(args.output), 'w') as f:
        f.write(json.dumps(data, indent=4, sort_keys=True) + '\n')

    print("\nRunning Algorithm")
    design_start = datetime.now()
    data['start_time'] = design_start.strftime(design.DATETIME_FORMAT)

    try:
        pfunc = design.make_complex_pfunc(args.num_cores, conf_spaces,
                                          args.epsilon, args.numseqs,
                                          args.algo, data)

        if args.algo == 2:
            pfunc.setReportProgress(True)
            pfunc.compute(2147483647)
        elif args.algo == 1:
            pfunc.compute()

        data["status"] = design.STATUS.FINISHED.value

    except (jpype.JavaException, AttributeError) as e:
        data["status"] = design.STATUS.ERROR.value
        print str(e)
        print e.stacktrace()
        data['errmsg'] = str(e)

    design_end = datetime.now()
    data['end_time'] = design_end.strftime(design.DATETIME_FORMAT)
    data['runtime (s)'] = (design_end - design_start).total_seconds()
    print("Algorithm Runtime (s): %d" % data['runtime (s)'])

    # Print out JSON output
    with open(os.path.abspath(args.output), 'w') as f:
        f.write(json.dumps(data, indent=4, sort_keys=True) + '\n')

    print("Finished writing")
Beispiel #5
0
import osprey
osprey.start(heapSizeMiB=200000)

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# INSERT SCRIPT OUTPUT HERE
mol = osprey.readPdb('../../pdb/1GWC.shell.pdb')
pos =  [0, 1, 2, 3, 4, 5, 6, 7, 8]
posP =  [0, 1, 2, 3, 4]
posL =  [5, 6, 7, 8]
resNumsPL =  ['C53', 'C64', 'C67', 'C71', 'C78', 'B93', 'B100', 'B101', 'B104']
resNumsP =  ['C53', 'C64', 'C67', 'C71', 'C78']
resNumsL =  ['B93', 'B100', 'B101', 'B104']
startResP =  'C7'
endResP =  'C80'
startResL =  'B89'
endResL =  'B161'
AATypeOptions =  [['HID', 'ASP', 'GLU', 'SER', 'THR', 'ASN', 'GLN', 'ALA', 'VAL', 'ILE', 'LEU', 'CYS', 'GLY'], ['ALA', 'LEU', 'ILE', 'VAL', 'PHE', 'TYR', 'MET', 'GLU', 'ASP','HID', 'ASN', 'GLN', 'GLY'], ['CYS', 'SER', 'THR', 'ASN', 'GLN', 'HIE', 'ALA', 'VAL', 'ILE', 'LEU', 'PHE', 'TYR', 'GLY'], ['ILE', 'ALA', 'LEU', 'VAL', 'PHE', 'TYR', 'MET','GLU', 'ASP', 'HID', 'ASN', 'GLN', 'GLY'], ['GLU', 'ASP', 'PHE', 'TYR', 'ALA', 'VAL', 'ILE', 'LEU', 'HIE', 'HID', 'ASN', 'GLN', 'GLY'], ['TYR', 'PHE', 'ALA', 'VAL', 'ILE','LEU', 'GLU', 'ASP', 'HID', 'HIE', 'ASN', 'GLN', 'GLY'], ['PHE', 'TYR', 'ALA', 'VAL', 'ILE', 'LEU', 'GLU', 'ASP', 'HID', 'HIE', 'ASN', 'GLN', 'GLY'], ['TRP', 'ALA', 'VAL','ILE', 'LEU', 'PHE', 'TYR', 'MET', 'SER', 'THR', 'ASN', 'GLN', 'GLY'], ['TYR', 'PHE', 'ALA', 'VAL', 'ILE', 'LEU', 'GLU', 'ASP', 'HID', 'HIE', 'ASN', 'GLN', 'GLY']]
# make sure all strands share the same template library (including wild-type rotamers)
templateLib = osprey.TemplateLibrary(ffparams.forcefld, moleculesForWildTypeRotamers=[mol])

# define the protein strand
ligand = osprey.Strand(mol, templateLib=templateLib, residues=[startResL, endResL])
for i in range(0,len(resNumsL)):
    ligand.flexibility[resNumsL[i]].setLibraryRotamers(*AATypeOptions[posL[i]]).addWildTypeRotamers().setContinuous()

# define the ligand strand
protein = osprey.Strand(mol, templateLib=templateLib, residues=[startResP, endResP])
for i in range(0,len(resNumsP)):
Beispiel #6
0
def main(args):
    # Record relevant parameters
    data = dict.fromkeys(design.HEADERS)
    print args
    data["status"] = design.STATUS.ESTIMATING.value
    data["slurm out"] = args.slurm_out
    data["slurm err"] = args.slurm_err
    data["design name"] = design.get_emat_name(args.cfsfile)
    data["host"] = socket.gethostname()
    data["memory (GB)"] = design.HEAP_GB
    data["epsilon"] = args.epsilon

    data["algorithm"] = design.ALGO_LIST[args.algo]

    # Print out misc information
    print("Output_file: %s" % args.output)
    print("Emat id for this design: %s" % data["design name"])
    print("Running on host: %s" % socket.gethostname())
    sys.stdout.flush()

    osprey.start(heapSizeMiB=floor(design.HEAP_GB * 953.674),
                                  allowRemoteManagement=False) # Convert to MiB
    conf_spaces = design.make_confspace(args.cfsfile, data,
                                       cfs_dir =
                                        "/usr/project/dlab/Users/gth/projects/osprey_test_suite/augmented_MARK_known"
                                       )

    # make structure to store compute time per sequence
    compute_time_list = []

    # Write out JSON file before beginning computation
    with open(os.path.abspath(args.output), 'w') as f:
        f.write(json.dumps(data, indent = 4, sort_keys=True)+
                '\n')

    print("\nRunning Algorithm")
    design_start = datetime.now()
    data['start_time'] = design_start.strftime(design.DATETIME_FORMAT)

    try:
        print("\nMaking pfunc factory")

        pfunc_factory = design.make_pfunc_factory(
            conf_spaces['complex'],
            conf_spaces['ffparams'],
            args.num_cores,
            args.epsilon,
            args.algo,
            "manual_seq_alg%d" % args.algo,
            data)

        for sequence in data["sequences"]:
            precalc_start = datetime.now()# Handle timing for precalculation

            print("\nMaking pfunc for %s" % sequence)
            pfunc = design.make_pfunc_for_sequence(
                conf_spaces['complex'],
                pfunc_factory,
                args.epsilon,
                data,
                sequence
            )
            precalc_end = datetime.now()
            data['precalc_time'] = (precalc_end - precalc_start).total_seconds()

            print("\nComputing pfunc")
            compute_start = datetime.now()

            if args.algo == 2:
                pfunc.setReportProgress(True)
                pfunc.compute(2147483647)
            else:
                pfunc.compute()

            compute_end = datetime.now()
            compute_time_list.append((compute_end - compute_start)
                                     .total_seconds())

            result_dict = {"lowerbound" : pfunc.getValues().calcLowerBound()
                           .toString(),
                           "upperbound" : pfunc.getValues().calcUpperBound()
                           .toString(),
                           "kscore" : None}

            if data["results"] is None:
                data["results"] = {', '.join(sequence): result_dict}
            else:
                data["results"][', '.join(sequence)] = result_dict


        data["status"] = design.STATUS.FINISHED.value
        # can't use lists as keys, so turn into strings
        seq_keys = [', '.join(e) for e in data["sequences"]] 
        data["time_per_seq"] = dict(zip(seq_keys, compute_time_list))

    except (jpype.JavaException, AttributeError) as e:
        data["status"] = design.STATUS.ERROR.value
        print str(e)
        print e.stacktrace()
        data['errmsg'] = str(e)

    design_end = datetime.now()
    data['end_time'] = design_end.strftime(design.DATETIME_FORMAT)
    data['runtime (s)'] = (design_end - design_start).total_seconds()
    print("Algorithm Runtime (s): %d" % data['runtime (s)'])

    # Print out JSON output
    with open(os.path.abspath(args.output) , 'w') as f:
        f.write(json.dumps(data ,indent = 4, sort_keys=True)+'\n')

    print("Finished writing")