-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathblock
executable file
·62 lines (53 loc) · 1.59 KB
/
block
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
#!/usr/bin/python
#
# Copyright (C) 2020 Tokyo Institute of Technology
#
# =====================================================================
#
# Software Name : MEGADOCK (blocking residues)
#
# Contact address : Tokyo Institute of Technology, AKIYAMA Lab.
#
# Last update: December 3, 2014
#
# =====================================================================
import os
import sys
import csv
if (len(sys.argv) != 4):
print 'Usage: $ %s [pdbfile] [chain] [target residue list]' % sys.argv[0]
print ''
print ' e.g.) $ %s 1gcq_r.pdb B 182-186,189,195-198,204 > blocked.pdb' % sys.argv[0]
print ''
print 'Note: Target residue list is separated by commas and no spaces.'
print ' You can also use hyphen \"-\": \"182-186\" means blocking residues of 182, 183, ..., 186.'
print ' Blocked residues are substituted for \'BLK\'.'
print ' Updated PDB coordinates are written to \"standard output\".'
quit(1)
ch = sys.argv[2]
reslist = []
resarg = sys.argv[3].split(",")
for r in resarg:
if "-" in r:
rseq = r.split("-")
for i in range(int(rseq[0]), int(rseq[1])+1):
reslist.append(str(i))
else:
reslist.append(r)
fp = open(sys.argv[1], "r")
try:
for l in fp.readlines():
l = l.strip()
if l[0:4] != "ATOM" and l[0:6] != "HETATM":
print l
continue
if l[21] != ch:
print l
continue
ll = l
if ll[22:26].strip() not in reslist:
print l
continue
print l[0:16] + " BLK" + l[20:]
finally:
fp.close()