From 558e8fb1ca02ce9e44f4ca64bd3738e98f4ea80f Mon Sep 17 00:00:00 2001 From: gandrianov Date: Mon, 31 May 2021 23:15:31 -0400 Subject: [PATCH] Refactoring fragments screening protocol --- .DS_Store | Bin 6148 -> 6148 bytes FragmentsMerging.py | 8 +++--- FragmentsScreening.py | 64 ++++++++++++++++++++++++++---------------- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/.DS_Store b/.DS_Store index 8cfa90b784a0dce839349722dd8553bd18e6a67a..0204754ae897dbe25a5250ef0518c71601cce16c 100644 GIT binary patch delta 39 qcmZoMXffDe&ocQYYp$4hb+x&XfsTTiS*?x&glS=5x%m)_lQ01C2Mb03 delta 45 zcmZoMXffDe&%($#*?}cPijy;5K)kwI*FZI1jx29Fxz~H#Yq?d0(%Q8 diff --git a/FragmentsMerging.py b/FragmentsMerging.py index 45111de..8c7f2e8 100644 --- a/FragmentsMerging.py +++ b/FragmentsMerging.py @@ -15,19 +15,19 @@ def alignment(ref, targ, output): def merging(r1, r2, core, output): - cmd = f"python /fccc/users/karanicolaslab/andriag/combichem/combichem/processing/Merging.py -ref_pose {r1} -target_pose {r2} -substructure {core} -output {output}" + cmd = f"python Merging.py -ref_pose {r1} -target_pose {r2} -substructure {core} -output {output}" os.system(cmd) def generate_params(sdf, output): cmd = f"convert.py {sdf} {output}.mol2" os.system(cmd) - cmd = f"python /fccc/users/karanicolaslab/andriag/combichem/combichem/external_apps/generic_potencial/mol2genparams.py -s {output}.mol2 --prefix={output}" + cmd = f"python external_apps/generic_potencial/mol2genparams.py -s {output}.mol2 --prefix={output}" os.system(cmd) def replace_charge(r_pdb, r_params, t_pdb, t_params, output): - cmd = f"python /fccc/users/karanicolaslab/andriag/combichem/combichem/processing/Params.py -ref_pdb {r_pdb} -ref_params {r_params} -target_pdb {t_pdb} -target_params {t_params} -out {output}" + cmd = f"python Params.py -ref_pdb {r_pdb} -ref_params {r_params} -target_pdb {t_pdb} -target_params {t_params} -out {output}" os.system(cmd) @@ -39,7 +39,7 @@ def minimization(ligand, protein, params, hinge): mini_complexx = f"minimizations/mini_{complexx.split('/')[-1]}" mini_log = f"minimizations/mini_{complexx.split('/')[-1].split('.')[0]}.log" - cmd = f"python /fccc/users/karanicolaslab/andriag/combichem/combichem/processing/Screening.py -pdb {complexx} -params {params} -output {mini_complexx} -residues {hinge} > {mini_log}" + cmd = f"python Screening.py -pdb {complexx} -params {params} -output {mini_complexx} -residues {hinge} > {mini_log}" os.system(cmd) diff --git a/FragmentsScreening.py b/FragmentsScreening.py index 523a633..ebcf251 100644 --- a/FragmentsScreening.py +++ b/FragmentsScreening.py @@ -1,39 +1,55 @@ import os, sys, glob -if __name__ == "__main__": +def make_dirs(prefix=""): + + if prefix != "": + prefix += "_" + + os.system(f"mkdir -p {prefix}mol2") + os.system(f"mkdir -p {prefix}pdb_params") + os.system(f"mkdir -p {prefix}replaced_params") + os.system(f"mkdir -p {prefix}complexes") + os.system(f"mkdir -p {prefix}minimization") - directory = sys.argv[1] - sdfs = glob.glob(f"{directory}/*.sdf") - done = [f"{directory}/" + f.split("/")[-1].split("__")[0].split("mini_")[-1] + ".sdf" for f in glob.glob(f"{directory}_minimization/*pdb")] + return f"{prefix}mol2", f"{prefix}pdb_params", f"{prefix}replaced_params", + f"{prefix}complexes", f"{prefix}minimization" - sdfs = set(sdfs).difference(set(done)) +def args(): + parser = argparse.ArgumentParser() + parser.add_argument("-sdf", required=True) + parser.add_argument("-prot", required=True) + parser.add_argument("-ref_charge_pdb", required=True) + parser.add_argument("-ref_charge_param", required=True) + parser.add_argument("-klifs-seq", nargs="+", required=True) + parser.add_argument("-out_prefix", default="") + + args = parser.parse_args() - os.system(f"mkdir -p {directory}_mol2 {directory}_pdb_params {directory}_replaced_params {directory}_complexes {directory}_minimization") + return args - ref_pdb = "../mini_295_3BLQA_LG1_0001.pdb" - ref_params = "../mini_295_3BLQA_LG1.params" - ref_prot = "3BLQ_protein.pdb" - klifs = "23 24 25 26 27 28 29 30 31 32 33 34 35 45 46 47 48 49 50 62 63 64 65 66 67 68 69 70 71 72 73 74 76 77 78 79 80 81 82 83 84 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 165 166 167 168 169 170 171" +if __name__ == "__main__": + + args = args() + mol2_dir, pdb_params_dir, replaced_params_dir, complexes_dir, minimization_dir = make_dirs(args["out_prefix"]) - for sdf in sdfs: - filename = sdf.split("/")[-1].split(".")[0] + filename = args["sdf"].split("/")[-1].split(".")[0] - mol2 = f"{directory}_mol2/{filename}.mol2" - pdb_params = f"{directory}_pdb_params/{filename}" + mol2 = f"{mol2_dir}/{filename}.mol2" + pdb_params = f"{pdb_params_dir}/{filename}" - am1bcc = f"assigncharges.py -method am1bcc -in {sdf} -out {mol2}" - genpot = f"python ~/combichem/combichem/external_apps/generic_potencial/mol2genparams.py -s {mol2} --prefix={pdb_params}" + am1bcc = f"assigncharges.py -method am1bcc -in {sdf} -out {mol2}" + genpot = f"python external_apps/generic_potencial/mol2genparams.py -s {mol2} --prefix={pdb_params}" - replaced_params = f"{directory}_replaced_params/{filename}.params" - replace = f"python ~/combichem/combichem/processing/Params.py -ref_pdb {ref_pdb} -ref_params {ref_params} -target_pdb {pdb_params}_0001.pdb -target_params {pdb_params}.params -out {replaced_params}" + replaced_params = f"{replaced_params_dir}/{filename}.params" + replace = f"python Params.py -ref_pdb {ref_pdb} -ref_params {ref_params} -target_pdb {pdb_params}_0001.pdb -target_params {pdb_params}.params -out {replaced_params}" - pdb_complex = f"{directory}_complexes/{filename}__{ref_prot}" - concat = f"cat {ref_prot} {pdb_params}_0001.pdb > {pdb_complex}" + pdb_complex = f"{complexes_dir}/{filename}__{ref_prot}" + concat = f"cat {ref_prot} {pdb_params}_0001.pdb > {pdb_complex}" - min_pdb_complex = f"{directory}_minimization/mini_{filename}__{ref_prot}" - min_log_complex = f"{directory}_minimization/mini_{filename}__{ref_prot}".replace(".pdb", ".log") + min_pdb_complex = f"{minimization_dir}/mini_{filename}__{ref_prot}" + min_log_complex = f"{minimization_dir}/mini_{filename}__{ref_prot}".replace(".pdb", ".log") - minimization = f"python ~/combichem/combichem/processing/Screening.py -pdb {pdb_complex} -params {replaced_params} -output {min_pdb_complex} -residues {klifs} -beta True > {min_log_complex}" + minimization = f"python Screening.py -pdb {pdb_complex} -params {replaced_params} -output {min_pdb_complex} -residues {klifs} -beta True > {min_log_complex}" - print("; ".join([am1bcc, genpot, replace, concat, minimization])) + print("; ".join([am1bcc, genpot, replace, concat, minimization]))