-
Notifications
You must be signed in to change notification settings - Fork 3
/
dock_backbone.py
103 lines (73 loc) · 3.3 KB
/
dock_backbone.py
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
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 13 17:11:13 2016
@author: XuGang
"""
import os
from scripts import script_dock_backbone
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()
model = 2
if model == 0:
# two proteins backbone docking process with fixed backbone
# require protein_A & protein_B .pdb file / backbone trrosetta-like constrains file (between two proteins)
from_pdb = True
fixed_backbone = True
elif model == 1:
# two proteins backbone docking process with flexible backbone at last optimaziton round
# require protein_A & protein_B .pdb file / backbone trrosetta-like constrains file (between two proteins)
from_pdb = True
fixed_backbone = False
elif model == 2:
# two proteins backbone docking process with flexible and randomly initialized backbone
# require backbone trrosetta-like constrains file (between two proteins && inside each protein)
# Note: two chains only (one for each participant)
from_pdb = False
fixed_backbone = 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 = "./predictions3/" + 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
mctrr_cons_path = os.path.join("./examples/dock", pdb_name_a + ".labels.npz") # backbone trrosetta-like constrains file
params["mctrr_cons_path"] = mctrr_cons_path
params["from_pdb"] = from_pdb
params["fixed_backbone"] = fixed_backbone
if params["from_pdb"]:
pdb_a_path = os.path.join("./examples/dock", pdb_name_a + ".pdb")
params["pdb_a_path"] = pdb_a_path
pdb_b_path = os.path.join("./examples/dock", pdb_name_b + ".pdb")
params["pdb_b_path"] = pdb_b_path
print ("Read:", params["pdb_a_path"], params["pdb_b_path"])
multi_iters.append(params)
pool = multiprocessing.Pool(30)
pool.map(script_dock_backbone.run_script, multi_iters)
pool.close()
pool.join()