Пример #1
0
def grompp_pc(input_gro_path, input_top_zip_path, output_tpr_path, properties,
              **kwargs):
    grompp.Grompp(input_gro_path=input_gro_path,
                  input_top_zip_path=input_top_zip_path,
                  output_tpr_path=output_tpr_path,
                  properties=properties,
                  **kwargs).launch()
Пример #2
0
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('')
Пример #3
0
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('')
Пример #4
0
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('')
Пример #5
0
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('')
Пример #6
0
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('')
Пример #7
0
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')