||
这个脚本需要在pymol中使用
####################
from pymol import cmd
from pymol import stored
#function:count the number of residue around 3,4, 5,A
#to improve the accurancy of count,you should make sure the pdb just contain one drug
result=[]
def countresidue(ligname,distance):
selectline="select ligatom,resn "+ligname +" around " +distance
cmd.do(selectline)
allresidu=["ALA","ARG","ASP","CYS","GLN","GLU","HIS","GLY","ILE","ASN","LEU","LYS","MET","PHE","PRO","SER","THR","TRP","TYR","VAL"]
#print selectline
#cmd.do("remove all &!chain a")
cmd.do("select ligres,byres ligatom")
stored.list=[]
cmd.iterate("ligres and name ca","stored.list.append(resn)");
#print stored.listo
global result
result=[]
for resn in allresidu:
num=0
for i in stored.list:
if(i==resn):
num+=1
lineresu=resn+" "+str(num)
print lineresu
result.append(lineresu)
return result
cmd.extend("countresidue",countresidue)
###########################
批量统计
#################################
import time
from pymol import cmd
from pymol import stored
import subprocess
file=open("pdbligbetter2")
filew=open("resultcountresi5a","a")
cmd.do("cd /var/www/html/htmlczq/pymolscript")
cmd.do("run residuecount.py")
cmd.do("pwd")
for line in file:
pdblig=line.split()
#print pdblig[0]
line1="load "+pdblig[0]+'.pdb'
cmd.do(line1);
cmd.do("remove resn hoh")
cmd.do("remove all &! chain a")
line1="countresidue "+pdblig[1]+ ",5"
cmd.do(line1)
filew.write(pdblig[0])
filew.write(" ^^^^^n")
filew.write( str(result))
filew.write("n")
cmd.do("delete all")
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-20 09:20
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社