Changeset 1699 in rotdif for bin/main_elmdock.py


Ignore:
Timestamp:
Jun 7, 2019, 11:41:39 AM (2 years ago)
Author:
yuexi
Message:

before ellipsoid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/main_elmdock.py

    r1653 r1699  
    4242from StringIO import StringIO
    4343import shutil
     44import sys
    4445
    4546if __name__ == "__main__":
     
    5253    run_name = json_variables['run_name']
    5354    #create subfolders
    54     sub_dir = "ELMDOCK_"+run_name
     55    sub_dir = run_name + "_ELMDOCK"
    5556    if os.path.isdir(sub_dir):
    5657        sys.stderr.write("run name already used\n")
     
    6061    old_pdb = os.path.basename(json_variables['pdb_location'][0])
    6162    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)
    68     exp_keys = exp_plot(color_list, dyna_flag, elm_flag, elmdock_flag,relax_loc)[1]
    69     outputmd_arr_files = []
     63    if to_dock == True:
     64        new_pdb = join(sub_dir, old_pdb)
     65        new_relax = join(sub_dir, old_relax)
     66        shutil.move(old_pdb,new_pdb)
     67        shutil.move(old_relax,new_relax)
     68        os.chdir(sub_dir)
     69        output_res, base_dir, dyna_flag, elm_flag, elmdock_flag,relax_loc = rotdif(to_dock,new_relax, new_pdb,sub_dir)
     70        exp_keys = exp_plot(color_list, dyna_flag, elm_flag, elmdock_flag,relax_loc)[1]
     71        outputmd_arr_files = []
    7072
    71     if dyna_flag == True:
    72         output_res[ 'diso_plot' ] = diso_plot(color_list, exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
    73         output_res[ 'daxi_plot' ] = daxi_plot(color_list, exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
    74         output_res[ 'dani_plot' ] = dani_plot(color_list,exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
     73        if dyna_flag == True:
     74            output_res[ 'diso_plot' ] = diso_plot(color_list, exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
     75            output_res[ 'daxi_plot' ] = daxi_plot(color_list, exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
     76            output_res[ 'dani_plot' ] = dani_plot(color_list,exp_keys, to_dock, dyna_flag, elm_flag, elmdock_flag)
    7577 
    76     if elm_flag == True:
    77         save_elm(dyna_flag, elm_flag, elmdock_flag)
    78         elm_out = ['ELM_prediction']
    79         output_res[ 'elm_out' ] = elm_out   
     78        if elm_flag == True:
     79            save_elm(dyna_flag, elm_flag, elmdock_flag)
     80            elm_out = ['ELM_prediction']
     81            output_res[ 'elm_out' ] = elm_out   
    8082
    81     if elmdock_flag == True:
    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'))
    88         output_res['outputpdb'] = { "file" : view_pdb, "script" : "ribbon" }
     83        if elmdock_flag == True:
     84            save_dock(dyna_flag, elm_flag, elmdock_flag)     
     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'))
     88            output_res['outputpdb'] = { "file" : view_pdb, "script" : "ribbon ONLY" }
    8989       
    90     output_res[ 'outputrotdif' ] = [join(str(base_dir), join(sub_dir,'elmdock_log.out'))]
    91     print (json.dumps(output_res))
     90        output_res[ 'outputrotdif' ] = [join(str(base_dir), join(sub_dir,'elmdock_log.out'))]
     91        print (json.dumps(output_res))
     92    else:
     93        sys.stderr.write("Only accept 2-domain proteins!")
Note: See TracChangeset for help on using the changeset viewer.