-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdock_sidechain.py
More file actions
122 lines (93 loc) · 4.95 KB
/
dock_sidechain.py
File metadata and controls
122 lines (93 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 13 17:11:13 2016
@author: XuGang
"""
import os
from scripts import script_dock_sidechain
from potential import Rama
import multiprocessing
os.environ["CUDA_VISIBLE_DEVICES"] = ""
if __name__ == '__main__':
"""
pdb7b26 B,A pdb7b26 C
protein A, chain_A, protein B, chain B
for simplicity, protein A [len_a]and protein B [len_b] are combined sequentially to
construct one backbone trrosetta-like constrains file [len_a+len_b, len_a+len_b, 100]
"""
lists = []
f = open('./examples/list_dock2')
for i in f.readlines():
lists.append(i.strip())
f.close()
# For oligomer targets, fold_sidechain.py can be used for
# their side chains modeling process with fixed backbone,
# just combine them and consider it as a single protein
model = 1
if model == 0:
# two proteins side chains docking process with flexible backbone at last optimaziton round, and the results from OPUS-RontaNN2 (or others) as initial x1x2x3x4
# require protein_A & protein_B .pdb file / predicted .rotann2 file / backbone & side chains trrosetta-like constrains file (between two proteins & inside each protein)
from_pdb = True
from_rotann = True
elif model == 1:
# two proteins side chains docking process with flexible backbone at last optimaziton round, and the random values as initial x1x2x3x4
# require protein_A & protein_B .pdb file / backbone & side chains trrosetta-like constrains file (between two proteins & inside each protein)
from_pdb = True
from_rotann = False
elif model == 2:
# two proteins backbone docking process with flexible and randomly initialized backbone, and the random values as initial x1x2x3x4
# require backbone & side chains trrosetta-like constrains file (between two proteins && inside each protein)
# Note: two chains only
from_pdb = False
from_rotann = False
multi_iters = []
for content in lists:
pdb_name_a, chains_a, pdb_name_b, chains_b = content.split()
chains_a = chains_a.split(',')
chains_b = chains_b.split(',')
print (pdb_name_a, chains_a, pdb_name_b, chains_b)
output_path = "./predictions4/" + pdb_name_a + "_fold3.pdb"
fasta_a_path = os.path.join("./examples/dock", pdb_name_a + "_a.fasta")
fasta_b_path = os.path.join("./examples/dock", pdb_name_b + "_b.fasta")
rama_cons = Rama.readRama("./lib/ramachandran.txt")
params = {}
params["fasta_a_path"] = fasta_a_path
params["fasta_b_path"] = fasta_b_path
params["chains_a"] = chains_a
params["chains_b"] = chains_b
params["rama_cons"] = rama_cons
params["output_path"] = output_path
# backbone docking params
# here, pdb_a and pdb_b use a combined cons file for demonstration
params["mctrr_cons_path"] = os.path.join("./examples/dock", pdb_name_a + ".labels.npz")
print ("Read:", params["mctrr_cons_path"])
# side chains docking params
# here, pdb_a and pdb_b use a combined cons file for demonstration
scx1trr_cons_path = os.path.join("./examples/dock", pdb_name_a + ".x1_labels.npz") # side chains trrosetta-like constrains file
params["scx1trr_cons_path"] = scx1trr_cons_path
scx2trr_cons_path = None
scx3trr_cons_path = None
scx4trr_cons_path = None
# ===optional for optimize x2, x3, x4===
scx2trr_cons_path = os.path.join("./examples/dock", pdb_name_a + ".x2_labels.npz") # side chains trrosetta-like constrains file
params["scx2trr_cons_path"] = scx2trr_cons_path
scx3trr_cons_path = os.path.join("./examples/dock", pdb_name_a + ".x3_labels.npz") # side chains trrosetta-like constrains file
params["scx3trr_cons_path"] = scx3trr_cons_path
scx4trr_cons_path = os.path.join("./examples/dock", pdb_name_a + ".x4_labels.npz") # side chains trrosetta-like constrains file
params["scx4trr_cons_path"] = scx4trr_cons_path
# ===optional for optimize x2, x3, x4===
params["from_pdb"] = from_pdb
params["from_rotann"] = from_rotann
if params["from_pdb"]:
params["pdb_a_path"] = os.path.join("./examples/dock", pdb_name_a + ".pdb")
params["pdb_b_path"] = os.path.join("./examples/dock", pdb_name_b + ".pdb")
print ("Read:", params["pdb_a_path"], params["pdb_b_path"])
if params["from_rotann"]:
# here, pdb_a and pdb_b use a combined cons file for demonstration
params["rotann_path"] = os.path.join("./examples/dock", pdb_name_a + ".rotann2")
print ("Read:", params["rotann_path"])
multi_iters.append(params)
pool = multiprocessing.Pool(30)
pool.map(script_dock_sidechain.run_script, multi_iters)
pool.close()
pool.join()