On 5/17/2011 8:31 AM lina said...
Following Michiel's code (a little adjustment was done):
Well. you're almost there. The error you're getting
is likely due to splitting an empty line, then referencing
the [1] and [4] elements.
After you split the line into parts, test to confirm
that the fields you need are there:
#!/bin/python
mapping={}
for line in open("confout.pdb").readlines():
parts=line.strip().split()
if len(parts)>3:
mapping[parts[1]]=parts[4]
also, note that python indexes from zero, so this should be
mapping[parts[0]]=parts[3]
origs=open("dummy.atomID").read().split()
print " ".join([mapping[orig] for orig in origs])
Emile
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor