Hi Anasuya, This sound like one of those very good reasons to have a go at Python, and leave Perl behind... Together with all the plain reasons to leave Perl behind :) First of all, check http://xkcd.com/353/
Assuming the file is called list.txt and you have all pdb files at hand (which is not strictly necessary, as PyMOl can download them for you), make a file called process.py with the following content from pymol import cmd def process_line(x): pdbid,res,chain,num = x.split() cmd.load(pdbid+".pdb") cmd.select("zone1","byres all within 4.5 of (chain %s and resn %s and resi %s)"%(chain,res,num)) cmd.select("zone2","(byres all within 4.5 of zone1) and not zone1)") cmd.save("%s-%s-%s-%s-zone1.pdb"%(pdbid,res,chain,num),zone1) cmd.save("%s-%s-%s-%s-zone2.pdb"%(pdbid,res,chain,num),zone2) cmd.delete(pdbid) def process_all(filename): for line in open(filename): process_line(line) process_all("list.txt") #====== After saving the file, do pymol -c process.py And that's it. Unless I made an error somewhere :P I haven't actually tested this. But the proper solution should lie along these lines :) Hope it helps, Tsjerk On Thu, Sep 29, 2011 at 8:58 AM, Anasuya Dighe <anas...@mbu.iisc.ernet.in> wrote: > Hello, > I have a .txt file which has data in the following fashion: > > 19gs BSP A 1 > 1a2d PYX A 117 > 9rsa ADU A 125 > 7kme PRR J 382 > 1a0r ACE B 1 > 1a0r FAR G 72 > . > . > . > > Fields: <PDB ID> <LIGAND NAME> <CHAIN TO WHICH IT IS ATTACHED> <RESIDUE > SEQUENCE NUMBER> > > In such a way, I have data of around 19,200 unique pdb files which have one > or > more ligands attached to them. [PLEASE NOTE THAT there can be multiple ligands > to a particular .pdb file attached at different positions ] > > For each .pdb file, I need to extract complete residues which fall within a > radius of 4.5 Angstroms of the ligand. I am calling such zones as ZONE1.I mean > residues that have any atom within 4.5 Angstroms of the ligand => zone1 > Then after extracting ZONE1, I also want to extract complete residues which > fall > within a radius of 4.5 Angstroms of ZONE1.. I am calling these zones as > ZONE2. I > mean, residues that have any atom within 9.0 Angstroms of the ligand, but are > not already in ZONE1 => ZONE2 > > I am looking for a way to automate Pymol by writing a .pml script, such that > foreach pdb file, I have 2 additional files generated such that they are > called > as: 19gs_BSP_z1.pdb [for ZONE1] and 19gs_BSP_z2.pdb [for ZONE2], > 1a2d_PYX_z1.pdb, 1a2d_PYX_z2.pdb and so on... > > Can this be done through PERL? > Please suggest me an efficient way of achieving the desired output.. > > Thanks, > > -Anasuya > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net > -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net