def launch(self): """Launches the execution of the GROMACS editconf module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [ gmx, 'make_ndx', '-f', self.input_structure_path, '-o', self.output_ndx_path ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.mpirun: cmd.append('<<<') cmd.append('\"' + self.selection + '\"') else: cmd.insert(0, '|') cmd.insert(0, '\"' + self.selection + '\"') cmd.insert(0, 'echo') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the GNUPLOT binary. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) self.output_plotscript_path = fu.add_step_mutation_path_to_name(self.output_plotscript_path, self.step, self.mutation) # Create the input script for gnuplot xvg_file_list = [] with open(self.output_plotscript_path, 'w') as ps: ps.write('set term '+self.term+'\n') ps.write('set output "' + self.output_png_path + '"'+'\n') ps.write('plot') for k, v in self.input_xvg_path_dict.iteritems(): if isinstance(v, basestring) and os.path.isfile(v): ps.write(' "' + v + '" u 1:3 w lp t "' + k + '",') else: xvg_file = fu.add_step_mutation_path_to_name(k + '.xvg', self.step, self.mutation) np.savetxt(xvg_file, v, fmt='%4.7f') out_log.info('Creating file: '+os.path.abspath(xvg_file)) xvg_file_list.append(os.path.abspath(xvg_file)) ps.write(' "' + xvg_file + '" u 0:2 w lp t "' + k + '", ') gplot = 'gnuplot' if self.gnuplot_path is None else self.gnuplot_path cmd = [gplot, self.output_plotscript_path] command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) returncode = command.launch() return returncode
def launch(self): """Launches the execution of the GROMACS rms module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) gmx = 'gmx' if self.gmx_path is 'None' else self.gmx_path cmd = [ gmx, 'rms', '-xvg', 'none', '-s', self.input_gro_path, '-f', self.input_trr_path, '-o', self.output_xvg_path ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') cmd.append('<<<') cmd.append('\"' + "$'0\n0\n'" + '\"') else: cmd.insert(0, '|') cmd.insert(0, '\"' + '0 0' + '\"') cmd.insert(0, 'echo') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) command.launch() xvg = self.output_xvg_path if os.path.isfile( self.output_xvg_path) else ntpath.basename(self.output_xvg_path) self.mutation = '' if self.mutation is None else self.mutation return {self.mutation: np.loadtxt(xvg)}
def launch(self): """Launches the execution of the GROMACS solvate module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) self.output_top_path = fu.add_step_mutation_path_to_name(self.output_top_path, self.step, self.mutation) # Unzip topology to topology_out fu.unzip_top(zip_file=self.input_top_zip_path, top_file=self.output_top_path) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [gmx, 'solvate', '-cp', self.input_solute_gro_path, '-cs', self.input_solvent_gro_path, '-o', self.output_gro_path, '-p', self.output_top_path] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) returncode = command.launch() with open(self.output_top_path) as topology_file: out_log.info('Last 5 lines of new top file: ') lines = topology_file.readlines() for index in [-i for i in range(5,0,-1)]: out_log.info(lines[index]) # zip new_topology fu.zip_top(self.output_top_path, self.output_top_zip_path, remove_files=True) return returncode
def launch(self): # using cmd_wrapper out_log, err_log = fu.get_logs(path=self.properties['path'], step=self.properties['step']) cmd = ["python ", self.script, self.res_lib, self.pdb_in, self.pdb_out] command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) command.launch()
def launch(self): """Launches the execution of the GROMACS rms module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) gmx = 'gmx' if self.gmx_path is 'None' else self.gmx_path cmd = [gmx, 'cluster', '-s', self.input_gro_path, '-f', self.input_xtc_path, '-cl', self.output_pdb_path, '-cutoff', str(self.cutoff)] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') cmd.append('<<<') cmd.append('\"'+"$'0\n0\n'"+'\"') else: cmd.insert(0, '|') cmd.insert(0, '\"'+'1 1'+'\"') cmd.insert(0, 'echo') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the MGLTools prepare_receptor module.""" out_log, err_log = fu.get_logs(path=self.path) cmd = [self.executor_path, self.script_path, '-r', self.input_receptor_pdb_path, '-o', self.output_receptor_pdbqt_path] command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the GROMACS genion module. """ if self.global_log is not None: if self.concentration: self.global_log.info(19 * ' ' + 'To reach up ' + str(self.concentration) + ' mol/litre concentration') out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) self.output_top_path = fu.add_step_mutation_path_to_name( self.output_top_path, self.step, self.mutation) # Unzip topology to topology_out fu.unzip_top(zip_file=self.input_top_zip_path, top_file=self.output_top_path) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [ gmx, 'genion', '-s', self.input_tpr_path, '-o', self.output_gro_path, '-p', self.output_top_path ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.neutral: cmd.append('-neutral') if self.concentration: cmd.append('-conc') cmd.append(str(self.concentration)) if self.seed is not None: cmd.append('-seed') cmd.append(str(self.seed)) if self.mpirun: cmd.append('<<<') cmd.append('\"' + self.replaced_group + '\"') else: cmd.insert(0, '|') cmd.insert(0, '\"' + self.replaced_group + '\"') cmd.insert(0, 'echo') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) returncode = command.launch() # zip new_topology fu.zip_top(self.output_top_path, self.output_top_zip_path, remove_files=True) return returncode
def launch(self): """Launches the execution of the SCWRL binary. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mut, step=self.step) if self.mutation is not None: # Read structure with Biopython parser = PDBParser(PERMISSIVE=1) st = parser.get_structure( 's', self.input_pdb_path) # s random id never used # Remove the side chain of the AA to be mutated if self.mutation['chain'] != '*': chains = [self.mutation['chain']] else: chains = [chain.id for chain in st[0]] resnum = int(self.mutation['resnum']) for chain in chains: residue = st[0][chain][(' ', resnum, ' ')] backbone_atoms = ['N', 'CA', 'C', 'O', 'CB'] not_backbone_atoms = [] # The following formula does not work. Biopython bug? # for atom in residue: # if atom.id not in backbone_atoms: # residue.detach_child(atom.id) for atom in residue: if atom.id not in backbone_atoms: not_backbone_atoms.append(atom) for atom in not_backbone_atoms: residue.detach_child(atom.id) # Change residue name residue.resname = self.mutation['mt'].upper() # Write resultant structure w = PDBIO() w.set_structure(st) prepared_file_path = self.mut + self.step + 'prepared.pdb' w.save(prepared_file_path) else: prepared_file_path = self.input_pdb_path scrwl = 'Scwrl4' if self.scwrl4_path is None else self.scwrl4_path cmd = [scrwl, '-i', prepared_file_path, '-o', self.output_pdb_path] command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self, deleteTmpDir=True): # using cmd_wrapper self.out_log, self.err_log = fu.get_logs(path=self.properties['path'], step=self.properties['step']) command = cmd_wrapper.CmdWrapper(self.run.setup(), self.out_log, self.err_log) command.launch() # using original CMIP execute # self.result = self.run.execute self.result = Result(self.run.tmpdir, self.run.files) if deleteTmpDir: self.run.rmTmpDir() return self.result
def launch(self): """Launches the execution of the GROMACS mdrun module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [ gmx, 'mdrun', '-s', self.input_tpr_path, '-c', self.output_gro_path ] if self.output_trr_path is not None: cmd.append('-o') cmd.append(self.output_trr_path) if self.output_xtc_path is not None: cmd.append('-x') cmd.append(self.output_xtc_path) if self.output_edr_path is not None: cmd.append('-e') cmd.append(self.output_edr_path) if self.output_cpt_path is not None: cmd.append('-cpo') cmd.append(self.output_cpt_path) if self.output_log_path is not None: cmd.append('-g') cmd.append(self.output_log_path) if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') #Number of threads to run (0 is guess) if not self.num_threads is None: cmd.append('-nt') cmd.append(str(self.num_threads)) if not self.ntmpi is None: cmd.append('-ntmpi') cmd.append(str(self.ntmpi)) if not self.ntomp is None: cmd.append('-ntomp') cmd.append(str(self.ntomp)) if not self.gpu_id is None: cmd.append('-gpu_id') cmd.append(str(self.gpu_id)) command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the AutoDock Vina docking""" out_log, err_log = fu.get_logs(path=self.path, step=self.step) vina = 'vina' if self.vina_path is None else self.vina_path x0, y0, z0, sidex, sidey, sidez = AutoDockVina._calculate_box( self.box_path) cmd = [ vina, '--ligand', self.ligand_pdbqt_path, '--receptor', self.receptor_pdbqt_path, '--center_x=' + x0, '--center_y=' + y0, '--center_z=' + z0, '--size_x=' + sidex, '--size_y=' + sidey, '--size_z=' + sidez, '--out', self.output_path, '--log', self.log_file ] command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the GROMACS pdb2gmx module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) self.output_top_path = fu.add_step_mutation_path_to_name( self.output_top_path, self.step, self.mutation) gmx = "gmx" if self.gmx_path is None else self.gmx_path cmd = [ gmx, "pdb2gmx", "-f", self.input_structure_pdb_path, "-o", self.output_gro_path, "-p", self.output_top_path, "-water", self.water_type, "-ff", self.force_field ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.output_itp_path is not None: self.output_itp_path = self.output_itp_path if self.step is None else self.step + '_' + self.output_itp_path self.output_itp_path = self.output_itp_path if self.mutation is None else self.mutation + '_' + self.output_itp_path cmd.append("-i") cmd.append(self.output_itp_path) if self.ignh: cmd.append("-ignh") command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) returncode = command.launch() #Remove comment (first line) from gro file with open(self.output_gro_path, 'r') as fin: data = fin.read().splitlines(True) data[0] = 'Created with pdb2gmx building block\n' with open(self.output_gro_path, 'w') as fout: fout.writelines(data) # zip topology fu.zip_top(self.output_top_path, self.output_top_zip_path, remove_files=True) return returncode
def launch(self): """Launches the execution of the GROMACS grompp module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) mdp_file_path = self.create_mdp( ) if self.input_mdp_path is None else self.input_mdp_path if self.global_log is not None: md = self.mdp.get('type', 'minimization') if md != 'index' and md != 'free': self.global_log.info(22 * ' ' + 'Will run a ' + md + ' md of ' + str(self.nsteps) + ' steps') elif md == 'index': self.global_log.info( 22 * ' ' + 'Will create a TPR to be used as structure file') else: self.global_log.info( 22 * ' ' + 'Will run a ' + md + ' md of ' + fu.human_readable_time(int(self.nsteps) * float(self.dt))) # Unzip topology in de directory of the output_tpr_path and get the # topology path topology_path = fu.unzip_top(self.input_top_zip_path) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [ gmx, 'grompp', '-f', mdp_file_path, '-c', self.input_gro_path, '-p', topology_path, '-o', self.output_tpr_path ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.input_cpt_path is not None: cmd.append('-t') cmd.append(self.input_cpt_path) if self.output_mdp_path is not None: cmd.append('-po') cmd.append(self.output_mdp_path) command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the GROMACS editconf module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) gmx = 'gmx' if self.gmx_path is None else self.gmx_path cmd = [ gmx, 'editconf', '-f', self.input_gro_path, '-o', self.output_gro_path, '-d', str(self.distance_to_molecule), '-bt', self.box_type ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.center_molecule: cmd.append('-c') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the SCWRL binary. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) if self.mutation is not None: # Read structure with Biopython parser = PDBParser(PERMISSIVE=1, QUIET=True) st = parser.get_structure( 's', self.input_pdb_path) # s random id never used if self.mut_dict['chain'] != 'ALL': chains = [self.mut_dict['chain']] else: chains = [chain.id for chain in st[0]] resnum = int(self.mut_dict['resnum']) sequence = '' for chain in chains: residue = st[0][chain][(' ', resnum, ' ')] backbone_atoms = ['N', 'CA', 'C', 'O', 'CB'] not_backbone_atoms = [] # The following formula does not work. Biopython bug? # for atom in residue: # if atom.id not in backbone_atoms: # residue.detach_child(atom.id) for atom in residue: if atom.id not in backbone_atoms: not_backbone_atoms.append(atom) for atom in not_backbone_atoms: residue.detach_child(atom.id) # Change residue name residue.resname = self.mut_dict['mt'].upper() # Creating a sequence file where the lower case residues will # remain untouched and the upper case residues will be modified aa1c = { 'ALA': 'A', 'CYS': 'C', 'CYX': 'C', 'ASP': 'D', 'ASH': 'D', 'GLU': 'E', 'GLH': 'E', 'PHE': 'F', 'GLY': 'G', 'HIS': 'H', 'HID': 'H', 'HIE': 'H', 'HIP': 'H', 'ILE': 'I', 'LYS': 'K', 'LYP': 'K', 'LEU': 'L', 'MET': 'M', 'MSE': 'M', 'ASN': 'N', 'PRO': 'P', 'HYP': 'P', 'GLN': 'Q', 'ARG': 'R', 'SER': 'S', 'THR': 'T', 'VAL': 'V', 'TRP': 'W', 'TYR': 'Y' } for res in st[0][chain].get_residues(): if res.resname not in aa1c: st[0][chain].detach_child(res.id) elif (res.id == (' ', resnum, ' ')): sequence += aa1c[res.resname].upper() else: sequence += aa1c[res.resname].lower() # Write resultant sequence sequence_file_path = fu.add_step_mutation_path_to_name( "sequence.seq", self.step, self.mutation) with open(sequence_file_path, 'w') as sqfile: sqfile.write(sequence + "\n") # Write resultant structure w = PDBIO() w.set_structure(st) prepared_file_path = fu.add_step_mutation_path_to_name( "prepared.pdb", self.step, self.mutation) w.save(prepared_file_path) else: prepared_file_path = self.input_pdb_path scrwl = 'Scwrl4' if self.scwrl4_path is None else self.scwrl4_path cmd = [ scrwl, '-i', prepared_file_path, '-o', self.output_pdb_path, '-h', '-t' ] if self.mutation: cmd.append('-s') cmd.append(sequence_file_path) command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) return command.launch()
def launch(self): """Launches the execution of the GROMACS pdb2gmx module. """ out_log, err_log = fu.get_logs(path=self.path, mutation=self.mutation, step=self.step) self.output_top_path = fu.add_step_mutation_path_to_name( self.output_top_path, self.step, self.mutation) self.output_itp_path = fu.add_step_mutation_path_to_name( self.output_itp_path, self.step, self.mutation) gmx = "gmx" if self.gmx_path is None else self.gmx_path cmd = [ gmx, "genrestr", "-f", self.input_structure_path, "-n", self.input_ndx_path, "-o", self.output_itp_path, "-fc", self.force_constants ] if self.mpirun_np is not None: cmd.insert(0, str(self.mpirun_np)) cmd.insert(0, '-np') if self.mpirun: cmd.insert(0, 'mpirun') if self.mpirun: cmd.append('<<<') cmd.append('\"' + self.restricted_group + '\"') else: cmd.insert(0, '|') cmd.insert(0, '\"' + self.restricted_group + '\"') cmd.insert(0, 'echo') command = cmd_wrapper.CmdWrapper(cmd, out_log, err_log) returncode = command.launch() fu.unzip_top(zip_file=self.input_top_zip_path, top_file=self.output_top_path) out_log.info('Unzip: ' + self.input_top_zip_path + ' to: ' + self.output_top_path) with open(self.output_top_path, 'r') as fin: for line in fin: if line.startswith('#ifdef POSRES'): itp_name = re.findall('"([^"]*)"', fin.next())[0] out_log.debug('itp_name: ' + itp_name) break # with open(self.output_top_path, 'r') as fin: # data = fin.read().splitlines(True) # index = data.index('#ifdef POSRES\n') # data[index+2] = 'system\n' # data.insert(index, '\n') # data.insert(index, '#endif\n') # data.insert(index, '#include "'+self.output_itp_path+'"\n') # data.insert(index, '#ifdef CUSTOM_POSRES\n') # data.insert(index, '; Include Position restraint file\n') # # data.insert(index, '#include "'+self.output_itp_path+'"\n') # # data.insert(index, '; Include genrestr generated itp\n') # with open(self.output_top_path, 'w') as fout: # fout.writelines(data) with open(self.output_itp_path, 'r') as fin: data = fin.read().splitlines(True) # data.insert(0, '\n') # data.insert(0, 'system 3\n') # data.insert(0, ';Name nrexcl\n') # data.insert(0, '[ system ]\n') with open(itp_name, 'w') as fout: fout.writelines(data) os.remove(self.output_itp_path) # zip topology fu.zip_top(self.output_top_path, self.output_top_zip_path, remove_files=False) out_log.info('Zip: ' + self.output_top_path + ' to: ' + self.output_top_zip_path) return returncode
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')