@dwblas yes I got some answers. but they are unbelievable. So I think there is a problem with my codes. i.e repetition of values when counting.
So I need to know how to modify these codes. Please if you know the method can you help me ?
User Profile
Collapse
-
How to add multiple lists to a script to count number of residues
#!/usr/bin/python
import os
d={}
path=os.getcwd( )
print path
list_of_filenam es=os.listdir(o s.path.join(pat h, 'newfiles'))
print list_of_filenam es
residue=[]
for f in list_of_filenam es:
f1=open(os.path .join(path, 'newfiles', f)).readlines()
d[f]=0
for line in f1:
if line.startswith ('ATOM'):
... -
-
How to count total number of water ('HOH') molecules in each file ?
#!/usr/bin/python
import os
path=os.getcwd( )
print path
list_of_filenam es=os.listdir(p ath+'//newfiles')
print list_of_filenam es
residue=[]
for f in list_of_filenam es:
f1=open(path+'//newfiles//'+f).readlines( )
for line in f1:
if line.startswith ('HETATM'):
res_number=line[22:26]
if res_number... -
thank you very much for your kind explanation. I will proceed with this.Leave a comment:
-
how to write a python script to count number of residues in a 'pdb' file
#!/usr/bin/python
import sys
import os
f1=open('1tfz.p db','r')
residue=[]
for line in f1:
if line.startswith ('ATOM') or line.startswith ('HETATM'):
res_number=line[22-26]
if res_number not in residue and line[17-20]!='HOH' and line[17-20]!='WAT':
residue.append( res_number)...
No activity results to display
Show More
Leave a comment: