python
pdb_lists = ['3LZG', '6HJN'] # lots more pdbs
for x in pdb_lists:
cmd.fetch(x)
cmd.select(x)
cmd.save(x + '.pdb', x)
cmd.delete(x)
cmd.quit()
python end


When the script is run within Pymol it pulls down a collection of pdbs, however this flopped when I plugged it through a Biopython PDB parser, but was okay when I manually downloaded the same pdb file from RCSB.org

A manual downloaded PDB was perfect, meaning the amino acids which cannot be observed by X-ray crystalography (e.g. they not sufficiently stationary) were recognised as being absent from the parser (resulting in a protein ~390 amino acids), but the Pymol scripted download contained all amino acid residues, i.e. even those which couldn't be observed in the X-ray (resulting in a protein of ~440 amino acid residues). Any ideas why the script resulted in a pdb that flopped and how to correct it?

• In PyMol 1.8+ fetch downloads mmcif files by default. Your script must convert mmCIF to pdb, that's why the result differs from a pdb file downloaded directly from wwPDB. Sep 7 '19 at 17:19

To expand on the comment by marcin:

1. fetch downloads files in mmCIF format by default (https://pymolwiki.org/index.php/Fetch). Not all PDB entries have PDB format files, e.g. due to too many chains. Presumably this is why the change was made, though mmCIF files tend to be larger and hence download slower.
2. When calling save with the .pdb file extension the structure is converted to PDB format. Perhaps the converter uses the SEQRES records to define the sequence, and hence gives bad files when there are some residues not resolved.

To correct it you could try:

1. Saving as .cif and reading in with the Biopython mmCIF parser.
2. Providing the type=pdb argument to fetch, which will force PDB format downloads. Some PDB files may not be available.

Also, if download speed is limiting you then consider using the MMTF file format, which is a binary format and hence smaller. Biopython can read in and write out MMTF files.

• Thanks point 2 was exactly how I solved the issue (and it worked). Let me look at the Biopython solution. I looked in detail at MMTF but it that appeared more aimed at pdb->MMTF.
– M__
Sep 7 '19 at 23:55

So this was the code I used and it worked (as far as I could see) and refers to point 2 of @jgreener's advice and was based on the comment by @marcin

python
pdb_lists = ['3LZG', '6HJN'] # lots more pdbs
for x in pdb_lists:
cmd.fetch(x, type='pdb')
cmd.select(x)
cmd.save(x + '.pdb', x)
cmd.delete(x)
cmd.quit()
python end


There are some Bio SE members who have serious skills in Pymol scripting, and constructive critique would be very welcome.