== Overview ==
This script filters through all the PDBs in the parent dir (you can easily the the directory it scans). For each molecule, it saves just the ligands/heteroatoms (excluding the waters). This gives you a simple way to filter through a database of proteins looking only at their ligands.
This script, as noted below, works on the objects at the level of a molecule. While we can iterate over atom number (ID), residue number (resi), etc we do not have any such "MOLID". So, we provide this simple workaround. You might need this file because if you have a residue (like #111 from 3BEP) that consists of a molecule and an atom then there's no other way to save the separate pieces (of molecule/atom) into two (or more files). As you can see in the following listing, if we iterate over the hetero atoms (and not waters) in 3BEP we get,
<source lang="python">
PyMOL>iterate bymol het, print resi, resn, ID, chain, segi, alt
111 5CY 6473 C
111 5CY 6474 C
111 5CY 6476 C
111 5CY 6477 C
111 5CY 6478 C
111 5CY ..→