Wolfram Research

Function Repository Resource:

PDBImport

Source Notebook

Import protein data in the Protein Data Bank (PDB) format

Contributed by: Jihyeon Je

ResourceFunction["PDBImport"][src,row]

imports protein data from the source file src in the RCSB Protein Data Bank format starting from the specified row.

Details and Options

In PDBImpot[src,], src can be a local file or a URL.
ResourceFunction["PDBImport"] returns an association with elements “Atom”, “Mass”, “XCoordinate”, “YCoordinate” , and “ZCoordinate” representing atomic mass and coordinates.

Examples

Basic Examples

Import an RCSB data file starting from row 154:

In[1]:=
data = ResourceFunction["PDBImport"][
  "https://files.rcsb.org/download/3J3I.pdb1.gz", 154]
Out[1]=

Extract the x coordinates:

In[2]:=
data["XCoordinate"]
Out[2]=

Extract some atom types:

In[3]:=
data["Atom"][[1]] // Short
Out[3]=

Neat Examples

Extract a protein chain and calculate the center of mass of its subunits:

In[4]:=
data = ResourceFunction["PDBImport"][
   "https://files.rcsb.org/download/3J3I.pdb1.gz", 154];
In[5]:=
centermass[mass_, coor_] := Sum[mass[[i]]* coor[[i]], {i, Length[mass]}]  /
  Sum[mass[[i]], { i, Length[mass]}]
In[6]:=
xset = MapThread[centermass, {data["Mass"], data["XCoordinate"]}];
yset = MapThread[centermass, {data["Mass"], data["YCoordinate"]}];
zset = MapThread[centermass, {data["Mass"], data["ZCoordinate"]}];
In[7]:=
cmass = Transpose[{xset, yset, zset}];

Plot the center of mass of the subunits:

In[8]:=
Graphics3D[ {PointSize[0.02], Pink, Point[cmass]}]
Out[8]=

Resource History

See Also

License Information