#author("2016-09-04T14:08:29+00:00","default:ohue","ohue")
#author("2016-09-04T14:10:00+00:00","default:ohue","ohue")
[[PDB toolbox]]

*PDBのchain名を変える [#l3291a6d]
その名の通り.chain名を揃えたいときなどに使う.
 change_chainname.py


 #!/usr/bin/python
 
 import re
 import sys 
 
 if (len(sys.argv) != 4):
     print 'Usage: # python %s [pdbfile] [target chain name] [new chain name]' % sys.argv[0]
     quit()
 
 id = sys.argv[1][0:4]
 fp = open(sys.argv[1])
 pdb = fp.read()
 fp.close()
 
 pdb = pdb.rstrip("\n")
 pdb = pdb.split("\n") 
 
 fc = open(sys.argv[1], "w")
 for ll in pdb:
     l = ll
     if l[0:4] != 'ATOM' and l[0:6] != 'HETATM':
         continue
     if l[17:20] == 'HOH':
         continue
     if l[21] != sys.argv[2]:
         fc.write(l + "\n")
         continue
     fc.write(l[:21] + sys.argv[3] + l[22:] + "\n")  
 
 fc.close()

***使い方 [#o4c06086]
 python change_chainname.py 対象のPDB 対象のチェイン名 変更後のチェイン名

 python change_chainname.py 1CGI.pdb E K
(1CGI.pdbのチェインEの名前をKに変更する)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS