From 5d5d1a7cedf5eb868e4e306c6b1952d8966e6d79 Mon Sep 17 00:00:00 2001 From: z9527567 Date: Sat, 23 Sep 2023 11:59:30 +0800 Subject: [PATCH 01/10] fixed bugs --- AmberMDrun/equil.py | 30 ++++++++++++++++++++---------- AmberMDrun/extern/pybind11 | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/AmberMDrun/equil.py b/AmberMDrun/equil.py index b1447c4..f77f467 100644 --- a/AmberMDrun/equil.py +++ b/AmberMDrun/equil.py @@ -1,17 +1,26 @@ from . import pyamber import os import pandas as pd +from pathlib import Path + + def density(): - input = f"for FILE in final_?.out,final_??.out \n\ -readdata \$FILE name MD \n\ -done \n\ -evalplateau *[Density] name EQ out Eval.agr resultsout Eval.results\n\ -go\n\ -quit" + path = Path.cwd() + final_file = [] + for out_file in path.glob('final_*.out'): + final_file.append(out_file) + input = (f"for FILE in {' '.join([item.name for item in out_file])} \n" + "readdata \$FILE name MD \n" + "done \n" + "evalplateau *[Density] name EQ out Eval.agr resultsout Eval.results\n" + "go\n" + "quit" + ) + with open("cpptraj.in", "w") as f: f.write(input) os.system(f'cpptraj -i cpptraj.in') - result = pd.read_csv("Eval.results",sep="\s+") + result = pd.read_csv("Eval.results", sep="\s+") if result["EQ[result]"][0] == "yes": return 0 elif result["EQ[result]"][0] == "no": @@ -52,10 +61,11 @@ def prep(rst7, s, temp, heavymask, backbonemask, loop=20): ref = "step9.rst7" for i in range(loop): final = pyamber.NPT(f"final_{i}", systemInfo=s, ref=ref, temp=temp, - refc="step5.rst7", irest=True, dt=0.002, nscm=1000, nstlim=500000, ntwx=5000) + refc="step5.rst7", irest=True, dt=0.002, nscm=1000, nstlim=500000, ntwx=5000) final.Run() result = density() if result == 0: - return f'final_{i}.rst7' + return f'final_{i}.rst7' ref = f'final_{i}.rst7' - raise RuntimeError("More than 20 iterations of final density equil required. Bailing out.") + raise RuntimeError( + "More than 20 iterations of final density equil required. Bailing out.") diff --git a/AmberMDrun/extern/pybind11 b/AmberMDrun/extern/pybind11 index be97c5a..8b03ffa 160000 --- a/AmberMDrun/extern/pybind11 +++ b/AmberMDrun/extern/pybind11 @@ -1 +1 @@ -Subproject commit be97c5a98b4b252c524566f508b5c79410d118c6 +Subproject commit 8b03ffa7c06cd9c8a38297b1c8923695d1ff1b07 From f24d74080aee102e7c3ee16e9a259d83943cee44 Mon Sep 17 00:00:00 2001 From: 9527567 <50236967+9527567@users.noreply.github.com> Date: Sat, 21 Oct 2023 16:27:13 +0800 Subject: [PATCH 02/10] Create cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/cmake-single-platform.yml diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml new file mode 100644 index 0000000..28c6f78 --- /dev/null +++ b/.github/workflows/cmake-single-platform.yml @@ -0,0 +1,39 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + From bbd86cd3b07a04d99a29eeebbeef7469f24b1919 Mon Sep 17 00:00:00 2001 From: 9527567 <50236967+9527567@users.noreply.github.com> Date: Sat, 21 Oct 2023 16:31:09 +0800 Subject: [PATCH 03/10] Update cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 28c6f78..9961b78 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -4,9 +4,9 @@ name: CMake on a single platform on: push: - branches: [ "main" ] + branches: [ "dev" , "main" ] pull_request: - branches: [ "main" ] + branches: [ "dev" , "main" ] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) From 6f116c67d5785905872d83d3ca78f3afbe31ef79 Mon Sep 17 00:00:00 2001 From: 9527567 <50236967+9527567@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:06:35 +0800 Subject: [PATCH 04/10] Update cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 9961b78..ab18e7f 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -21,7 +21,8 @@ jobs: steps: - uses: actions/checkout@v3 - + with: + submodules: true - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type From e80d70c4d67fdc690b54fce33c76295069d8e082 Mon Sep 17 00:00:00 2001 From: z9527567 Date: Sun, 12 Nov 2023 21:25:08 +0800 Subject: [PATCH 05/10] Add multi ligand support. --- AmberMDrun/equil.py | 5 ++- AmberMDrun/mmpbsa.py | 95 ++++++++++++++++++++++++++++---------------- 2 files changed, 64 insertions(+), 36 deletions(-) diff --git a/AmberMDrun/equil.py b/AmberMDrun/equil.py index f77f467..f788cb1 100644 --- a/AmberMDrun/equil.py +++ b/AmberMDrun/equil.py @@ -1,4 +1,4 @@ -from . import pyamber +ifrom . import pyamber import os import pandas as pd from pathlib import Path @@ -9,7 +9,7 @@ def density(): final_file = [] for out_file in path.glob('final_*.out'): final_file.append(out_file) - input = (f"for FILE in {' '.join([item.name for item in out_file])} \n" + input = (f"for FILE in {' '.join([item.name for item in final_file])} \n" "readdata \$FILE name MD \n" "done \n" "evalplateau *[Density] name EQ out Eval.agr resultsout Eval.results\n" @@ -69,3 +69,4 @@ def prep(rst7, s, temp, heavymask, backbonemask, loop=20): ref = f'final_{i}.rst7' raise RuntimeError( "More than 20 iterations of final density equil required. Bailing out.") + diff --git a/AmberMDrun/mmpbsa.py b/AmberMDrun/mmpbsa.py index c38c434..f45ccea 100644 --- a/AmberMDrun/mmpbsa.py +++ b/AmberMDrun/mmpbsa.py @@ -6,6 +6,7 @@ import logging from logging import getLogger import subprocess +from typing import List def runCMD(inCmd, *, raise_on_fail: bool = True, logger: logging.Logger = getLogger("mmpbsa"), **kwargs): @@ -61,36 +62,43 @@ def split_pdb(pdb: str): return "pro.pdb", "mol.mol2" -def run_tleap(protein: str, mol: str, charge: int, multiplicity: int): +def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, guess_charge: bool): cmdline = f'pdb4amber -i {protein} -o _{str(protein)} -y -d -p' runCMD(cmdline) protein_path = Path(protein).absolute() - mol_path = Path(mol).absolute() - cmdline = f'acpype -i {str(mol_path)} -n {charge} -m {multiplicity}' - runCMD(cmdline, - message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") - leapin = f"source leaprc.protein.ff14SB\n\ - source leaprc.DNA.OL15\n\ - source leaprc.RNA.OL3\n\ - source leaprc.water.tip3p\n\ - source leaprc.gaff2\n\ - pro = loadpdb _{protein}\n\ - loadamberparams {mol_path.stem}.acpype/{mol_path.stem}_AC.frcmod\n\ - mol = loadmol2 {mol_path.stem}.acpype/{mol_path.stem}_bcc_gaff2.mol2\n\ - com = combine{{pro mol}}\n\ - solvatebox com TIP3PBOX 10.0\n\ - addions2 com Na+ 0\n\ - addions2 com Cl- 0\n\ - saveamberparm com {protein_path.stem}_{mol_path.stem}.parm7 {protein_path.stem}_{mol_path.stem}.rst7\n\ - quit" + mol_list = [Path(mol) for mol in mol_list] + + for mol, c, spin in zip(mol_list, charge, multiplicity): + if not guess_charge: + cmdline = f'acpype -i {str(Path(mol).absolute())} -n {c} -m {spin}' + else: + cmdline = f'acpype -i {str(Path(mol).absolute())}' + runCMD(cmdline, + message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") + mol_frcmod = f"\n".join( + f'loadamberparams {mol_path.stem}.acpype/{mol_path.stem}_AC.frcmod\n' for mol_path in mol_list) + mol_load = f"\n".join( + f'{mol_path.stem} = loadmol2 {mol_path.stem}.acpype/{mol_path.stem}_bcc_gaff2.mol2\n' for mol_path in mol_list) + combine = f"\n".join( + f'com = combine{{pro {mol_path.stem}}}\n' for mol_path in mol_list) + leapin = (f"""source leaprc.protein.ff14SB +source leaprc.DNA.OL15 +source leaprc.RNA.OL3 +source leaprc.water.tip3p +source leaprc.gaff2 +pro = loadpdb _{protein}\n""") + mol_frcmod + mol_load + combine + (f"""solvatebox com TIP3PBOX 10.0 +addionsrand com Na+ 0 +addionsrand com Cl- 0 +saveamberparm com com.parm7 com.rst7 +quit""") with open("leap.in", "w") as f: for i in leapin: f.write(i) runCMD('tleap -f leap.in') - return f'{protein_path.stem}_{mol_path.stem}.parm7', f'{protein_path.stem}_{mol_path.stem}.rst7' + return f'com.parm7', f'com.rst7' -def mmpbsa(parm7: str, rst7: str, netcdf: str, system: pyamber.SystemInfo): +def run_mmpbsa(parm7: str, rst7: str, netcdf: str, system: pyamber.SystemInfo, mol_list: List): parm7 = Path(parm7).absolute() rst7 = Path(rst7).absolute() @@ -138,25 +146,36 @@ def mmpbsa(parm7: str, rst7: str, netcdf: str, system: pyamber.SystemInfo): with open("mmpbsa.in", 'w') as f: for i in mmpbsa_in: f.write(i) - mmpbsa = f"mpirun -np {cpu_count() // 2} gmx_MMPBSA MPI -O -i mmpbsa.in -cs {str(parm7.with_suffix('.pdb'))} -ci index.ndx -cg 1 13 -ct {str(parm7.with_suffix('.xtc'))} -cp \ - {str(parm7.with_suffix('.top'))} -nogui" - runCMD(mmpbsa) + mol_number = 13 + for mol in range(len(mol_list)): + mol_path = Path.cwd().joinpath(mol) + mol_path.mkdir(exist_ok=True) + os.chdir(str(mol_path)) + mmpbsa = f"mpirun -np {cpu_count() // 2} gmx_MMPBSA MPI -O -i mmpbsa.in -cs {str(parm7.with_suffix('.pdb'))} -ci index.ndx -cg 1 {mol_number} -ct {str(parm7.with_suffix('.xtc'))} -cp \ + {str(parm7.with_suffix('.top'))} -nogui" + runCMD(mmpbsa) + os.chdir('..') + mol_number += 1 def arg_parse(): - parser = argparse.ArgumentParser(description='Tools for automating the operation of MMPBSA') + parser = argparse.ArgumentParser( + description='Tools for automating the operation of MMPBSA') parser.add_argument('--protein', '-p', type=str, required=True, help="pdb file for protein") - parser.add_argument('--mol2', '-m', type=str, + parser.add_argument('--mol2', '-m', type=str, nargs='+', required=False, help='mol2 file for mol') parser.add_argument('--temp', '-t', type=float, required=False, help='Temperature', default=303.15) parser.add_argument("--ns", '-n', type=int, help="time for MD(ns)", default=100) - parser.add_argument("--charge", type=int, - default=0, help="charge of mol") - parser.add_argument("--multiplicity", type=int, - default=1, help="multiplicity of mol") + parser.add_argument('-g', '--guess_charge', + action='store_true', help='guess charge') + parser.add_argument('-c', "--charge", type=int, nargs='+', + default=[0], help="charge of mol") + + parser.add_argument("--multiplicity", type=int, nargs='+', + default=[1], help="multiplicity of mol") parser.add_argument("--MIN", type=str, default="pmemd.cuda_DPFP", help="Engine for MIN") parser.add_argument("--MD", type=str, @@ -168,11 +187,18 @@ def arg_parse(): def mmpbsa(): args = arg_parse() protein = args.protein - mol = args.mol2 + mol_list = args.mol2 temp = args.temp - if mol is None: + if not args.guess_charge: + if len(mol_list) != len(args.charge) and len(mol_list) != len(args.multiplicity): + raise ValueError( + "If the charge is not guessed, it is necessary to specify the charge and spin multiplicity for each ligand.") + + if mol_list is None: protein, mol = split_pdb(protein) - parm7, rst7 = run_tleap(protein, mol, args.charge, args.multiplicity) + mol_list = [mol] + parm7, rst7 = run_tleap(protein, mol_list, args.charge, + args.multiplicity, args.guess_charge) s = pyamber.SystemInfo(parm7, rst7, runMin=args.MIN, runMd=args.MD) heavymask = "\"" + s.getHeavyMask() + "\"" backbonemask = "\"" + s.getBackBoneMask() + "\"" @@ -181,8 +207,9 @@ def mmpbsa(): md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, irest=True, nscm=1000, nstlim=args.ns * 500000) md.Run() - mmpbsa(parm7, rst7, "md.nc", s) + run_mmpbsa(parm7, rst7, "md.nc", s, mol_list) if __name__ == '__main__': mmpbsa() + From fa4bcebaf718bc60dd2d819814abbdc46967d596 Mon Sep 17 00:00:00 2001 From: z9527567 Date: Mon, 13 Nov 2023 00:13:40 +0800 Subject: [PATCH 06/10] fixed some bugs. --- AmberMDrun/equil.py | 2 +- AmberMDrun/mmpbsa.py | 44 +++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/AmberMDrun/equil.py b/AmberMDrun/equil.py index f788cb1..8c468bb 100644 --- a/AmberMDrun/equil.py +++ b/AmberMDrun/equil.py @@ -1,4 +1,4 @@ -ifrom . import pyamber +from . import pyamber import os import pandas as pd from pathlib import Path diff --git a/AmberMDrun/mmpbsa.py b/AmberMDrun/mmpbsa.py index f45ccea..b1b4fca 100644 --- a/AmberMDrun/mmpbsa.py +++ b/AmberMDrun/mmpbsa.py @@ -67,20 +67,22 @@ def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, gu runCMD(cmdline) protein_path = Path(protein).absolute() mol_list = [Path(mol) for mol in mol_list] - - for mol, c, spin in zip(mol_list, charge, multiplicity): - if not guess_charge: - cmdline = f'acpype -i {str(Path(mol).absolute())} -n {c} -m {spin}' - else: + if guess_charge: + for mol in mol_list: cmdline = f'acpype -i {str(Path(mol).absolute())}' - runCMD(cmdline, - message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") - mol_frcmod = f"\n".join( + runCMD(cmdline, + message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") + else: + for mol, c, spin in zip(mol_list, charge, multiplicity): + cmdline = f'acpype -i {str(Path(mol).absolute())} -n {c} -m {spin}' + runCMD(cmdline, + message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") + + mol_frcmod = f"".join( f'loadamberparams {mol_path.stem}.acpype/{mol_path.stem}_AC.frcmod\n' for mol_path in mol_list) - mol_load = f"\n".join( + mol_load = f"".join( f'{mol_path.stem} = loadmol2 {mol_path.stem}.acpype/{mol_path.stem}_bcc_gaff2.mol2\n' for mol_path in mol_list) - combine = f"\n".join( - f'com = combine{{pro {mol_path.stem}}}\n' for mol_path in mol_list) + combine = f'com = combine{{pro {" ".join(mol_path.stem for mol_path in mol_list)}}}\n' leapin = (f"""source leaprc.protein.ff14SB source leaprc.DNA.OL15 source leaprc.RNA.OL3 @@ -148,10 +150,10 @@ def run_mmpbsa(parm7: str, rst7: str, netcdf: str, system: pyamber.SystemInfo, m f.write(i) mol_number = 13 for mol in range(len(mol_list)): - mol_path = Path.cwd().joinpath(mol) + mol_path = Path.cwd().joinpath(f'lig{mol}') mol_path.mkdir(exist_ok=True) os.chdir(str(mol_path)) - mmpbsa = f"mpirun -np {cpu_count() // 2} gmx_MMPBSA MPI -O -i mmpbsa.in -cs {str(parm7.with_suffix('.pdb'))} -ci index.ndx -cg 1 {mol_number} -ct {str(parm7.with_suffix('.xtc'))} -cp \ + mmpbsa = f"mpirun -np {cpu_count() // 2} gmx_MMPBSA MPI -O -i ../mmpbsa.in -cs {str(parm7.with_suffix('.pdb'))} -ci ../index.ndx -cg 1 {mol_number} -ct {str(parm7.with_suffix('.xtc'))} -cp \ {str(parm7.with_suffix('.top'))} -nogui" runCMD(mmpbsa) os.chdir('..') @@ -200,16 +202,16 @@ def mmpbsa(): parm7, rst7 = run_tleap(protein, mol_list, args.charge, args.multiplicity, args.guess_charge) s = pyamber.SystemInfo(parm7, rst7, runMin=args.MIN, runMd=args.MD) - heavymask = "\"" + s.getHeavyMask() + "\"" - backbonemask = "\"" + s.getBackBoneMask() + "\"" - rst7 = prep(rst7=rst7, s=s, temp=temp, heavymask=heavymask, - backbonemask=backbonemask, loop=20) - md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, - irest=True, nscm=1000, nstlim=args.ns * 500000) - md.Run() + # heavymask = "\"" + s.getHeavyMask() + "\"" + # backbonemask = "\"" + s.getBackBoneMask() + "\"" + # rst7 = prep(rst7=rst7, s=s, temp=temp, heavymask=heavymask, + # backbonemask=backbonemask, loop=20) + # md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, + # irest=True, nscm=1000, nstlim=args.ns * 500000) + # md.Run() + rst7 = 'final_0.rst7' run_mmpbsa(parm7, rst7, "md.nc", s, mol_list) if __name__ == '__main__': mmpbsa() - From f6c24468f2fea4702fc0a6da42c6262d10a63c2a Mon Sep 17 00:00:00 2001 From: z9527567 Date: Thu, 16 Nov 2023 19:50:40 +0800 Subject: [PATCH 07/10] fixed some bugs. --- AmberMDrun/mmpbsa.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/AmberMDrun/mmpbsa.py b/AmberMDrun/mmpbsa.py index b1b4fca..0d2b598 100644 --- a/AmberMDrun/mmpbsa.py +++ b/AmberMDrun/mmpbsa.py @@ -202,13 +202,13 @@ def mmpbsa(): parm7, rst7 = run_tleap(protein, mol_list, args.charge, args.multiplicity, args.guess_charge) s = pyamber.SystemInfo(parm7, rst7, runMin=args.MIN, runMd=args.MD) - # heavymask = "\"" + s.getHeavyMask() + "\"" - # backbonemask = "\"" + s.getBackBoneMask() + "\"" - # rst7 = prep(rst7=rst7, s=s, temp=temp, heavymask=heavymask, - # backbonemask=backbonemask, loop=20) - # md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, - # irest=True, nscm=1000, nstlim=args.ns * 500000) - # md.Run() + heavymask = "\"" + s.getHeavyMask() + "\"" + backbonemask = "\"" + s.getBackBoneMask() + "\"" + rst7 = prep(rst7=rst7, s=s, temp=temp, heavymask=heavymask, + backbonemask=backbonemask, loop=20) + md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, + irest=True, nscm=1000, nstlim=args.ns * 500000) + md.Run() rst7 = 'final_0.rst7' run_mmpbsa(parm7, rst7, "md.nc", s, mol_list) From e4617d6f32f82576b683a5838bc887b941070ab3 Mon Sep 17 00:00:00 2001 From: z9527567 Date: Sat, 25 Nov 2023 12:35:02 +0800 Subject: [PATCH 08/10] update v 0.0.5. --- AmberMDrun/version.py | 2 +- README.md | 34 ++++++++++++++++++++++++++++++---- README.zh.md | 36 ++++++++++++++++++++++++++++++++---- setup.py | 2 +- 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/AmberMDrun/version.py b/AmberMDrun/version.py index 156d6f9..eead319 100644 --- a/AmberMDrun/version.py +++ b/AmberMDrun/version.py @@ -1 +1 @@ -__version__ = '0.0.4' +__version__ = '0.0.5' diff --git a/README.md b/README.md index e5d3614..2fed9d8 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ # AmberMDrun Easy to use, easy to expand, high-performance Amber simulation package +## Update +v0.0.5 Added support for multiple ligands. ## Install This software only supports **Linux** because some Linux system functions are called.**Mac OS X** and **Windows** are not supported. ### Necessary @@ -77,7 +79,7 @@ options: ## How to calculate MM-PB (GB) SA between small molecules and proteins of a single drug ~~~bash -usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2] [--temp TEMP] [--ns NS] [--charge CHARGE] [--multiplicity MULTIPLICITY] [--MIN MIN] [--MD MD] +usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] [--MIN MIN] [--MD MD] Tools for automating the operation of MMPBSA @@ -85,11 +87,14 @@ options: -h, --help show this help message and exit --protein PROTEIN, -p PROTEIN pdb file for protein - --mol2 MOL2, -m MOL2 mol2 file for mol + --mol2 MOL2 [MOL2 ...], -m MOL2 [MOL2 ...] + mol2 file for mol --temp TEMP, -t TEMP Temperature --ns NS, -n NS time for MD(ns) - --charge CHARGE charge of mol - --multiplicity MULTIPLICITY + -g, --guess_charge guess charge + -c CHARGE [CHARGE ...], --charge CHARGE [CHARGE ...] + charge of mol + --multiplicity MULTIPLICITY [MULTIPLICITY ...] multiplicity of mol --MIN MIN Engine for MIN --MD MD Engine for MD @@ -98,6 +103,11 @@ Typically, the complex structure after molecular docking is used to perform MMPB ~~~bash mmpbsa -p complex.pdb ~~~ +## V0.0.5 added support for multiple ligands +Just follow the files of multiple ligands after -m, and add an option `-g` to guess the static charge of small molecules, or manually specify the static charge, for example: +~~~bash +mmpbsa -p pro.pdb -m lig1.mol2 lig2.mol2 -g -n 100 +~~~ ## How to extend code through inheritance classes Will be described in the near future @@ -116,4 +126,20 @@ URL = {https://www.mdpi.com/2218-273X/13/4/635}, ISSN = {2218-273X}, DOI = {10.3390/biom13040635} } +~~~ +## If you are interested, you can also cite this article +~~~tex +@article{CUI2023134812, +title = {A TastePeptides-Meta system including an umami/bitter classification model Umami_YYDS, a TastePeptidesDB database and an open-source package Auto_Taste_ML}, +journal = {Food Chemistry}, +volume = {405}, +pages = {134812}, +year = {2023}, +issn = {0308-8146}, +doi = {https://doi.org/10.1016/j.foodchem.2022.134812}, +url = {https://www.sciencedirect.com/science/article/pii/S0308814622027741}, +author = {Zhiyong Cui and Zhiwei Zhang and Tianxing Zhou and Xueke Zhou and Yin Zhang and Hengli Meng and Wenli Wang and Yuan Liu}, +keywords = {Peptides, Umami prediction, TastePeptidesDB, Machine learning}, +abstract = {Taste peptides with umami/bitterness play a role in food attributes. However, the taste mechanisms of peptides are not fully understood, and the identification of these peptides is time-consuming. Here, we created a taste peptide database by collecting the reported taste peptide information. Eight key molecular descriptors from di/tri-peptides were selected and obtained by modeling screening. A gradient boosting decision tree model named Umami_YYDS (89.6\% accuracy) was established by data enhancement, comparison algorithm and model optimization. Our model showed a great prediction performance compared to other models, and its outstanding ability was verified by sensory experiments. To provide a convenient approach, we deployed a prediction website based on Umami_YYDS and uploaded the Auto_Taste_ML machine learning package. In summary, we established the system TastePeptides-Meta, containing a taste peptide database TastePeptidesDB an umami/bitter taste prediction model Umami_YYDS and an open-source machine learning package Auto_Taste_ML, which were helpful for rapid screening of umami peptides.} +} ~~~ \ No newline at end of file diff --git a/README.zh.md b/README.zh.md index c9bf488..fc0b4d4 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,5 +1,7 @@ # AmberMDrun 易于使用、易于扩展、高性能的Amber模拟软件包。 +## 版本更新 +v0.0.5 添加了多配体的支持。 ## 安装 此软件仅支持**Linux**,因为某些Linux系统功能被调用。**Mac OS X**和**Windows**不受支持。 ### 必要的依赖 @@ -76,7 +78,7 @@ options: ~~~ ## 如何计算单个小分子和蛋白质之间的MM-PB(GB)SA ~~~bash -usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2] [--temp TEMP] [--ns NS] [--charge CHARGE] [--multiplicity MULTIPLICITY] [--MIN MIN] [--MD MD] +usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] [--MIN MIN] [--MD MD] Tools for automating the operation of MMPBSA @@ -84,11 +86,14 @@ options: -h, --help show this help message and exit --protein PROTEIN, -p PROTEIN pdb file for protein - --mol2 MOL2, -m MOL2 mol2 file for mol + --mol2 MOL2 [MOL2 ...], -m MOL2 [MOL2 ...] + mol2 file for mol --temp TEMP, -t TEMP Temperature --ns NS, -n NS time for MD(ns) - --charge CHARGE charge of mol - --multiplicity MULTIPLICITY + -g, --guess_charge guess charge + -c CHARGE [CHARGE ...], --charge CHARGE [CHARGE ...] + charge of mol + --multiplicity MULTIPLICITY [MULTIPLICITY ...] multiplicity of mol --MIN MIN Engine for MIN --MD MD Engine for MD @@ -97,6 +102,12 @@ options: ~~~bash mmpbsa -p complex.pdb ~~~ + +## V0.0.5 添加了多配体的支持 +只需要在-m 后跟多个配体的文件即可,添加了一个选项`-g`用于猜测小分子的静电荷,或者手动指定静电荷,例如: +~~~bash +mmpbsa -p pro.pdb -m lig1.mol2 lig2.mol2 -g -n 100 +~~~ ## 如何通过继承扩展代码 我们将在不久的将来进行描述。 @@ -115,4 +126,21 @@ URL = {https://www.mdpi.com/2218-273X/13/4/635}, ISSN = {2218-273X}, DOI = {10.3390/biom13040635} } +~~~ +## 如果您感兴趣的话,也可以引用这篇文章 +bibtex: +~~~tex +@article{CUI2023134812, +title = {A TastePeptides-Meta system including an umami/bitter classification model Umami_YYDS, a TastePeptidesDB database and an open-source package Auto_Taste_ML}, +journal = {Food Chemistry}, +volume = {405}, +pages = {134812}, +year = {2023}, +issn = {0308-8146}, +doi = {https://doi.org/10.1016/j.foodchem.2022.134812}, +url = {https://www.sciencedirect.com/science/article/pii/S0308814622027741}, +author = {Zhiyong Cui and Zhiwei Zhang and Tianxing Zhou and Xueke Zhou and Yin Zhang and Hengli Meng and Wenli Wang and Yuan Liu}, +keywords = {Peptides, Umami prediction, TastePeptidesDB, Machine learning}, +abstract = {Taste peptides with umami/bitterness play a role in food attributes. However, the taste mechanisms of peptides are not fully understood, and the identification of these peptides is time-consuming. Here, we created a taste peptide database by collecting the reported taste peptide information. Eight key molecular descriptors from di/tri-peptides were selected and obtained by modeling screening. A gradient boosting decision tree model named Umami_YYDS (89.6\% accuracy) was established by data enhancement, comparison algorithm and model optimization. Our model showed a great prediction performance compared to other models, and its outstanding ability was verified by sensory experiments. To provide a convenient approach, we deployed a prediction website based on Umami_YYDS and uploaded the Auto_Taste_ML machine learning package. In summary, we established the system TastePeptides-Meta, containing a taste peptide database TastePeptidesDB an umami/bitter taste prediction model Umami_YYDS and an open-source machine learning package Auto_Taste_ML, which were helpful for rapid screening of umami peptides.} +} ~~~ \ No newline at end of file diff --git a/setup.py b/setup.py index dffbf1e..e336b49 100644 --- a/setup.py +++ b/setup.py @@ -125,7 +125,7 @@ def build_extension(self, ext: CMakeExtension) -> None: # logic and declaration, and simpler if you include description/version in a file. setup( name="AmberMDrun", - version="0.0.4", + version="0.0.5", author="ZhiWei Zhang", author_email="z9527567@gmail.com", description="A scripting tool for running Amber MD in an easy way", From 58d05db6fddf94ea750fa88ab15e9897730184de Mon Sep 17 00:00:00 2001 From: z9527567 Date: Sat, 25 Nov 2023 13:04:50 +0800 Subject: [PATCH 09/10] update v 0.0.5. --- conda.recipe/conda_build_config.yaml | 3 ++- conda.recipe/meta.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml index 9f70181..47783ca 100644 --- a/conda.recipe/conda_build_config.yaml +++ b/conda.recipe/conda_build_config.yaml @@ -13,4 +13,5 @@ python: - 3.8 - 3.9 - 3.10 -- 3.11 \ No newline at end of file +- 3.11 +- 3.12 \ No newline at end of file diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index ad187a7..d15b1d5 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,6 +1,6 @@ package: name: ambermdrun - version: 0.0.4 + version: 0.0.5 source: path: .. From 23e8c76bcd3f8592d6ce52d581eff8e43fbac4b5 Mon Sep 17 00:00:00 2001 From: z9527567 Date: Tue, 5 Dec 2023 21:33:51 +0800 Subject: [PATCH 10/10] update v 0.0.6 --- AmberMDrun/mmpbsa.py | 24 ++++++++++++++++++------ README.md | 4 +++- README.zh.md | 9 ++++++++- conda.recipe/meta.yaml | 2 +- setup.py | 2 +- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/AmberMDrun/mmpbsa.py b/AmberMDrun/mmpbsa.py index 0d2b598..d26b652 100644 --- a/AmberMDrun/mmpbsa.py +++ b/AmberMDrun/mmpbsa.py @@ -62,7 +62,7 @@ def split_pdb(pdb: str): return "pro.pdb", "mol.mol2" -def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, guess_charge: bool): +def run_tleap(protein: str, mol_list: List, user_charge: bool, charge: List, multiplicity: List, guess_charge: bool): cmdline = f'pdb4amber -i {protein} -o _{str(protein)} -y -d -p' runCMD(cmdline) protein_path = Path(protein).absolute() @@ -72,6 +72,13 @@ def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, gu cmdline = f'acpype -i {str(Path(mol).absolute())}' runCMD(cmdline, message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") + elif user_charge: + for mol in mol_list: + if Path(mol).suffix != '.mol2': + raise RuntimeError('must mol2 for user charge!') + cmdline = f'acpype -i {str(Path(mol).absolute())} -c user' + runCMD(cmdline, + message="Perhaps you should check the charge of the ligand and the correctness of the hydrogen atom.") else: for mol, c, spin in zip(mol_list, charge, multiplicity): cmdline = f'acpype -i {str(Path(mol).absolute())} -n {c} -m {spin}' @@ -80,7 +87,11 @@ def run_tleap(protein: str, mol_list: List, charge: List, multiplicity: List, gu mol_frcmod = f"".join( f'loadamberparams {mol_path.stem}.acpype/{mol_path.stem}_AC.frcmod\n' for mol_path in mol_list) - mol_load = f"".join( + if user_charge: + mol_load = f"".join( + f'{mol_path.stem} = loadmol2 {mol_path.stem}.acpype/{mol_path.stem}_user_gaff2.mol2\n' for mol_path in mol_list) + else: + mol_load = f"".join( f'{mol_path.stem} = loadmol2 {mol_path.stem}.acpype/{mol_path.stem}_bcc_gaff2.mol2\n' for mol_path in mol_list) combine = f'com = combine{{pro {" ".join(mol_path.stem for mol_path in mol_list)}}}\n' leapin = (f"""source leaprc.protein.ff14SB @@ -173,9 +184,10 @@ def arg_parse(): help="time for MD(ns)", default=100) parser.add_argument('-g', '--guess_charge', action='store_true', help='guess charge') + parser.add_argument('-uc', '--user_charge', + action='store_true', help='user charge') parser.add_argument('-c', "--charge", type=int, nargs='+', default=[0], help="charge of mol") - parser.add_argument("--multiplicity", type=int, nargs='+', default=[1], help="multiplicity of mol") parser.add_argument("--MIN", type=str, @@ -191,7 +203,7 @@ def mmpbsa(): protein = args.protein mol_list = args.mol2 temp = args.temp - if not args.guess_charge: + if not args.guess_charge and not args.user_charge: if len(mol_list) != len(args.charge) and len(mol_list) != len(args.multiplicity): raise ValueError( "If the charge is not guessed, it is necessary to specify the charge and spin multiplicity for each ligand.") @@ -199,14 +211,14 @@ def mmpbsa(): if mol_list is None: protein, mol = split_pdb(protein) mol_list = [mol] - parm7, rst7 = run_tleap(protein, mol_list, args.charge, + parm7, rst7 = run_tleap(protein, mol_list, args.charge, args.user_charge, args.multiplicity, args.guess_charge) s = pyamber.SystemInfo(parm7, rst7, runMin=args.MIN, runMd=args.MD) heavymask = "\"" + s.getHeavyMask() + "\"" backbonemask = "\"" + s.getBackBoneMask() + "\"" rst7 = prep(rst7=rst7, s=s, temp=temp, heavymask=heavymask, backbonemask=backbonemask, loop=20) - md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000, + md = pyamber.NPT("md", s, rst7, rst7, ntwx=50000,temp=temp, irest=True, nscm=1000, nstlim=args.ns * 500000) md.Run() rst7 = 'final_0.rst7' diff --git a/README.md b/README.md index 2fed9d8..4c8df7b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,8 @@ options: ## How to calculate MM-PB (GB) SA between small molecules and proteins of a single drug ~~~bash -usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] [--MIN MIN] [--MD MD] +usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-uc] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] + [--MIN MIN] [--MD MD] Tools for automating the operation of MMPBSA @@ -92,6 +93,7 @@ options: --temp TEMP, -t TEMP Temperature --ns NS, -n NS time for MD(ns) -g, --guess_charge guess charge + -uc, --user_charge user charge -c CHARGE [CHARGE ...], --charge CHARGE [CHARGE ...] charge of mol --multiplicity MULTIPLICITY [MULTIPLICITY ...] diff --git a/README.zh.md b/README.zh.md index fc0b4d4..84c6f3c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -78,7 +78,8 @@ options: ~~~ ## 如何计算单个小分子和蛋白质之间的MM-PB(GB)SA ~~~bash -usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] [--MIN MIN] [--MD MD] +usage: mmpbsa [-h] --protein PROTEIN [--mol2 MOL2 [MOL2 ...]] [--temp TEMP] [--ns NS] [-g] [-uc] [-c CHARGE [CHARGE ...]] [--multiplicity MULTIPLICITY [MULTIPLICITY ...]] + [--MIN MIN] [--MD MD] Tools for automating the operation of MMPBSA @@ -91,6 +92,7 @@ options: --temp TEMP, -t TEMP Temperature --ns NS, -n NS time for MD(ns) -g, --guess_charge guess charge + -uc, --user_charge user charge -c CHARGE [CHARGE ...], --charge CHARGE [CHARGE ...] charge of mol --multiplicity MULTIPLICITY [MULTIPLICITY ...] @@ -108,6 +110,11 @@ mmpbsa -p complex.pdb ~~~bash mmpbsa -p pro.pdb -m lig1.mol2 lig2.mol2 -g -n 100 ~~~ +## V0.0.6 添加自定义电荷选项 +添加了一个选项`-uc`用于使用自定义小分子的静电荷,只能用mol2文件,例如: +~~~bash +mmpbsa -p pro.pdb -m lig1.mol2 lig2.mol2 -uc -n 100 +~~~ ## 如何通过继承扩展代码 我们将在不久的将来进行描述。 diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index d15b1d5..e1e5860 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,6 +1,6 @@ package: name: ambermdrun - version: 0.0.5 + version: 0.0.6 source: path: .. diff --git a/setup.py b/setup.py index e336b49..e91097e 100644 --- a/setup.py +++ b/setup.py @@ -125,7 +125,7 @@ def build_extension(self, ext: CMakeExtension) -> None: # logic and declaration, and simpler if you include description/version in a file. setup( name="AmberMDrun", - version="0.0.5", + version="0.0.6", author="ZhiWei Zhang", author_email="z9527567@gmail.com", description="A scripting tool for running Amber MD in an easy way",