I am trying to visualize a cytochrome c protein and display one of the residues in ball and sticks over it. I am using the PDB file 1AKK for it (https://www.rcsb.org/structure/1akk). The Import function works nicely:

Import["PDBfiles/1akk.pdb", "PDB"]

enter image description here

However, I would like to display one specific residue (tryptophane 59) in balls of stick over it. To that end, I extracted the coordinates of the atoms in XYZ format and can display for example both the tryptophane and the haem together using

trp59Ferric = Import["PDBfiles/trp59Ferric.xyz", "Graphics3D"];
haemFerric = Import["PDBfiles/haemFerric.xyz", "Graphics3D"];
Show[haemFerric, trp59Ferric]

enter image description here

However, when I tried to display tryptophane with the protein with Show[Import["PDBfiles/1akk.pdb", "PDB"], trp59Ferric], the residue does not appear, only the protein structure and the haem (first figure in this post). I suspect that the coordinates used in the background are not the same (pm and angstrom) but if I try to convert the coordinates in the xyz files, then Mathematica can't figure out the bonds anymore in the balls and stick display.

Maybe there is a better path not relying on extra xyz files and just using the PDB file in Mathematica. Any suggestions ? Many thanks. As a side question, is it possible to increase the resolution of the protein display so that it looks more "smooth" ?


1 Answer 1


The code for dealing with molecules from the XYZ format has been updated in the last few years, and is much newer than the PDB importer. The older code would for some reason multiply all the coordinates by 100 to use picometers, but the newer code leaves everything in angstroms. We are currently actively working on updating our PDB and MMCIF importers.

For now it is necessary to scale up the XYZ plot to picometers. Here is a function to do that

rescaleGraphics3D[Graphics3D[x_, y__], scale_] := Graphics3D[
    GeometricTransformation[x, ScalingTransform @ scale], y

use it like

Show[pdbGraphic, rescaleGraphics3D[trp59Ferric, {100, 100, 100}]]

enter image description here

Edit: I have put this in a resource function that others may use. To download this structure from the PDB and display it with residue 59 shown in full use


ProteinResiduePlot3D[ExternalIdentifier["PDBStructureID", "1AKK"], 59]
  • $\begingroup$ Thanks a lot Jason. I got to read quite a lot of your articles during my PhD and then postdoc, very inspiring. I'll be watching out for the updates regarding the XYZ/PDB since my older routines may not work anymore. Best, Jérémy. $\endgroup$
    – J. Rouxel
    Commented Jun 24, 2022 at 19:48
  • $\begingroup$ Great to hear! I tried to wrap this up into a resource function, have a look at it and let me know if you have an feedback or additions to make: wolframcloud.com/obj/jasonb/DeployedResources/Function/… $\endgroup$
    – Jason B.
    Commented Jun 24, 2022 at 20:23
  • $\begingroup$ @J.Rouxel - that function should also increase the quality of the mesh used so the proteins should be smoother. $\endgroup$
    – Jason B.
    Commented Jun 24, 2022 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.