Dear Pymol users


I have to do TWO jobs simultaneously in PYMOL.


JOB 1: Load multiple *sdf files


I have set of ligand files in *.sdf format as follows:


/home/user/Model_1/cluster_1.sdf

/home/user/Model_1/cluster_2.sdf

/home/user/Model_1/cluster_3.sdf


/home/user/Model_2/cluster_1.sdf

/home/user/Model_2/cluster_2.sdf

/home/user/Model_2/cluster_3.sdf


/home/user/Model_3/cluster_1.sdf

/home/user/Model_3/cluster_2.sdf

/home/user/Model_3/cluster_3.sdf


I've got an answer from one of the PYMOL user as:


PyMOL>import glob

PyMOL>for i in glob.glob("cluster_*.sdf"): cmd.load(i)


But this command works only in the present working directory. For the next try I have to change my directory every time. Like:


cd /home/user/Model_1/

PyMOL>import glob

PyMOL>for i in glob.glob("cluster_*.sdf"): cmd.load(i)


cd /home/user/Model_2/

PyMOL>import glob

PyMOL>for i in glob.glob("cluster_*.sdf"): cmd.load(i)


cd /home/user/Model_3/

PyMOL>import glob

PyMOL>for i in glob.glob("cluster_*.sdf"): cmd.load(i)


Could you please tell me how to load these multiple *.sdf files in one command without changing the directory?


JOB2: Delete multiple *.sdf files


I have to analyze cluster_*.sdf files of several 100 directories.


So when I load cluster_*.sdf files from directory Model_2, the already loaded cluster:*.sdf files from Model_1 should be deleted.

Like wise when I load cluster_*.sdf files from directory Model_3, the already loaded cluster:*.sdf files from Model_2 should be deleted.


I am not good in programming. Could anybody help me in scripting to sort out this problem?


Thanks in advance.

Regards

Renuka