Changeset 1653 in rotdif for bin/main_elmdock.py


Ignore:
Timestamp:
Feb 18, 2019, 9:13:23 PM (3 years ago)
Author:
yuexi
Message:

subfolder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/main_elmdock.py

    r1647 r1653  
    11#!/usr/bin/python
    2 import os
     2import os,sys
    33import glob
    44import re
     
    2424from StringIO import StringIO
    2525from subprocess import Popen, PIPE, STDOUT
    26 
     26from os.path import join
    2727#import our functions
    2828from run_rotdif_elmdock import rotdif
     
    4141from indicator_chain import dock
    4242from StringIO import StringIO
     43import shutil
    4344
    4445if __name__ == "__main__":
     
    4950    argv_io_string = StringIO(sys.argv[1])
    5051    json_variables = json.load(argv_io_string)
    51     relax_location = json_variables['relax_location']
    52     relax_loc = relax_location[0]
    53     to_dock = dock(relax_loc)
    54     output_res, base_dir, dyna_flag, elm_flag, elmdock_flag = rotdif(to_dock)
     52    run_name = json_variables['run_name']
     53    #create subfolders
     54    sub_dir = "ELMDOCK_"+run_name
     55    if os.path.isdir(sub_dir):
     56        sys.stderr.write("run name already used\n")
     57    else:
     58        os.mkdir(sub_dir)
     59    old_relax = os.path.basename(json_variables['relax_location'][0])
     60    old_pdb = os.path.basename(json_variables['pdb_location'][0])
     61    to_dock = dock(old_relax)
     62    new_pdb = join(sub_dir, old_pdb)
     63    new_relax = join(sub_dir, old_relax)
     64    shutil.move(old_pdb,new_pdb)
     65    shutil.move(old_relax,new_relax)
     66    os.chdir(sub_dir)
     67    output_res, base_dir, dyna_flag, elm_flag, elmdock_flag,relax_loc = rotdif(to_dock,new_relax, new_pdb,sub_dir)
    5568    exp_keys = exp_plot(color_list, dyna_flag, elm_flag, elmdock_flag,relax_loc)[1]
    5669    outputmd_arr_files = []
    57     log_out = [str(base_dir) + "/" + 'elmdock_log.out']
     70
    5871    if dyna_flag == True:
    5972        output_res[ 'diso_plot' ] = diso_plot(color_list, exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
     
    6376    if elm_flag == True:
    6477        save_elm(dyna_flag, elm_flag, elmdock_flag)
    65         elm_out = [str(base_dir) + "/" + 'ELM_prediction']
     78        elm_out = ['ELM_prediction']
    6679        output_res[ 'elm_out' ] = elm_out   
    6780
    6881    if elmdock_flag == True:
    69         save_dock(dyna_flag, elm_flag, elmdock_flag)
    70         dock_out = [str(base_dir) + "/" + 'ELMDOCK']     
    71         output_res[ 'elmdock_out' ] = dock_out
    72         dock_pdb = [str(base_dir) + "/" + 'out_dock.pdb']
    73         output_res[ 'pdb'] = dock_pdb
    74         view_pdb = str(base_dir) + "/" + 'out_dock.pdb'
     82        save_dock(dyna_flag, elm_flag, elmdock_flag)     
     83        with open('test.txt','w') as in_f:
     84            in_f.write(join(str(base_dir),join(sub_dir,'ELMDOCK')))       
     85        output_res[ 'elmdock_out' ] = [join(str(base_dir),join(sub_dir,'ELMDOCK'))]
     86        output_res[ 'pdb'] = [join(str(base_dir), join(sub_dir,'out_dock.pdb'))]
     87        view_pdb = join(str(base_dir), join(sub_dir,'out_dock.pdb'))
    7588        output_res['outputpdb'] = { "file" : view_pdb, "script" : "ribbon" }
    7689       
    77         #user_pdb = [str(base_dir)+"/"+'diUb_AB.pdb']
    78     output_res[ 'outputrotdif' ] = log_out
     90    output_res[ 'outputrotdif' ] = [join(str(base_dir), join(sub_dir,'elmdock_log.out'))]
    7991    print (json.dumps(output_res))
Note: See TracChangeset for help on using the changeset viewer.