""""
author:lijie zhang
data:2012-05-24
func:this script is used to remove the atom or line which is not needed in the file form
"""
import glob
L=["HB","O5T", "H2A*", "O3T","HN6A","HN6B","HE","HN2A","HN2B","H2B*","HN4A","HN4B"]
def file_list():
files=[]
for file in glob.glob("./*.pdb"):
files.append(file)
files=sorted(files,key=lambda x:int(x[-5:-4]))
return files
def deal_atom(old_pdb,new_pdb,L_list):
f=open(old_pdb,'r')
store_pdb=open(new_pdb,"w")
lines=f.readlines()
for atom in L_list:
for line in lines:
data=line.split()
if atom in data:
lines.remove(line)
for line in lines:
store_pdb.write(line)
store_pdb.close()
f.close()
if __name__=="__main__":
print file_list()
s=1
for file in file_list():
deal_atom(file,"new%i.pdb"%s,L)
s+=1
author:lijie zhang
data:2012-05-24
func:this script is used to remove the atom or line which is not needed in the file form
"""
import glob
L=["HB","O5T", "H2A*", "O3T","HN6A","HN6B","HE","HN2A","HN2B","H2B*","HN4A","HN4B"]
def file_list():
files=[]
for file in glob.glob("./*.pdb"):
files.append(file)
files=sorted(files,key=lambda x:int(x[-5:-4]))
return files
def deal_atom(old_pdb,new_pdb,L_list):
f=open(old_pdb,'r')
store_pdb=open(new_pdb,"w")
lines=f.readlines()
for atom in L_list:
for line in lines:
data=line.split()
if atom in data:
lines.remove(line)
for line in lines:
store_pdb.write(line)
store_pdb.close()
f.close()
if __name__=="__main__":
print file_list()
s=1
for file in file_list():
deal_atom(file,"new%i.pdb"%s,L)
s+=1