Written as a one-liner the final command eventually looks like this: for protein in *.pdb do /Applications/PyMOL.app/Contents/MacOS/PyMOL -cq $protein -d "hide everything select pieceofpeptide, resi 40-55 show cartoon, pieceofpeptide zoom center, 20 png $protein.png, width=10cm, dpi=150, ray=1" done Now we make sure that the image is centered (try varying the number, it represents the distance from the object we center): zoom center, 20 įinally, let's save this as an image (adjust resolution to your needs): png $protein.png, width=10cm, dpi=150, ray=1 However, I had some trouble finding these commands for using them in a script. or just type, fetch 1bl8 and you can skip the next step (see Fetch command), as PyMOL will open the file for you. (The RCSB Protein Data Bank is a public structure repository. Today I was struggling trying to make a figure with two-side lighting, no specular reflections, in a maximum quality rendering space. Getting started: explore a protein Obtain a PDB coordinates file for your favorite protein. cartoon, licorice, lines etc.) you choose the style in the next command: show cartoon, pieceofpeptide Pymol scripting is really powerful, but sometimes finding the right command that corresponds to that precise button in the GUI is tricky. Now we select your residues 40 through 55 and name this selection "pieceofpeptide": select pieceofpeptide, resi 40-55 ĭepending on how you want the representation to look (e.g. We are going to use the following commands to get your piece of peptide for each PDB file and create a PNG image:įirst we make sure that nothing else will be visible: hide everything d means PyMOL commands are going to be passed. $protein is each PDB file we're looping over.
Applications/PyMOL.app/Contents/MacOS/PyMOL -cq $protein -d "#here come the PyMOL commands"Ĭ means, that the PyMOL gui won't start (we don't need it here), and q omits PyMOL's welcome message.
Pymol tutorial command line how to#
Further help on how to start PyMOL from the command line you can find here. Depending on the operating system you work on this may vary. These commands you are going to need for PyMOL:įirst, let's start the PyMOL executable from the shell. Here is a sample output which should be pretty consistent for recent versions. Run help launching from the command line for detailed listings of options for your current version of PyMol.
Pymol tutorial command line windows#
#launching PyMOL and passing commands here PyMOL has lots of options for controlling it immediately from startup. In addition to the graphical tools, Windows Server 2008 R2 like previous versions of WindowsServer, has command-line tools that you can use to view session information manage a session contents. I will deliberately omit the part "export the snapshots to an html page/format" because this goes beyond PyMOL and can be done with many other programs or tools.įirst, you want to iterate over the pdb files inside your folder: for protein in *.pdb Since you want to do this using "piping in Unix", I will describe here the plain command line version on how to proceed.