Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Import protein data in the Protein Data Bank (PDB) format
| ResourceFunction["PDBImport"][src] applies a PDB import to the source src. | |
| ResourceFunction["PDBImport"][src,"String"] imports protein data from the source src as a string of PDB format. | |
| ResourceFunction["PDBImport"][src, "AtomAssociation"] imports a protein atom Association from the source src in the RCSB Protein Data Bank format. | |
| ResourceFunction["PDBImport"][src,row] imports a protein atom starting from the specified row. | |
| ResourceFunction["PDBImport"][provider→identifier,…] imports the protein data from the given provider with the identifer appropriate to that provider. | 
Import a PDB file corresponding to an RCSB ID:
| In[1]:= | ![ResourceFunction["PDBImport"]["RCSB" -> "3J3I"]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/26312eb91ecd6f5a.png) | 
| Out[1]= |  | 
Import an Association of atomic properties corresponding to an RCSB ID:
| In[2]:= | ![data = ResourceFunction["PDBImport"]["RCSB" -> "3J3I", "AtomAssociation"]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/55430043f1853233.png) | 
| Out[2]= |  | 
Extract the x-coordinates:
| In[3]:= | ![data["XCoordinate"] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/115884eb9b62a283.png) | 
| Out[3]= |  | 
Extract the atom types:
| In[4]:= | ![data["Atom"] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/5db465e86d573549.png) | 
| Out[4]= |  | 
Extract the atomic masses:
| In[5]:= | ![data["Mass"] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/724a6c1ffb007a53.png) | 
| Out[5]= |  | 
Import an RCSB data file starting from row 154:
| In[6]:= | ![data = ResourceFunction["PDBImport"][
  "https://files.rcsb.org/download/3J3I.pdb1.gz", 154]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/5b8969aff0f66a5c.png) | 
| Out[6]= |  | 
Extract the x-coordinates:
| In[7]:= | ![data["XCoordinate"] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/50d7db3d4ac66e20.png) | 
| Out[7]= |  | 
Extract the atom types:
| In[8]:= | ![data["Atom"][[1]] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/14efa7d08b926c90.png) | 
| Out[8]= |  | 
Import an RCSB data file as a PDB string:
| In[9]:= | ![pdbString = ResourceFunction["PDBImport"][
  "https://files.rcsb.org/download/3J3I.pdb1.gz", "String"]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/75c17efdb9f1dc0c.png) | 
| Out[9]= |  | 
Extract the x-coordinates using PDB import (which converts to picometers):
| In[10]:= | ![First[Transpose[
   ImportString[pdbString, {"PDB", "VertexCoordinates"}]]] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/39e6e01ab528c0d1.png) | 
| Out[10]= |  | 
Extract the atom types:
| In[11]:= | ![Flatten[ImportString[pdbString, {"PDB", "ResidueAtoms"}]] // Short](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/253fa3bf70318d75.png) | 
| Out[11]= |  | 
Extract a protein chain and calculate the center of mass of its subunits:
| In[12]:= | ![data = ResourceFunction["PDBImport"][
   "https://files.rcsb.org/download/3J3I.pdb1.gz", "AtomAssociation"];](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/0d755640e8939c17.png) | 
| In[13]:= | ![centermass[mass_, coor_] := Sum[mass[[i]]* coor[[i]], {i, Length[mass]}]  /
  Sum[mass[[i]], { i, Length[mass]}]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/7004147e5911d337.png) | 
| In[14]:= | ![xset = MapThread[centermass, {data["Mass"], data["XCoordinate"]}];
yset = MapThread[centermass, {data["Mass"], data["YCoordinate"]}];
zset = MapThread[centermass, {data["Mass"], data["ZCoordinate"]}];](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/0a3f27456d89d45a.png) | 
| In[15]:= | ![cmass = Transpose[{xset, yset, zset}];](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/0931a7c6e1ce69bd.png) | 
Plot the center of mass of the subunits:
| In[16]:= | ![Graphics3D[ {PointSize[0.02], Pink, Point[cmass]}]](https://www.wolframcloud.com/obj/resourcesystem/images/e30/e304aadb-6c4b-41a1-a7d2-8c1e941054bc/780c8157cda2e41e.png) | 
| Out[16]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License