Dear Pymol user,
I have a protein and multiple ligand conformations as trajectories, i.e, i
have loaded the protein
using "cmd.load("protein.pdb", "input")"
I have split the ligand into multiple states using the following command
split_states ligand, prefix=sel

now I have multiple objected created from "sel0001-sel0010" for example
I wanted to create merged object as as individual files, like
trj0001-traj0010
l.e,
create trj0001, protein or sel0001
save traj0001.pdb, traj0001
create trj0002, protein or sel0002
save traj0002.pdb, traj0002
...
...

I want to automate file creation using python but I am wrote a script like
the below but it is lengthy and I was not not able to effectively use pymol
commands,"(cmd.createand cmd.save)" and I am stuck, can anyone suggest, if
this can be shortened. My script is as follows, I am new to python
programming, any user input will be helpful.
Thankyou
with regards
Sriram
### script###
python

x=[]
for i in range(1,10):
 x.append(f"trj%04d"%i)


y=[]
for j in range(1,10):
 y.append(f"sel%04d"%j)


z=[]
for i,j in zip(x,y):
 z.append(f"create {i},{j} or input")


A=[]
for k in zip(x):
  A.append("save {}.pdb,{}".format(*k,*k))


f=open('create.pml','w+')
for e in zip(z):
 print(*e,sep="\n",file=f)
f.close()

s=open('save.pml','w+')
for f in zip(A):
  print(*f,sep="\n",file=s)
s.close()
python end

run create.pml
run save.pml
###END###
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to