def test_setup(test_object, dict_key): test_object.data_dir = opj(os.path.dirname(os.path.abspath(sys.modules[__name__].__file__)),'data') test_object.yaml_path= opj(test_object.data_dir, 'conf.yaml') test_object.system=os.getenv('testsys') if test_object.system is None: print 'WARNING: "testsys" env variable should be set, "linux" will be used by default value.' print ' Please, try: "export testsys=linux"' test_object.system='linux' conf = settings.YamlReader(test_object.yaml_path, test_object.system) test_object.properties = conf.get_prop_dic()[dict_key] fu.create_dir(test_object.properties['path'])
def main(): start_time = time.time() yaml_path=sys.argv[1] system=sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths = conf.get_paths_dic() prop = conf.get_prop_dic(global_log=out_log) out_log.info('') out_log.info('_______MD LAUNCH_______') out_log.info('') out_log.info('step1: gppeq ---- Preprocessing: Molecular dynamics') fu.create_dir(prop['step1_gppeq']['path']) grompp.Grompp(properties=prop['step1_gppeq'], **paths['step1_gppeq']).launch() out_log.info('step2: mdeq ----- Running: Molecular dynamics') fu.create_dir(prop['step2_mdeq']['path']) mdrun.Mdrun(properties=prop['step2_mdeq'], **paths['step2_mdeq']).launch() #Create setupfiles dir and copy files mdfiles_path = os.path.join(workflow_path,'mdfiles') fu.create_dir(mdfiles_path) shutil.copy(paths['step2_mdeq']['input_tpr_path'], os.path.join(mdfiles_path, 'md.tpr')) shutil.copy(paths['step2_mdeq']['output_cpt_path'], os.path.join(mdfiles_path, 'md.cpt')) shutil.copy(paths['step2_mdeq']['output_gro_path'], os.path.join(mdfiles_path, 'md.gro')) shutil.copy('_step2_mdeq_mdeq.xtc', os.path.join(mdfiles_path, 'md.xtc')) removed_list = fu.remove_temp_files(['#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.trr']) out_log.info('') out_log.info('Removing unwanted files: ') for removed_file in removed_list: out_log.info(' X ' + removed_file) elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: '+workflow_path) out_log.info(' Config File: '+yaml_path) out_log.info(' System: '+system) if len(sys.argv) >= 4: out_log.info(' Nodes: '+sys.argv[3]) out_log.info('') out_log.info('Elapsed time: '+str(elapsed_time)+' seconds') out_log.info('')
def main(): from pycompss.api.api import compss_open start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths_glob = conf.get_paths_dic() prop_glob = conf.get_prop_dic() out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info('step1: mmbpdb -- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info(' Selected PDB code: ' + prop_glob['step1_mmbpdb']['pdb_code']) fu.create_dir(prop_glob['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop_glob['step1_mmbpdb']['pdb_code'], paths_glob['step1_mmbpdb']['output_pdb_path']) structure = paths_glob['step1_mmbpdb']['output_pdb_path'] out_log.info('step2: mmbuniprot -- Get mutations') mutations = conf.properties.get('input_mapped_mutations_list', None) if mutations is None or len(mutations) < 7: mmbuniprot = uniprot.MmbVariants(prop_glob['step1_mmbpdb']['pdb_code']) mutations = mmbuniprot.get_pdb_variants() if mutations is None or len(mutations) == 0: return else: mutations = [ m.strip() for m in conf.properties.get( 'input_mapped_mutations_list').split(',') ] mutations_limit = min( len(mutations), int(prop_glob.get('mutations_limit', len(mutations)))) out_log.info('') out_log.info('Number of mutations to be modelled: ' + str(mutations_limit)) rms_list = [] mutations_counter = 0 for mut in mutations: if mutations_counter == mutations_limit: break mutations_counter += 1 paths = conf.get_paths_dic(mut) prop = conf.get_prop_dic(mut) out_log.info('') out_log.info('-------------------------') out_log.info( str(mutations_counter) + '/' + str(mutations_limit) + ' ' + mut) out_log.info('-------------------------') out_log.info('') out_log.info('step3: scw ------ Model mutation') fu.create_dir(prop['step3_scw']['path']) paths['step3_scw']['input_pdb_path'] = structure scwrl_pc(properties=prop['step3_scw'], **paths['step3_scw']) out_log.info('step4: p2g ------ Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) pdb2gmx_pc(properties=prop['step4_p2g'], **paths['step4_p2g']) out_log.info('step5: ec ------- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) editconf_pc(properties=prop['step5_ec'], **paths['step5_ec']) out_log.info('step6: sol ------ Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) solvate_pc(properties=prop['step6_sol'], **paths['step6_sol']) out_log.info( 'step7: gppions -- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) grompp_pc(properties=prop['step7_gppions'], **paths['step7_gppions']) out_log.info('step8: gio ------ Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) genion_pc(properties=prop['step8_gio'], **paths['step8_gio']) out_log.info('step9: gppmin --- Preprocessing: Energy minimization') fu.create_dir(prop['step9_gppmin']['path']) grompp_pc(properties=prop['step9_gppmin'], **paths['step9_gppmin']) out_log.info('step10: mdmin ---- Running: Energy minimization') fu.create_dir(prop['step10_mdmin']['path']) mdrun_pc(properties=prop['step10_mdmin'], **paths['step10_mdmin']) out_log.info( 'step11: gppnvt --- Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step11_gppnvt']['path']) grompp_pc(properties=prop['step11_gppnvt'], **paths['step11_gppnvt']) out_log.info( 'step12: mdnvt ---- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step12_mdnvt']['path']) mdrun_pc_cpt(properties=prop['step12_mdnvt'], **paths['step12_mdnvt']) out_log.info( 'step13: gppnpt --- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step13_gppnpt']['path']) grompp_pc_cpt(properties=prop['step13_gppnpt'], **paths['step13_gppnpt']) out_log.info( 'step14: mdnpt ---- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step14_mdnpt']['path']) mdrun_pc_cpt(properties=prop['step14_mdnpt'], **paths['step14_mdnpt']) out_log.info( 'step15: gppeq ---- Preprocessing: 1ns Molecular dynamics Equilibration' ) fu.create_dir(prop['step15_gppeq']['path']) grompp_pc_cpt(properties=prop['step15_gppeq'], **paths['step15_gppeq']) out_log.info( 'step16: mdeq ----- Running: 1ns Molecular dynamics Equilibration') fu.create_dir(prop['step16_mdeq']['path']) mdrun_pc(properties=prop['step16_mdeq'], **paths['step16_mdeq']) out_log.info('step17: rmsd ----- Computing RMSD') fu.create_dir(prop['step17_rmsd']['path']) rms_list.append( rms_pc(properties=prop['step17_rmsd'], **paths['step17_rmsd'])) xvg_dict = reduce(merge_dictionaries, rms_list) out_log.info('step18: gnuplot ----- Creating RMSD plot') fu.create_dir(prop_glob['step18_gnuplot']['path']) output_png_path = paths_glob['step18_gnuplot']['output_png_path'] properties = prop_glob['step18_gnuplot'] gnuplot_pc(xvg_dict, output_png_path, properties) png = compss_open(output_png_path) elapsed_time = time.time() - start_time with open(opj(workflow_path, 'time.txt'), 'a') as time_file: time_file.write('Elapsed time: ') time_file.write(str(elapsed_time)) time_file.write('\n') time_file.write('Config File: ') time_file.write(sys.argv[1]) time_file.write('\n') time_file.write('Sytem: ') time_file.write(sys.argv[2]) time_file.write('\n') if len(sys.argv) >= 4: time_file.write('Nodes: ') time_file.write(sys.argv[3]) time_file.write('\n')
def main(): start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths = conf.get_paths_dic() props = conf.get_prop_dic(global_log=out_log) out_log.info('') out_log.info('_______TEST CMIP TITRATION WORKFLOW_______') out_log.info('') stepid = 'step1_mmbpdb' out_log.info(stepid) props['step'] = stepid # For testing only fu.create_dir(props[stepid]['path']) copyfile(paths['step1_mmbpdb']['input_test_pdb_path'], paths['step1_mmbpdb']['output_pdb_path']) out_log.info('Test input file copy from: ' + paths['step1_mmbpdb']['input_test_pdb_path'] + ' to: ' + paths['step1_mmbpdb']['output_pdb_path']) stepid = 'step2_preppdbCMIP' out_log.info(stepid) props['step'] = stepid fu.create_dir(props[stepid]['path']) out_log.info('Step 2 prep pdb CMIP create dir: ' + props[stepid]['path']) PPW.prepPDBWrapper(paths[stepid], props[stepid]).launch() # stepid = 'step3_CMIPTitration' # out_log.info(stepid) # props['step'] = stepid # # fu.create_dir(props[stepid]['path']) # # cw = CW.CMIPWrapper(paths[stepid],props[stepid]) # #Delaying removal of temporary dir until output is processed # cw.launch(False) # out_log.debug ("Temp directory: "+ cw.run.tmpdir) # out_log.info(stepid + " CMIP Output") # # if cw.result.errstr: # out_log.error(cw.result.errstr) # sys.exit(1) # else: # out_log.info(cw.result.output) # out_log.info('') # # outpdbFn = cw.result.getFileName('outpdb')+".pdb" # out_log.info('Building output pdb file at') # out_log.info(paths[stepid]['output_pdb_path']) # # out_log.info('Base File: '+ paths[stepid]['input_pdb_path']) # out_log.info('Titration File: '+ outpdbFn) # # outFh = open(paths[stepid]['output_pdb_path'],"w") # baseFh = open(paths[stepid]['input_pdb_path'],"r") # addFh = open(outpdbFn,"r") # # outFh.write(baseFh.read()) # baseFh.close() # for line in addFh: # if re.match('^ATOM',line): # outFh.write(line) # outFh.close() # addFh.close() # # out_log.info('') # # cw.run.rmTmpDir() # elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution successful: ') out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) if len(sys.argv) >= 4: out_log.info(' Nodes: ' + sys.argv[3]) out_log.info('') out_log.info('Elapsed time: ' + str(elapsed_time) + ' seconds') out_log.info('')
def main(): start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True, level='DEBUG') paths = conf.get_paths_dic() prop = conf.get_prop_dic(global_log=out_log) out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info("Command Executed:") out_log.info(" ".join(sys.argv)) out_log.info('Workflow_path: ' + workflow_path) out_log.info('Config File: ' + yaml_path) out_log.info('System: ' + system) out_log.info('') #Download initial structure out_log.info('step1: mmbpdb -- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info(' Selected PDB code: ' + prop['step1_mmbpdb']['pdb_code']) fu.create_dir(prop['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop['step1_mmbpdb']['pdb_code'], paths['step1_mmbpdb']['output_pdb_path'], "filter=:" + prop['step1_mmbpdb']['pdb_chain']) structure = paths['step1_mmbpdb']['output_pdb_path'] decoys_sdf_path = conf.properties[system].get('decoys_sdf_path', None) if not decoys_sdf_path: #Dowload decoys out_log.info('Downloading decoys from DUDe') fu.create_dir(prop['dude']['path']) out_log.debug('\nPaths:\n' + str(paths['dude']) + '\nProperties:\n' + str(prop['dude']) + '\n') decoys_sdf_path = dude.Dude(properties=prop['dude'], **paths['dude']).get_decoys_from_pdb() #SDF to PDB list out_log.info('Converting sdf to pdb') fu.create_dir(prop['sdf2pdb']['path']) out_log.debug('\nPaths:\n' + str(paths['sdf2pdb']) + '\nProperties:\n' + str(prop['sdf2pdb']) + '\n') decoys_pdb_list = sdf2pdb.SDF2PDB(input_sdf_path=decoys_sdf_path, properties=prop['sdf2pdb']).launch() #Get Actives actives_dir_path = conf.properties[system].get('actives_dir_path', None) actives_pdb_list = [] if not actives_dir_path: pass for dirpath, _, filenames in os.walk(actives_dir_path): for f in filenames: actives_pdb_list.append(os.path.abspath(os.path.join(dirpath, f))) #Merge actives and decoys small_molecules_list = decoys_pdb_list + actives_pdb_list #Get bindingsite out_log.info('bindingsite') fu.create_dir(prop['bindingsite']['path']) out_log.debug('\nPaths:\n' + str(paths['bindingsite']) + '\nProperties:\n' + str(prop['bindingsite']) + '\n') bindingsite.BindingSite(properties=prop['bindingsite'], **paths['bindingsite']).launch() # Get Receptor pdb cluster receptors_pdb_path = conf.properties[system].get('receptors_pdb_path', None) if not receptors_pdb_path: out_log.info('md_clustering workflow') fu.create_dir(prop['md_clustering']['path']) out_log.debug('\nPaths:\n' + str(paths['md_clustering']) + '\nProperties:\n' + str(prop['md_clustering']) + '\n') receptors_pdb_path = md_cluster.MDCluster( yaml_path=prop['md_clustering']['yaml_path'], system=prop['md_clustering']['system'], workflow_path=paths['md_clustering']['workflow_path'], structure_pdb_path=structure).launch() # Get BindingSite BOX out_log.info('box') fu.create_dir(prop['box']['path']) out_log.debug('\nPaths:\n' + str(paths['box']) + '\nProperties:\n' + str(prop['box']) + '\n') box.Box(properties=prop['box'], input_pdb_path=receptors_pdb_path, **paths['box']).launch() # Split receptor PDB into multiple PDBs parser = Bio.PDB.PDBParser() st = parser.get_structure('st', receptors_pdb_path) receptors_list = [] for i in range(len(st)): structure_tmp = st.copy() for j in range(len(st)): if j != i: structure_tmp.detach_child(j) io = Bio.PDB.PDBIO() io.set_structure(structure_tmp) receptor_name = 'receptor_' + str(i) + '.pdb' io.save(receptor_name) receptors_list.append(receptor_name) max_receptors = conf.properties[system].get('max_receptors', len(receptors_list)) max_ligands = conf.properties[system].get('max_ligands', len(small_molecules_list)) for receptor_index, receptor_path in enumerate(receptors_list): if receptor_index >= max_receptors: break #Prepare receptor out_log.info('Prepare receptor') fu.create_dir(prop['prepare_receptor']['path']) out_log.debug('\nPaths:\n' + str(paths['prepare_receptor']) + '\nProperties:\n' + str(prop['prepare_receptor']) + '\n') prepare_receptor.VinaPrepareReceptor( properties=prop['prepare_receptor'], input_receptor_pdb_path=receptor_path, **paths['prepare_receptor']).launch() for ligand_index, ligand_path in enumerate(small_molecules_list): if ligand_index >= max_ligands: break #Prepare Ligand out_log.info('Prepare ligand') fu.create_dir(prop['prepare_ligand']['path']) out_log.debug('\nPaths:\n' + str(paths['prepare_ligand']) + '\nProperties:\n' + str(prop['prepare_ligand']) + '\n') prepare_ligand.VinaPrepareLigand( properties=prop['prepare_ligand'], input_ligand_pdb_path=ligand_path, **paths['prepare_ligand']).launch() #Launch vina docking paths['vina']['output_path'] = os.path.join( prop['vina']['path'], os.path.splitext(os.path.basename(receptor_path))[0] + '_' + os.path.splitext(os.path.basename(ligand_path))[0] + '_docking.pdbqt') out_log.info('vina') fu.create_dir(prop['vina']['path']) out_log.debug('\nPaths:\n' + str(paths['vina']) + '\nProperties:\n' + str(prop['vina']) + '\n') vina.AutoDockVina(properties=prop['vina'], **paths['vina']).launch() #Docking to list #Get top 10 ligands elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) out_log.info('') out_log.info('Elapsed time: ' + str(elapsed_time) + ' seconds') out_log.info('')
def main(): from pycompss.api.api import compss_open, compss_barrier start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] n_mutations = sys.argv[3] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True, level='DEBUG') paths_glob = conf.get_paths_dic() prop_glob = conf.get_prop_dic() out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info("Command Executed:") out_log.info(" ".join(sys.argv)) out_log.info('Workflow_path: ' + workflow_path) out_log.info('Config File: ' + yaml_path) out_log.info('System: ' + system) out_log.info('Mutations limit: ' + n_mutations) if len(sys.argv) >= 5: out_log.info('Nodes: ' + sys.argv[4]) out_log.info('') out_log.info('step1: mmbpdb -- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info(22 * ' ' + 'Selected PDB code: ' + prop_glob['step1_mmbpdb']['pdb_code']) fu.create_dir(prop_glob['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop_glob['step1_mmbpdb']['pdb_code'], paths_glob['step1_mmbpdb']['output_pdb_path']) structure = paths_glob['step1_mmbpdb']['output_pdb_path'] else: out_log.info(22 * ' ' + 'Selected PDB structure: ' + structure) out_log.info('step2: mmbuniprot -- Get mutations') mutations = conf.properties.get('input_mapped_mutations_list', None) if mutations is None or len(mutations) < 7: mmbuniprot = uniprot.MmbVariants(prop_glob['step1_mmbpdb']['pdb_code']) mutations = mmbuniprot.get_pdb_variants() if mutations is None or len(mutations) == 0: return else: out_log.info(22 * ' ' + 'Number of obtained mutations: ' + str(len(mutations))) else: mutations = [ m.strip() for m in conf.properties.get( 'input_mapped_mutations_list').split(',') ] out_log.info(22 * ' ' + 'Number of mutations in list: ' + str(len(mutations))) mutations_limit = min(len(mutations), int(n_mutations)) out_log.info('') out_log.info('Number of mutations to be modelled: ' + str(mutations_limit)) rms_list = [] mutations_counter = 0 for mut in mutations: if mutations_counter == mutations_limit: break mutations_counter += 1 mut = mut if not mut.startswith('*') else mut.replace('*', 'ALL') paths = conf.get_paths_dic(mut) prop = conf.get_prop_dic(mut) out_log.info('') out_log.info('-------------------------') out_log.info( str(mutations_counter) + '/' + str(mutations_limit) + ' ' + mut) out_log.info('-------------------------') out_log.info('') out_log.info('step3: scw ---------- Model mutation') fu.create_dir(prop['step3_scw']['path']) paths['step3_scw']['input_pdb_path'] = structure out_log.debug('Paths:') out_log.debug(str(paths['step3_scw'])) out_log.debug('Properties:') out_log.debug(str(prop['step3_scw']) + '\n') scwrl_pc(properties=prop['step3_scw'], **paths['step3_scw']) out_log.info('step4: p2g ---------- Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step4_p2g'])) out_log.debug('Properties:') out_log.debug(str(prop['step4_p2g']) + '\n') pdb2gmx_pc(properties=prop['step4_p2g'], **paths['step4_p2g']) out_log.info('step5: ec ----------- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step5_ec'])) out_log.debug('Properties:') out_log.debug(str(prop['step5_ec']) + '\n') editconf_pc(properties=prop['step5_ec'], **paths['step5_ec']) out_log.info('step6: sol ---------- Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step6_sol'])) out_log.debug('Properties:') out_log.debug(str(prop['step6_sol']) + '\n') solvate_pc(properties=prop['step6_sol'], **paths['step6_sol']) out_log.info( 'step7: gppions ------ Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step7_gppions'])) out_log.debug('Properties:') out_log.debug(str(prop['step7_gppions']) + '\n') grompp_pc(properties=prop['step7_gppions'], **paths['step7_gppions']) out_log.info('step8: gio ---------- Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step8_gio'])) out_log.debug('Properties:') out_log.debug(str(prop['step8_gio']) + '\n') genion_pc(properties=prop['step8_gio'], **paths['step8_gio']) out_log.info('Step9: gppndx ------- Preprocessing index creation') fu.create_dir(prop['step9_gppndx']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step9_gppndx'])) out_log.debug('Properties:') out_log.debug(str(prop['step9_gppndx']) + '\n') grompp_pc(properties=prop['step9_gppndx'], **paths['step9_gppndx']) out_log.info('Step10: make_ndx ---- Create restrain index') fu.create_dir(prop['step10_make_ndx']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step10_make_ndx'])) out_log.debug('Properties:') out_log.debug(str(prop['step10_make_ndx']) + '\n') make_ndx_pc(properties=prop['step10_make_ndx'], **paths['step10_make_ndx']) out_log.info('Step11: ndx2resttop - Create restrain topology') fu.create_dir(prop['step11_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step11_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step11_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step11_ndx2resttop'], **paths['step11_ndx2resttop']) out_log.info( 'step12: gppresmin --- Preprocessing: Mutated residue minimization' ) fu.create_dir(prop['step12_gppresmin']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step12_gppresmin'])) out_log.debug('Properties:') out_log.debug(str(prop['step12_gppresmin']) + '\n') grompp_pc(properties=prop['step12_gppresmin'], **paths['step12_gppresmin']) out_log.info( 'step13: mdresmin ---- Running: Mutated residue minimization') fu.create_dir(prop['step13_mdresmin']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step13_mdresmin'])) out_log.debug('Properties:') out_log.debug(str(prop['step13_mdresmin']) + '\n') mdrun_pc(properties=prop['step13_mdresmin'], **paths['step13_mdresmin']) out_log.info('Step14: ndx2resttop - Create restrain topology') fu.create_dir(prop['step14_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step14_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step14_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step14_ndx2resttop'], **paths['step14_ndx2resttop']) out_log.info('step15: gppmin ------ Preprocessing: minimization') fu.create_dir(prop['step15_gppmin']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step15_gppmin'])) out_log.debug('Properties:') out_log.debug(str(prop['step15_gppmin']) + '\n') grompp_pc(properties=prop['step15_gppmin'], **paths['step15_gppmin']) out_log.info('step16: mdmin ------- Running: minimization') fu.create_dir(prop['step16_mdmin']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step16_mdmin'])) out_log.debug('Properties:') out_log.debug(str(prop['step16_mdmin']) + '\n') mdrun_pc(properties=prop['step16_mdmin'], **paths['step16_mdmin']) out_log.info('Step17: ndx2resttop - Create restrain topology') fu.create_dir(prop['step17_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step17_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step17_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step17_ndx2resttop'], **paths['step17_ndx2resttop']) out_log.info( 'step18: gppsa ------- Preprocessing: simulated annealing') fu.create_dir(prop['step18_gppsa']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step18_gppsa'])) out_log.debug('Properties:') out_log.debug(str(prop['step18_gppsa']) + '\n') grompp_pc(properties=prop['step18_gppsa'], **paths['step18_gppsa']) out_log.info('step19: mdsa -------- Running: simulated annealing') fu.create_dir(prop['step19_mdsa']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step19_mdsa'])) out_log.debug('Properties:') out_log.debug(str(prop['step19_mdsa']) + '\n') mdrun_pc_cpt(properties=prop['step19_mdsa'], **paths['step19_mdsa']) out_log.info( 'step20: gppnvt_1000 - Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step20_gppnvt_1000']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step20_gppnvt_1000'])) out_log.debug('Properties:') out_log.debug(str(prop['step20_gppnvt_1000']) + '\n') grompp_pc_cpt(properties=prop['step20_gppnvt_1000'], **paths['step20_gppnvt_1000']) out_log.info( 'step21: mdnvt_1000 -- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step21_mdnvt_1000']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step21_mdnvt_1000'])) out_log.debug('Properties:') out_log.debug(str(prop['step21_mdnvt_1000']) + '\n') mdrun_pc_cpt(properties=prop['step21_mdnvt_1000'], **paths['step21_mdnvt_1000']) out_log.info('Step22: ndx2resttop - Create restrain topology') fu.create_dir(prop['step22_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step22_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step22_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step22_ndx2resttop'], **paths['step22_ndx2resttop']) out_log.info( 'step23: gppnvt_800 -- Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step23_gppnvt_800']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step23_gppnvt_800'])) out_log.debug('Properties:') out_log.debug(str(prop['step23_gppnvt_800']) + '\n') grompp_pc_cpt(properties=prop['step23_gppnvt_800'], **paths['step23_gppnvt_800']) out_log.info( 'step24: mdnvt_800 --- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step24_mdnvt_800']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step24_mdnvt_800'])) out_log.debug('Properties:') out_log.debug(str(prop['step24_mdnvt_800']) + '\n') mdrun_pc_cpt(properties=prop['step24_mdnvt_800'], **paths['step24_mdnvt_800']) out_log.info('Step25: ndx2resttop - Create restrain topology') fu.create_dir(prop['step25_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step25_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step25_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step25_ndx2resttop'], **paths['step25_ndx2resttop']) out_log.info( 'step26: gppnpt_500 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step26_gppnpt_500']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step26_gppnpt_500'])) out_log.debug('Properties:') out_log.debug(str(prop['step26_gppnpt_500']) + '\n') grompp_pc_cpt(properties=prop['step26_gppnpt_500'], **paths['step26_gppnpt_500']) out_log.info( 'step27: mdnpt_500 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step27_mdnpt_500']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step27_mdnpt_500'])) out_log.debug('Properties:') out_log.debug(str(prop['step27_mdnpt_500']) + '\n') mdrun_pc_cpt(properties=prop['step27_mdnpt_500'], **paths['step27_mdnpt_500']) out_log.info('Step28: ndx2resttop - Create restrain topology') fu.create_dir(prop['step28_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step28_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step28_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step28_ndx2resttop'], **paths['step28_ndx2resttop']) out_log.info( 'step29: gppnpt_300 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step29_gppnpt_300']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step29_gppnpt_300'])) out_log.debug('Properties:') out_log.debug(str(prop['step29_gppnpt_300']) + '\n') grompp_pc_cpt(properties=prop['step29_gppnpt_300'], **paths['step29_gppnpt_300']) out_log.info( 'step30: mdnpt_300 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step30_mdnpt_300']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step30_mdnpt_300'])) out_log.debug('Properties:') out_log.debug(str(prop['step30_mdnpt_300']) + '\n') mdrun_pc_cpt(properties=prop['step30_mdnpt_300'], **paths['step30_mdnpt_300']) out_log.info('Step31: ndx2resttop - Create restrain topology') fu.create_dir(prop['step31_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step31_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step31_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step31_ndx2resttop'], **paths['step31_ndx2resttop']) out_log.info( 'step32: gppnpt_200 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step32_gppnpt_200']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step32_gppnpt_200'])) out_log.debug('Properties:') out_log.debug(str(prop['step32_gppnpt_200']) + '\n') grompp_pc_cpt(properties=prop['step32_gppnpt_200'], **paths['step32_gppnpt_200']) out_log.info( 'step33: mdnpt_200 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step33_mdnpt_200']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step33_mdnpt_200'])) out_log.debug('Properties:') out_log.debug(str(prop['step33_mdnpt_200']) + '\n') mdrun_pc_cpt(properties=prop['step33_mdnpt_200'], **paths['step33_mdnpt_200']) out_log.info('Step34: ndx2resttop - Create restrain topology') fu.create_dir(prop['step34_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step34_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step34_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step34_ndx2resttop'], **paths['step34_ndx2resttop']) out_log.info( 'step35: gppnpt_100 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step35_gppnpt_100']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step35_gppnpt_100'])) out_log.debug('Properties:') out_log.debug(str(prop['step35_gppnpt_100']) + '\n') grompp_pc_cpt(properties=prop['step35_gppnpt_100'], **paths['step35_gppnpt_100']) out_log.info( 'step36: mdnpt_100 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step36_mdnpt_100']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step36_mdnpt_100'])) out_log.debug('Properties:') out_log.debug(str(prop['step36_mdnpt_100']) + '\n') mdrun_pc_cpt(properties=prop['step36_mdnpt_100'], **paths['step36_mdnpt_100']) out_log.info('Step37: ndx2resttop - Create restrain topology') fu.create_dir(prop['step37_ndx2resttop']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step37_ndx2resttop'])) out_log.debug('Properties:') out_log.debug(str(prop['step37_ndx2resttop']) + '\n') ndx2resttop_pc(properties=prop['step37_ndx2resttop'], **paths['step37_ndx2resttop']) out_log.info( 'step38: gppnpt ------ Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step38_gppnpt']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step38_gppnpt'])) out_log.debug('Properties:') out_log.debug(str(prop['step38_gppnpt']) + '\n') grompp_pc_cpt(properties=prop['step38_gppnpt'], **paths['step38_gppnpt']) out_log.info( 'step39: mdnpt ------- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step39_mdnpt']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step39_mdnpt'])) out_log.debug('Properties:') out_log.debug(str(prop['step39_mdnpt']) + '\n') mdrun_pc_cpt(properties=prop['step39_mdnpt'], **paths['step39_mdnpt']) out_log.info( 'step40: gppmd ------- Preprocessing: Free Molecular dynamics') fu.create_dir(prop['step40_gppmd']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step40_gppmd'])) out_log.debug('Properties:') out_log.debug(str(prop['step40_gppmd']) + '\n') grompp_pc_cpt(properties=prop['step40_gppmd'], **paths['step40_gppmd']) out_log.info('step41: md ---------- Running: Free Molecular dynamics') fu.create_dir(prop['step41_md']['path']) out_log.debug('Paths:') out_log.debug(str(paths['step41_md'])) out_log.debug('Properties:') out_log.debug(str(prop['step41_md']) + '\n') mdrun_pc_cpt(properties=prop['step41_md'], **paths['step41_md']) # out_log.info('step42: rmsd -------- Computing RMSD') # fu.create_dir(prop['step42_rmsd']['path']) # out_log.debug('Paths:') # out_log.debug(str(paths['step42_rmsd'])) # out_log.debug('Properties:') # out_log.debug(str(prop['step42_rmsd'])+'\n') # rms_list.append(rms_pc(properties=prop['step42_rmsd'], **paths['step42_rmsd'])) # fu.remove_temp_files(['#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.xvg', '.seq']) # # xvg_dict = reduce(merge_dictionaries, rms_list) # # out_log.info('') # out_log.info('step43: gnuplot ----- Creating RMSD plot') # fu.create_dir(prop_glob['step43_gnuplot']['path']) # output_png_path = paths_glob['step43_gnuplot']['output_png_path'] # properties = prop_glob['step43_gnuplot'] # gnuplot_pc(xvg_dict, output_png_path, properties) # # png = compss_open(output_png_path) compss_barrier() elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) if len(sys.argv) >= 5: out_log.info(' Nodes: ' + sys.argv[4]) out_log.info('') out_log.info('Elapsed time: ' + str(elapsed_time) + ' seconds') out_log.info('')
def main(): start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True, level='DEBUG') paths = conf.get_paths_dic() prop = conf.get_prop_dic(global_log=out_log) out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info("Command Executed:") out_log.info(" ".join(sys.argv)) out_log.info('Workflow_path: ' + workflow_path) out_log.info('Config File: ' + yaml_path) out_log.info('System: ' + system) out_log.info('') out_log.info('step1: mmbpdb ------ Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) out_log.info(22 * ' ' + 'Selected PDB structure: ' + structure) out_log.info('step2 and 3: scw --- Check and Repair PDB') fu.create_dir(prop['step3_scw']['path']) paths['step3_scw']['input_pdb_path'] = structure out_log.debug('\nPaths:\n' + str(paths['step3_scw']) + '\nProperties:\n' + str(prop['step3_scw']) + '\n') scwrl.Scwrl4(properties=prop['step3_scw'], **paths['step3_scw']).launch() out_log.info('step4: p2g --------- Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) out_log.debug('\nPaths:\n' + str(paths['step4_p2g']) + '\nProperties:\n' + str(prop['step4_p2g']) + '\n') pdb2gmx.Pdb2gmx(properties=prop['step4_p2g'], **paths['step4_p2g']).launch() out_log.info('step5: ec ---------- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) out_log.debug('\nPaths:\n' + str(paths['step5_ec']) + '\nProperties:\n' + str(prop['step5_ec']) + '\n') editconf.Editconf(properties=prop['step5_ec'], **paths['step5_ec']).launch() out_log.info('step6: sol --------- Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) out_log.debug('\nPaths:\n' + str(paths['step6_sol']) + '\nProperties:\n' + str(prop['step6_sol']) + '\n') solvate.Solvate(properties=prop['step6_sol'], **paths['step6_sol']).launch() out_log.info('step7: gppions ----- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) out_log.debug('\nPaths:\n' + str(paths['step7_gppions']) + '\nProperties:\n' + str(prop['step7_gppions']) + '\n') grompp.Grompp(properties=prop['step7_gppions'], **paths['step7_gppions']).launch() out_log.info('step8: gio --------- Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) out_log.debug('\nPaths:\n' + str(paths['step8_gio']) + '\nProperties:\n' + str(prop['step8_gio']) + '\n') genion.Genion(properties=prop['step8_gio'], **paths['step8_gio']).launch() out_log.info('Step9: gppndx ------- Preprocessing index creation') fu.create_dir(prop['step9_gppndx']['path']) out_log.debug('\nPaths:\n' + str(paths['step9_gppndx']) + '\nProperties:\n' + str(prop['step9_gppndx']) + '\n') grompp.Grompp(properties=prop['step9_gppndx'], **paths['step9_gppndx']).launch() out_log.info('Step10: make_ndx ---- Create restrain index') fu.create_dir(prop['step10_make_ndx']['path']) out_log.debug('\nPaths:\n' + str(paths['step10_make_ndx']) + '\nProperties:\n' + str(prop['step10_make_ndx']) + '\n') make_ndx.MakeNdx(properties=prop['step10_make_ndx'], **paths['step10_make_ndx']).launch() out_log.info('Step11: genrest - Create restrain topology') fu.create_dir(prop['step11_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step11_genrestr']) + '\nProperties:\n' + str(prop['step11_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step11_genrestr'], **paths['step11_genrestr']).launch() out_log.info('step15: gppmin ------ Preprocessing: minimization') fu.create_dir(prop['step15_gppmin']['path']) out_log.debug('\nPaths:\n' + str(paths['step15_gppmin']) + '\nProperties:\n' + str(prop['step15_gppmin']) + '\n') grompp.Grompp(properties=prop['step15_gppmin'], **paths['step15_gppmin']).launch() out_log.info('step16: mdmin ------- Running: minimization') fu.create_dir(prop['step16_mdmin']['path']) out_log.debug('\nPaths:\n' + str(paths['step16_mdmin']) + '\nProperties:\n' + str(prop['step16_mdmin']) + '\n') mdrun.Mdrun(properties=prop['step16_mdmin'], **paths['step16_mdmin']).launch() out_log.info('Step17: genrestr - Create restrain topology') fu.create_dir(prop['step17_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step17_genrestr']) + '\nProperties:\n' + str(prop['step17_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step17_genrestr'], **paths['step17_genrestr']).launch() out_log.info('step18: gppsa ------- Preprocessing: simulated annealing') fu.create_dir(prop['step18_gppsa']['path']) out_log.debug('\nPaths:\n' + str(paths['step18_gppsa']) + '\nProperties:\n' + str(prop['step18_gppsa']) + '\n') grompp.Grompp(properties=prop['step18_gppsa'], **paths['step18_gppsa']).launch() out_log.info('step19: mdsa -------- Running: simulated annealing') fu.create_dir(prop['step19_mdsa']['path']) out_log.debug('\nPaths:\n' + str(paths['step19_mdsa']) + '\nProperties:\n' + str(prop['step19_mdsa']) + '\n') mdrun.Mdrun(properties=prop['step19_mdsa'], **paths['step19_mdsa']).launch() out_log.info( 'step20: gppnvt_1000 - Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step20_gppnvt_1000']['path']) out_log.debug('\nPaths:\n' + str(paths['step20_gppnvt_1000']) + '\nProperties:\n' + str(prop['step20_gppnvt_1000']) + '\n') grompp.Grompp(properties=prop['step20_gppnvt_1000'], **paths['step20_gppnvt_1000']).launch() out_log.info( 'step21: mdnvt_1000 -- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step21_mdnvt_1000']['path']) out_log.debug('\nPaths:\n' + str(paths['step21_mdnvt_1000']) + '\nProperties:\n' + str(prop['step21_mdnvt_1000']) + '\n') mdrun.Mdrun(properties=prop['step21_mdnvt_1000'], **paths['step21_mdnvt_1000']).launch() out_log.info('Step22: genrestr - Create restrain topology') fu.create_dir(prop['step22_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step22_genrestr']) + '\nProperties:\n' + str(prop['step22_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step22_genrestr'], **paths['step22_genrestr']).launch() out_log.info( 'step23: gppnvt_800 -- Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step23_gppnvt_800']['path']) out_log.debug('\nPaths:\n' + str(paths['step23_gppnvt_800']) + '\nProperties:\n' + str(prop['step23_gppnvt_800']) + '\n') grompp.Grompp(properties=prop['step23_gppnvt_800'], **paths['step23_gppnvt_800']).launch() out_log.info( 'step24: mdnvt_800 --- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step24_mdnvt_800']['path']) out_log.debug('\nPaths:\n' + str(paths['step24_mdnvt_800']) + '\nProperties:\n' + str(prop['step24_mdnvt_800']) + '\n') mdrun.Mdrun(properties=prop['step24_mdnvt_800'], **paths['step24_mdnvt_800']).launch() out_log.info('Step25: genrestr - Create restrain topology') fu.create_dir(prop['step25_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step25_genrestr']) + '\nProperties:\n' + str(prop['step25_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step25_genrestr'], **paths['step25_genrestr']).launch() out_log.info( 'step26: gppnpt_500 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step26_gppnpt_500']['path']) out_log.debug('\nPaths:\n' + str(paths['step26_gppnpt_500']) + '\nProperties:\n' + str(prop['step26_gppnpt_500']) + '\n') grompp.Grompp(properties=prop['step26_gppnpt_500'], **paths['step26_gppnpt_500']).launch() out_log.info( 'step27: mdnpt_500 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step27_mdnpt_500']['path']) out_log.debug('\nPaths:\n' + str(paths['step27_mdnpt_500']) + '\nProperties:\n' + str(prop['step27_mdnpt_500']) + '\n') mdrun.Mdrun(properties=prop['step27_mdnpt_500'], **paths['step27_mdnpt_500']).launch() out_log.info('Step28: genrestr - Create restrain topology') fu.create_dir(prop['step28_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step28_genrestr']) + '\nProperties:\n' + str(prop['step28_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step28_genrestr'], **paths['step28_genrestr']).launch() out_log.info( 'step29: gppnpt_300 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step29_gppnpt_300']['path']) out_log.debug('\nPaths:\n' + str(paths['step29_gppnpt_300']) + '\nProperties:\n' + str(prop['step29_gppnpt_300']) + '\n') grompp.Grompp(properties=prop['step29_gppnpt_300'], **paths['step29_gppnpt_300']).launch() out_log.info( 'step30: mdnpt_300 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step30_mdnpt_300']['path']) out_log.debug('\nPaths:\n' + str(paths['step30_mdnpt_300']) + '\nProperties:\n' + str(prop['step30_mdnpt_300']) + '\n') mdrun.Mdrun(properties=prop['step30_mdnpt_300'], **paths['step30_mdnpt_300']).launch() out_log.info('Step31: genrestr - Create restrain topology') fu.create_dir(prop['step31_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step31_genrestr']) + '\nProperties:\n' + str(prop['step31_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step31_genrestr'], **paths['step31_genrestr']).launch() out_log.info( 'step32: gppnpt_200 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step32_gppnpt_200']['path']) out_log.debug('\nPaths:\n' + str(paths['step32_gppnpt_200']) + '\nProperties:\n' + str(prop['step32_gppnpt_200']) + '\n') grompp.Grompp(properties=prop['step32_gppnpt_200'], **paths['step32_gppnpt_200']).launch() out_log.info( 'step33: mdnpt_200 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step33_mdnpt_200']['path']) out_log.debug('\nPaths:\n' + str(paths['step33_mdnpt_200']) + '\nProperties:\n' + str(prop['step33_mdnpt_200']) + '\n') mdrun.Mdrun(properties=prop['step33_mdnpt_200'], **paths['step33_mdnpt_200']).launch() out_log.info('Step34: genrestr - Create restrain topology') fu.create_dir(prop['step34_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step34_genrestr']) + '\nProperties:\n' + str(prop['step34_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step34_genrestr'], **paths['step34_genrestr']).launch() out_log.info( 'step35: gppnpt_100 -- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step35_gppnpt_100']['path']) out_log.debug('\nPaths:\n' + str(paths['step35_gppnpt_100']) + '\nProperties:\n' + str(prop['step35_gppnpt_100']) + '\n') grompp.Grompp(properties=prop['step35_gppnpt_100'], **paths['step35_gppnpt_100']).launch() out_log.info( 'step36: mdnpt_100 --- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step36_mdnpt_100']['path']) out_log.debug('\nPaths:\n' + str(paths['step36_mdnpt_100']) + '\nProperties:\n' + str(prop['step36_mdnpt_100']) + '\n') mdrun.Mdrun(properties=prop['step36_mdnpt_100'], **paths['step36_mdnpt_100']).launch() out_log.info('Step37: genrestr - Create restrain topology') fu.create_dir(prop['step37_genrestr']['path']) out_log.debug('\nPaths:\n' + str(paths['step37_genrestr']) + '\nProperties:\n' + str(prop['step37_genrestr']) + '\n') genrestr.Genrestr(properties=prop['step37_genrestr'], **paths['step37_genrestr']).launch() out_log.info( 'step38: gppnpt ------ Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step38_gppnpt']['path']) out_log.debug('\nPaths:\n' + str(paths['step38_gppnpt']) + '\nProperties:\n' + str(prop['step38_gppnpt']) + '\n') grompp.Grompp(properties=prop['step38_gppnpt'], **paths['step38_gppnpt']).launch() out_log.info( 'step39: mdnpt ------- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step39_mdnpt']['path']) out_log.debug('\nPaths:\n' + str(paths['step39_mdnpt']) + '\nProperties:\n' + str(prop['step39_mdnpt']) + '\n') mdrun.Mdrun(properties=prop['step39_mdnpt'], **paths['step39_mdnpt']).launch() out_log.info( 'step40: gppmd ------- Preprocessing: Free Molecular dynamics') fu.create_dir(prop['step40_gppmd']['path']) out_log.debug('\nPaths:\n' + str(paths['step40_gppmd']) + '\nProperties:\n' + str(prop['step40_gppmd']) + '\n') grompp.Grompp(properties=prop['step40_gppmd'], **paths['step40_gppmd']).launch() out_log.info('step41: md ---------- Running: Free Molecular dynamics') fu.create_dir(prop['step41_md']['path']) out_log.debug('\nPaths:\n' + str(paths['step41_md']) + '\nProperties:\n' + str(prop['step41_md']) + '\n') mdrun.Mdrun(properties=prop['step41_md'], **paths['step41_md']).launch() fu.remove_temp_files([ '#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.xvg', '.seq' ]) elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) if len(sys.argv) >= 5: out_log.info(' Nodes: ' + sys.argv[4]) out_log.info('') out_log.info('Elapsed time: ' + str(elapsed_time) + ' seconds') out_log.info('')
def main(): start_time = time.time() yaml_path=sys.argv[1] system=sys.argv[2] n_mutations=sys.argv[3] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths_glob = conf.get_paths_dic() prop_glob = conf.get_prop_dic() out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info("Command Executed:") out_log.info(" ".join(sys.argv)) out_log.info('Workflow_path: '+workflow_path) out_log.info('Config File: '+yaml_path) out_log.info('System: '+system) out_log.info('Mutations limit: '+n_mutations) if len(sys.argv) >= 5: out_log.info('Nodes: '+sys.argv[4]) out_log.info('') out_log.info( 'step1: mmbpdb -- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info( ' Selected PDB code: ' + prop_glob['step1_mmbpdb']['pdb_code']) fu.create_dir(prop_glob['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop_glob['step1_mmbpdb']['pdb_code'], paths_glob['step1_mmbpdb']['output_pdb_path']) structure = paths_glob['step1_mmbpdb']['output_pdb_path'] out_log.info( 'step2: mmbuniprot -- Get mutations') mutations = conf.properties.get('input_mapped_mutations_list', None) if mutations is None or len(mutations) < 7: mmbuniprot = uniprot.MmbVariants(prop_glob['step1_mmbpdb']['pdb_code']) mutations = mmbuniprot.get_pdb_variants() if mutations is None or len(mutations) == 0: return else: mutations = [m.strip() for m in conf.properties.get('input_mapped_mutations_list').split(',')] mutations_limit = min(len(mutations), int(n_mutations)) out_log.info('') out_log.info('Number of mutations to be modelled: ' + str(mutations_limit)) rms_list = [] mutations_counter = 0 for mut in mutations: if mutations_counter == mutations_limit: break mutations_counter += 1 paths = conf.get_paths_dic(mut) prop = conf.get_prop_dic(mut, global_log=out_log) out_log.info('') out_log.info('-------------------------') out_log.info(str(mutations_counter) + '/' + str(mutations_limit) + ' ' + mut) out_log.info('-------------------------') out_log.info('') out_log.info('step3: scw ------ Model mutation') fu.create_dir(prop['step3_scw']['path']) paths['step3_scw']['input_pdb_path']=structure scwrl.Scwrl4(properties=prop['step3_scw'], **paths['step3_scw']).launch() out_log.info('step4: p2g ------ Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) pdb2gmx.Pdb2gmx(properties=prop['step4_p2g'], **paths['step4_p2g']).launch() out_log.info('step5: ec ------- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) editconf.Editconf(properties=prop['step5_ec'], **paths['step5_ec']).launch() out_log.info('step6: sol ------ Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) solvate.Solvate(properties=prop['step6_sol'], **paths['step6_sol']).launch() out_log.info('step7: gppions -- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) grompp.Grompp(properties=prop['step7_gppions'], **paths['step7_gppions']).launch() out_log.info('step8: gio ------ Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) genion.Genion(properties=prop['step8_gio'], **paths['step8_gio']).launch() out_log.info('step9: gppmin --- Preprocessing: Energy minimization') fu.create_dir(prop['step9_gppmin']['path']) grompp.Grompp(properties=prop['step9_gppmin'], **paths['step9_gppmin']).launch() out_log.info('step10: mdmin ---- Running: Energy minimization') fu.create_dir(prop['step10_mdmin']['path']) mdrun.Mdrun(properties=prop['step10_mdmin'], **paths['step10_mdmin']).launch() out_log.info('step11: gppnvt --- Preprocessing: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step11_gppnvt']['path']) grompp.Grompp(properties=prop['step11_gppnvt'], **paths['step11_gppnvt']).launch() out_log.info('step12: mdnvt ---- Running: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step12_mdnvt']['path']) mdrun.Mdrun(properties=prop['step12_mdnvt'], **paths['step12_mdnvt']).launch() out_log.info('step13: gppnpt --- Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step13_gppnpt']['path']) grompp.Grompp(properties=prop['step13_gppnpt'], **paths['step13_gppnpt']).launch() out_log.info('step14: mdnpt ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step14_mdnpt']['path']) mdrun.Mdrun(properties=prop['step14_mdnpt'], **paths['step14_mdnpt']).launch() out_log.info('step15: gppeq ---- Preprocessing: 1ns Molecular dynamics Equilibration') fu.create_dir(prop['step15_gppeq']['path']) grompp.Grompp(properties=prop['step15_gppeq'], **paths['step15_gppeq']).launch() out_log.info('step16: mdeq ----- Running: Free Molecular dynamics Equilibration') fu.create_dir(prop['step16_mdeq']['path']) mdrun.Mdrun(properties=prop['step16_mdeq'], **paths['step16_mdeq']).launch() out_log.info('step17: rmsd ----- Computing RMSD') fu.create_dir(prop['step17_rmsd']['path']) rms_list.append(rms.Rms(properties=prop['step17_rmsd'], **paths['step17_rmsd']).launch()) removed_list = fu.remove_temp_files(['#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.xvg', '.grp', '.seq']) xvg_dict=reduce(lambda a, b: dict(a, **b), rms_list) out_log.info('step18: gnuplot ----- Creating RMSD plot') fu.create_dir(prop_glob['step18_gnuplot']['path']) gnuplot.Gnuplot(input_xvg_path_dict=xvg_dict, properties=prop_glob['step18_gnuplot'], **paths_glob['step18_gnuplot']).launch() elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: '+workflow_path) out_log.info(' Config File: '+yaml_path) out_log.info(' System: '+system) if len(sys.argv) >= 5: out_log.info(' Nodes: '+sys.argv[4]) out_log.info('') out_log.info('Elapsed time: '+str(elapsed_time)+' seconds') out_log.info('')
def main(): start_time = time.time() yaml_path=sys.argv[1] system=sys.argv[2] n_mutations=sys.argv[3] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths_glob = conf.get_paths_dic() prop_glob = conf.get_prop_dic() out_log.info('') out_log.info('_______GROMACS FULL WORKFLOW_______') out_log.info('') out_log.info("Command Executed:") out_log.info(" ".join(sys.argv)) out_log.info('Workflow_path: '+workflow_path) out_log.info('Config File: '+yaml_path) out_log.info('System: '+system) out_log.info('Mutations limit: '+n_mutations) if len(sys.argv) >= 5: out_log.info('Nodes: '+sys.argv[4]) out_log.info('') out_log.info( 'step1: mmbpdb -- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info( ' Selected PDB code: ' + prop_glob['step1_mmbpdb']['pdb_code']) fu.create_dir(prop_glob['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop_glob['step1_mmbpdb']['pdb_code'], paths_glob['step1_mmbpdb']['output_pdb_path']) structure = paths_glob['step1_mmbpdb']['output_pdb_path'] out_log.info( 'step2: mmbuniprot -- Get mutations') mutations = conf.properties.get('input_mapped_mutations_list', None) if mutations is None or len(mutations) < 7: mmbuniprot = uniprot.MmbVariants(prop_glob['step1_mmbpdb']['pdb_code']) mutations = mmbuniprot.get_pdb_variants() if mutations is None or len(mutations) == 0: return else: mutations = [m.strip() for m in conf.properties.get('input_mapped_mutations_list').split(',')] mutations_limit = min(len(mutations), int(n_mutations)) out_log.info('') out_log.info('Number of mutations to be modelled: ' + str(mutations_limit)) rms_list = [] mutations_counter = 0 for mut in mutations: if mutations_counter == mutations_limit: break mutations_counter += 1 mut = mut if not mut.startswith('*') else mut.replace('*', 'ALL') paths = conf.get_paths_dic(mut) prop = conf.get_prop_dic(mut, global_log=out_log) out_log.info('') out_log.info('-------------------------') out_log.info(str(mutations_counter) + '/' + str(mutations_limit) + ' ' + mut) out_log.info('-------------------------') out_log.info('') out_log.info('step3: scw --------- Model mutation') fu.create_dir(prop['step3_scw']['path']) paths['step3_scw']['input_pdb_path']=structure scwrl.Scwrl4(properties=prop['step3_scw'], **paths['step3_scw']).launch() out_log.info('step4: p2g --------- Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) pdb2gmx.Pdb2gmx(properties=prop['step4_p2g'], **paths['step4_p2g']).launch() out_log.info('step5: ec ---------- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) editconf.Editconf(properties=prop['step5_ec'], **paths['step5_ec']).launch() out_log.info('step6: sol --------- Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) solvate.Solvate(properties=prop['step6_sol'], **paths['step6_sol']).launch() out_log.info('step7: gppions ----- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) grompp.Grompp(properties=prop['step7_gppions'], **paths['step7_gppions']).launch() out_log.info('step8: gio --------- Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) genion.Genion(properties=prop['step8_gio'], **paths['step8_gio']).launch() out_log.info('Step9: gppndx ------- Preprocessing index creation') fu.create_dir(prop['step9_gppndx']['path']) grompp.Grompp(properties=prop['step9_gppndx'], **paths['step9_gppndx']).launch() out_log.info('Step10: make_ndx ---- Create restrain index') fu.create_dir(prop['step10_make_ndx']['path']) make_ndx.MakeNdx(properties=prop['step10_make_ndx'], **paths['step10_make_ndx']).launch() out_log.info('Step11: ndx2resttop - Create restrain topology') fu.create_dir(prop['step11_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step11_ndx2resttop'], **paths['step11_ndx2resttop']).launch() out_log.info('step12: gppresmin Preprocessing: Mutated residue minimization') fu.create_dir(prop['step12_gppresmin']['path']) grompp.Grompp(properties=prop['step12_gppresmin'], **paths['step12_gppresmin']).launch() out_log.info('step13: mdresmin ---- Running: Mutated residue minimization') fu.create_dir(prop['step13_mdresmin']['path']) mdrun.Mdrun(properties=prop['step13_mdresmin'], **paths['step13_mdresmin']).launch() out_log.info('Step14: ndx2resttop - Create restrain topology') fu.create_dir(prop['step14_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step14_ndx2resttop'], **paths['step14_ndx2resttop']).launch() out_log.info('step15: gppmin Preprocessing: minimization') fu.create_dir(prop['step15_gppmin']['path']) grompp.Grompp(properties=prop['step15_gppmin'], **paths['step15_gppmin']).launch() out_log.info('step16: mdmin ---- Running: minimization') fu.create_dir(prop['step16_mdmin']['path']) mdrun.Mdrun(properties=prop['step16_mdmin'], **paths['step16_mdmin']).launch() out_log.info('Step17: ndx2resttop - Create restrain topology') fu.create_dir(prop['step17_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step17_ndx2resttop'], **paths['step17_ndx2resttop']).launch() out_log.info('step18: gppsa Preprocessing: simulated annealing') fu.create_dir(prop['step18_gppsa']['path']) grompp.Grompp(properties=prop['step18_gppsa'], **paths['step18_gppsa']).launch() out_log.info('step19: mdsa ---- Running: simulated annealing') fu.create_dir(prop['step19_mdsa']['path']) mdrun.Mdrun(properties=prop['step19_mdsa'], **paths['step19_mdsa']).launch() out_log.info('step20: gppnvt_1000 Preprocessing: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step20_gppnvt_1000']['path']) grompp.Grompp(properties=prop['step20_gppnvt_1000'], **paths['step20_gppnvt_1000']).launch() out_log.info('step21: mdnvt_1000 ---- Running: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step21_mdnvt_1000']['path']) mdrun.Mdrun(properties=prop['step21_mdnvt_1000'], **paths['step21_mdnvt_1000']).launch() out_log.info('Step22: ndx2resttop - Create restrain topology') fu.create_dir(prop['step22_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step22_ndx2resttop'], **paths['step22_ndx2resttop']).launch() out_log.info('step23: gppnvt_800 Preprocessing: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step23_gppnvt_800']['path']) grompp.Grompp(properties=prop['step23_gppnvt_800'], **paths['step23_gppnvt_800']).launch() out_log.info('step24: mdnvt_800 ---- Running: nvt constant number of molecules, volume and temp') fu.create_dir(prop['step24_mdnvt_800']['path']) mdrun.Mdrun(properties=prop['step24_mdnvt_800'], **paths['step24_mdnvt_800']).launch() out_log.info('Step25: ndx2resttop - Create restrain topology') fu.create_dir(prop['step25_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step25_ndx2resttop'], **paths['step25_ndx2resttop']).launch() out_log.info('step26: gppnpt_500 Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step26_gppnpt_500']['path']) grompp.Grompp(properties=prop['step26_gppnpt_500'], **paths['step26_gppnpt_500']).launch() out_log.info('step27: mdnpt_500 ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step27_mdnpt_500']['path']) mdrun.Mdrun(properties=prop['step27_mdnpt_500'], **paths['step27_mdnpt_500']).launch() out_log.info('Step28: ndx2resttop - Create restrain topology') fu.create_dir(prop['step28_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step28_ndx2resttop'], **paths['step28_ndx2resttop']).launch() out_log.info('step29: gppnpt_300 Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step29_gppnpt_300']['path']) grompp.Grompp(properties=prop['step29_gppnpt_300'], **paths['step29_gppnpt_300']).launch() out_log.info('step30: mdnpt_300 ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step30_mdnpt_300']['path']) mdrun.Mdrun(properties=prop['step30_mdnpt_300'], **paths['step30_mdnpt_300']).launch() out_log.info('Step31: ndx2resttop - Create restrain topology') fu.create_dir(prop['step31_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step31_ndx2resttop'], **paths['step31_ndx2resttop']).launch() out_log.info('step32: gppnpt_200 Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step32_gppnpt_200']['path']) grompp.Grompp(properties=prop['step32_gppnpt_200'], **paths['step32_gppnpt_200']).launch() out_log.info('step33: mdnpt_200 ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step33_mdnpt_200']['path']) mdrun.Mdrun(properties=prop['step33_mdnpt_200'], **paths['step33_mdnpt_200']).launch() out_log.info('Step34: ndx2resttop - Create restrain topology') fu.create_dir(prop['step34_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step34_ndx2resttop'], **paths['step34_ndx2resttop']).launch() out_log.info('step35: gppnpt_100 Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step35_gppnpt_100']['path']) grompp.Grompp(properties=prop['step35_gppnpt_100'], **paths['step35_gppnpt_100']).launch() out_log.info('step36: mdnpt_100 ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step36_mdnpt_100']['path']) mdrun.Mdrun(properties=prop['step36_mdnpt_100'], **paths['step36_mdnpt_100']).launch() out_log.info('Step37: ndx2resttop - Create restrain topology') fu.create_dir(prop['step37_ndx2resttop']['path']) ndx2resttop.Ndx2resttop(properties=prop['step37_ndx2resttop'], **paths['step37_ndx2resttop']).launch() out_log.info('step38: gppnpt - Preprocessing: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step38_gppnpt']['path']) grompp.Grompp(properties=prop['step38_gppnpt'], **paths['step38_gppnpt']).launch() out_log.info('step39: mdnpt ---- Running: npt constant number of molecules, pressure and temp') fu.create_dir(prop['step39_mdnpt']['path']) mdrun.Mdrun(properties=prop['step39_mdnpt'], **paths['step39_mdnpt']).launch() fu.remove_temp_files(['#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.xvg', '.seq']) elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: '+workflow_path) out_log.info(' Config File: '+yaml_path) out_log.info(' System: '+system) if len(sys.argv) >= 5: out_log.info(' Nodes: '+sys.argv[4]) out_log.info('') out_log.info('Elapsed time: '+str(elapsed_time)+' seconds') out_log.info('')
def main(): start_time = time.time() yaml_path = sys.argv[1] system = sys.argv[2] conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths = conf.get_paths_dic() prop = conf.get_prop_dic(global_log=out_log) out_log.info('') out_log.info('_______MD SETUP FULL WORKFLOW_______') out_log.info('') out_log.info('step1: mmbpdb --- Get PDB') structure = conf.properties[system].get('initial_structure_pdb_path', None) if structure is None or not os.path.isfile(structure): out_log.info(' Selected PDB code: ' + prop['step1_mmbpdb']['pdb_code']) fu.create_dir(prop['step1_mmbpdb']['path']) pdb.MmbPdb().get_pdb(prop['step1_mmbpdb']['pdb_code'], paths['step1_mmbpdb']['output_pdb_path']) structure = paths['step1_mmbpdb']['output_pdb_path'] out_log.info('step2: p2g ------ Create gromacs topology') fu.create_dir(prop['step2_p2g']['path']) pdb2gmx.Pdb2gmx(properties=prop['step2_p2g'], **paths['step2_p2g']).launch() out_log.info('step3: ec ------- Define box dimensions') fu.create_dir(prop['step3_ec']['path']) editconf.Editconf(properties=prop['step3_ec'], **paths['step3_ec']).launch() out_log.info('step4: sol ------ Fill the box with water molecules') fu.create_dir(prop['step4_sol']['path']) solvate.Solvate(properties=prop['step4_sol'], **paths['step4_sol']).launch() out_log.info('step5: gppions -- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step5_gppions']['path']) grompp.Grompp(properties=prop['step5_gppions'], **paths['step5_gppions']).launch() out_log.info('step6: gio ------ Running: Adding monoatomic ions') fu.create_dir(prop['step6_gio']['path']) genion.Genion(properties=prop['step6_gio'], **paths['step6_gio']).launch() out_log.info('step7: gppmin --- Preprocessing: Energy minimization') fu.create_dir(prop['step7_gppmin']['path']) grompp.Grompp(properties=prop['step7_gppmin'], **paths['step7_gppmin']).launch() out_log.info('step8: mdmin ---- Running: Energy minimization') fu.create_dir(prop['step8_mdmin']['path']) mdrun.Mdrun(properties=prop['step8_mdmin'], **paths['step8_mdmin']).launch() out_log.info( 'step9: gppnvt --- Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step9_gppnvt']['path']) grompp.Grompp(properties=prop['step9_gppnvt'], **paths['step9_gppnvt']).launch() out_log.info( 'step10: mdnvt ---- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step10_mdnvt']['path']) mdrun.Mdrun(properties=prop['step10_mdnvt'], **paths['step10_mdnvt']).launch() out_log.info( 'step11: gppnpt --- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step11_gppnpt']['path']) grompp.Grompp(properties=prop['step11_gppnpt'], **paths['step11_gppnpt']).launch() out_log.info( 'step12: mdnpt ---- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step12_mdnpt']['path']) mdrun.Mdrun(properties=prop['step12_mdnpt'], **paths['step12_mdnpt']).launch() out_log.info( 'step13: gppeq ---- Preprocessing: Molecular dynamics Equilibration') fu.create_dir(prop['step13_gppeq']['path']) grompp.Grompp(properties=prop['step13_gppeq'], **paths['step13_gppeq']).launch() out_log.info( 'step14: mdeq ----- Running: Molecular dynamics Equilibration') fu.create_dir(prop['step14_mdeq']['path']) mdrun.Mdrun(properties=prop['step14_mdeq'], **paths['step14_mdeq']).launch() #Create setupfiles dir and copy files setupfiles_path = os.path.join(workflow_path, 'setupfiles') fu.create_dir(setupfiles_path) shutil.copy(paths['step14_mdeq']['output_gro_path'], os.path.join(setupfiles_path, 'md_setup.gro')) shutil.copy(paths['step14_mdeq']['output_cpt_path'], os.path.join(setupfiles_path, 'md_setup.cpt')) shutil.copy(paths['step6_gio']['output_top_zip_path'], os.path.join(setupfiles_path, 'md_setup.zip')) removed_list = fu.remove_temp_files([ '#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp' ]) out_log.info('') out_log.info('Removing unwanted files: ') for removed_file in removed_list: out_log.info(' X ' + removed_file) elapsed_time = time.time() - start_time out_log.info('') out_log.info('') out_log.info('Execution sucessful: ') out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) if len(sys.argv) >= 4: out_log.info(' Nodes: ' + sys.argv[3]) out_log.info('') out_log.info('Elapsed time: ' + str(elapsed_time) + ' seconds') out_log.info('')
def main(): start_time = time.time() structure_pdb_path_in = os.path.abspath(sys.argv[1]) structure_pdb_path_out = os.path.abspath(sys.argv[2]) yaml_path = '/home/user/pymdsetup/workflows/conf/conf_mug_refinement.yaml' system = 'mug_pymdsetup' conf = settings.YamlReader(yaml_path, system) workflow_path = conf.properties[system]['workflow_path'] fu.create_dir(os.path.abspath(workflow_path)) out_log, _ = fu.get_logs(path=workflow_path, console=True) paths = conf.get_paths_dic() prop = conf.get_prop_dic(global_log=out_log) #TODO: Source of problems #Change directories always creates problems os.chdir(workflow_path) out_log.info('\n\n_______MUG REFINEMENT_______\n\n') out_log.info('in ----------- Get PDB structure') fu.create_dir(prop['step1_mmbpdb']['path']) shutil.copy(structure_pdb_path_in, paths['step1_mmbpdb']['output_pdb_path']) out_log.info('sed ---------- Replacing atom names') sed_path = opj(workflow_path, 'step2_sed') fu.create_dir(sed_path) sed_pdb_path = opj(sed_path, 'sed_replaced.pdb') shutil.copy(paths['step1_mmbpdb']['output_pdb_path'], sed_pdb_path) cmd = ['sed', '-i', "'s/ O1P / OP1 /g'", sed_pdb_path] sed1_out_log, sed1_err_log = fu.get_logs(path=sed_path, step='step2_sed1') command = cmd_wrapper.CmdWrapper(cmd, sed1_out_log, sed1_err_log) command.launch() cmd = ['sed', '-i', "'s/ O2P / OP2 /g'", sed_pdb_path] sed2_out_log, sed2_err_log = fu.get_logs(path=sed_path, step='step2_sed2') command = cmd_wrapper.CmdWrapper(cmd, sed2_out_log, sed2_err_log) command.launch() out_log.info('pdb2gmx ------ Create gromacs topology') fu.create_dir(prop['step4_p2g']['path']) pdb2gmx.Pdb2gmx(properties=prop['step4_p2g'], input_structure_pdb_path=sed_pdb_path, output_gro_path=paths['step4_p2g']['output_gro_path'], output_top_zip_path=paths['step4_p2g'] ['output_top_zip_path']).launch() out_log.info('editconf ----- Define box dimensions') fu.create_dir(prop['step5_ec']['path']) editconf.Editconf(properties=prop['step5_ec'], **paths['step5_ec']).launch() out_log.info('solvate ------ Fill the box with water molecules') fu.create_dir(prop['step6_sol']['path']) solvate.Solvate(properties=prop['step6_sol'], **paths['step6_sol']).launch() out_log.info('grompp_ions -- Preprocessing: Adding monoatomic ions') fu.create_dir(prop['step7_gppions']['path']) grompp.Grompp(properties=prop['step7_gppions'], **paths['step7_gppions']).launch() out_log.info('genion ------- Running: Adding monoatomic ions') fu.create_dir(prop['step8_gio']['path']) genion.Genion(properties=prop['step8_gio'], **paths['step8_gio']).launch() out_log.info('grompp_min --- Preprocessing: Energy minimization') fu.create_dir(prop['step9_gppmin']['path']) grompp.Grompp(properties=prop['step9_gppmin'], **paths['step9_gppmin']).launch() out_log.info('mdrun_min ---- Running: Energy minimization') fu.create_dir(prop['step10_mdmin']['path']) mdrun.Mdrun(properties=prop['step10_mdmin'], **paths['step10_mdmin']).launch() out_log.info( 'grompp_nvt --- Preprocessing: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step11_gppnvt']['path']) grompp.Grompp(properties=prop['step11_gppnvt'], **paths['step11_gppnvt']).launch() out_log.info( 'mdrun_nvt ---- Running: nvt constant number of molecules, volume and temp' ) fu.create_dir(prop['step12_mdnvt']['path']) mdrun.Mdrun(properties=prop['step12_mdnvt'], **paths['step12_mdnvt']).launch() out_log.info( 'grompp_npt --- Preprocessing: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step13_gppnpt']['path']) grompp.Grompp(properties=prop['step13_gppnpt'], **paths['step13_gppnpt']).launch() out_log.info( 'mdrun_npt ---- Running: npt constant number of molecules, pressure and temp' ) fu.create_dir(prop['step14_mdnpt']['path']) mdrun.Mdrun(properties=prop['step14_mdnpt'], **paths['step14_mdnpt']).launch() out_log.info( 'grompp_eq ---- Preprocessing: 100ps Molecular dynamics Equilibration') fu.create_dir(prop['step15_gppeq']['path']) grompp.Grompp(properties=prop['step15_gppeq'], **paths['step15_gppeq']).launch() out_log.info( 'mdrun_eq ----- Running: 100ps Molecular dynamics Equilibration') fu.create_dir(prop['step16_mdeq']['path']) mdrun.Mdrun(properties=prop['step16_mdeq'], **paths['step16_mdeq']).launch() out_log.info('trjconv ------ Extract last snapshot') step17_path = opj(workflow_path, 'step17_trjconv') step17_index = opj(step17_path, 'step17_make_ndx.ndx') step17_pdb = opj(step17_path, 'step17_trjconv.pdb') fu.create_dir(step17_path) #TODO: source of problems # should create a wrapper for the make_ndx tool and call it using subprocess os.system('printf "! \\"Water_and_ions\\" \nq\n" | ' + prop['step16_mdeq']['gmx_path'] + ' make_ndx -f ' + paths['step16_mdeq']['output_gro_path'] + ' -o ' + step17_index + ' > ' + opj(step17_path, 'make_ndx.out') + ' 2> ' + opj(step17_path, 'make_ndx.err')) cmd = [ 'echo', 'Protein_DNA', '|', prop['step16_mdeq']['gmx_path'], "trjconv", "-s", paths['step15_gppeq']['output_tpr_path'], "-f", paths['step16_mdeq']['output_trr_path'], "-o", step17_pdb, "-n", step17_index, "-dump", '1' ] step17_out_log, step17_err_log = fu.get_logs(path=step17_path, step='step17_trjconv') command = cmd_wrapper.CmdWrapper(cmd, step17_out_log, step17_err_log) command.launch() elapsed_time = time.time() - start_time removed_list = fu.remove_temp_files([ '#', '.top', '.plotscript', '.edr', '.xtc', '.itp', '.top', '.log', '.pdb', '.cpt', '.mdp', '.ndx' ]) shutil.copy(step17_pdb, structure_pdb_path_out) out_log.info('') out_log.info('Removing unwanted files: ') for removed_file in removed_list: out_log.info(' X ' + removed_file) out_log.info('\n\nExecution sucessful: ') out_log.info(' Output_pdb_path: ' + structure_pdb_path_out) out_log.info(' Workflow_path: ' + workflow_path) out_log.info(' Config File: ' + yaml_path) out_log.info(' System: ' + system) out_log.info(' Elapsed time: ' + str(elapsed_time) + 'seconds')