Skip to content

Commit

Permalink
Refactoring fragments screening protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
gandrianov committed Jun 1, 2021
1 parent 3d22e84 commit 558e8fb
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions FragmentsMerging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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)

Expand Down
64 changes: 40 additions & 24 deletions FragmentsScreening.py
Original file line number Diff line number Diff line change
@@ -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]))

0 comments on commit 558e8fb

Please sign in to comment.