<blockquote>
<p>comments from above fleshed out.</p>
</blockquote>
<p>Both: A graph network is a handy way to represent a molecule, but a matrix makes for fast maths.</p>
<p>A graph network is a list of <code>nodes</code> (atoms), a list of <code>edges</code>, the connections between nodes and a list of <code>properties</code> associated with the nodes (symbol, name, index, residue index, residue number, chain, coordinates etc.) and occasionally a list of those of the edges (single, double etc.).</p>
<p>A protein is a big molecule. Same rules apply.
A small compound can be represented with a string, i.e. SMILES, which is a form of graph network even if it looks nothing like one.
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/SMILES.png/300px-SMILES.png" alt="SMILES" /></p>
<p>In a mol file and its sdf/mol2 derivatives, a tabular representation is used to store coordinates (<code>properties</code>) of the atoms of the small molecule (top part below), while the connectivity has an edge-node relationship, i.e. are edges. Note that the index of the properties in the first block is the id of the atom.</p>
<pre><code>     RDKit          3D

 12 12  0  0  0  0  0  0  0  0999 V2000
   -5.5310   24.4560   -8.2060 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.9560   21.4190   -7.6300 O   0  0  0  0  0  0  0  0  0  0  0  0
   -5.4170   23.9250   -6.8750 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.2770   19.3290   -8.7330 O   0  0  0  0  0  0  0  0  0  0  0  0
   -3.9460   23.5670   -6.5510 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.3270   19.7590   -6.4400 O   0  0  0  0  0  0  0  0  0  0  0  0
   -3.4590   22.5590   -7.5870 N   0  0  0  0  0  0  0  0  0  0  0  0
   -3.5890   23.1360   -8.9920 C   0  0  0  0  0  0  0  0  0  0  0  0
   -5.0600   23.5190   -9.2240 C   0  0  0  0  0  0  0  0  0  0  0  0
   -2.0390   22.1150   -7.2780 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6090   21.0030   -8.2230 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.0430   20.3530   -7.7350 S   0  0  1  0  0  0  0  0  0  0  0  0
  1  3  1  0
  1  9  1  0
  3  5  1  0
  9  8  1  0
 12  2  1  1
 12  4  1  0
 12  6  1  0
 12 11  1  0
  5  7  1  0
  7  8  1  0
  7 10  1  0
 10 11  1  0
M  END
</code></pre>
<p>A PDB, CIF, etc. file is the same. It has a per-atom tabular representation of the properties, with an optional connectivity part (<code>CONECT</code> entries) for non-standard residues (not AAs and DNA).</p>
<p>Now when these are loaded into memory, they become an array of atoms and bonds, each with their properties —graph network.</p>
<p>However, the coordinates within get often converted into a matrix for speedy operations.
For example to calculate an atom to atom distance matrix, converting the coordinates with the array of atoms to a matrix can be very easily be converted into a distance matrix via simple matrix calculations.</p>
<p>So both matrix representations and graph network representations are used.</p>
<p>For 3D visualisation, a pre-existing library is used and bonds and atoms become primitive shapes, whose splines may be connected to each other (in knots/vertices) or simply the bonds shapes clip through the atoms. That is there is not graph relationship.</p>

CC BY-SA 4.0
2021-07-29T12:32:54.403Z
2021-07-29T12:32:54.403Z
Matteo Ferla
<p>What data structure is used in representing protein structures in computers so that we can apply algorithms?</p>
<p>Matrix or Graph or tree?</p>
<p><strong>P.S.</strong> I am absolutely new to Bioinformatics.</p>

CC BY-SA 4.0
2021-07-20T10:59:15.557Z
the same was asked on SO: https://stackoverflow.com/questions/68452847/how-are-tertiary-protein-structures-represented-in-computers
marcin
CC BY-SA 4.0
2021-07-20T14:55:39.180Z
This is too vague to answer.  A small compound can be represented with a string (SMILES, no 3D data though), a matrix (mol file) or a graph network object (eg. a RDKit Chem object), yet some methods return matrices (e.g. distance). The same goes for a protein...
Matteo Ferla
CC BY-SA 4.0
2021-07-20T15:04:06.867Z
@MatteoFerla, what more info do u need to make this question clearer?
user366312
CC BY-SA 4.0
2021-07-20T16:20:46.340Z
You kind of have answered the question in the questions. Both matrix and graph are used to represent structures in memory, but they have different uses. Some algorithms will use one or the other.
A PDB, CIF, etc. file is basically a matrix presentation.
But a major pressure for a graph network is if they do not operate in cartesian space (x,y,z) but torsion/dihedral space (d,φ,ψ).
Matteo Ferla
<protein-structure>
How are tertiary protein structures represented in computers?
# How are tertiary protein structures represented in computers?

(Asked by: username_0 on 2021-07-20)

What data structure is used in representing protein structures in computers so that we can apply algorithms?

Matrix or Graph or tree?

**P.S.** I am absolutely new to Bioinformatics.

**Tags:** protein-structure
> **Comments:**
> **username_1**: the same was asked on SO: https://stackoverflow.com/questions/68452847/how-are-tertiary-protein-structures-represented-in-computers  
> **username_2**: This is too vague to answer.  A small compound can be represented with a string (SMILES, no 3D data though), a matrix (mol file) or a graph network object (eg. a RDKit Chem object), yet some methods return matrices (e.g. distance). The same goes for a protein...  
> **username_0**: @MatteoFerla, what more info do u need to make this question clearer?  
> **username_2**: You kind of have answered the question in the questions. Both matrix and graph are used to represent structures in memory, but they have different uses. Some algorithms will use one or the other. A PDB, CIF, etc. file is basically a matrix presentation. But a major pressure for a graph network is if they do not operate in cartesian space (x,y,z) but torsion/dihedral space (d,φ,ψ).  

---

## 1 answers

### Answer by username_2 on 2021-07-29. Score: 4 | Accepted answer

comments from above fleshed out.

Both: A graph network is a handy way to represent a molecule, but a matrix makes for fast maths.
A graph network is a list of nodes (atoms), a list of edges, the connections between nodes and a list of properties associated with the nodes (symbol, name, index, residue index, residue number, chain, coordinates etc.) and occasionally a list of those of the edges (single, double etc.).
A protein is a big molecule. Same rules apply.
A small compound can be represented with a string, i.e. SMILES, which is a form of graph network even if it looks nothing like one.

In a mol file and its sdf/mol2 derivatives, a tabular representation is used to store coordinates (properties) of the atoms of the small molecule (top part below), while the connectivity has an edge-node relationship, i.e. are edges. Note that the index of the properties in the first block is the id of the atom.
     RDKit          3D

 12 12  0  0  0  0  0  0  0  0999 V2000
   -5.5310   24.4560   -8.2060 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.9560   21.4190   -7.6300 O   0  0  0  0  0  0  0  0  0  0  0  0
   -5.4170   23.9250   -6.8750 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.2770   19.3290   -8.7330 O   0  0  0  0  0  0  0  0  0  0  0  0
   -3.9460   23.5670   -6.5510 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.3270   19.7590   -6.4400 O   0  0  0  0  0  0  0  0  0  0  0  0
   -3.4590   22.5590   -7.5870 N   0  0  0  0  0  0  0  0  0  0  0  0
   -3.5890   23.1360   -8.9920 C   0  0  0  0  0  0  0  0  0  0  0  0
   -5.0600   23.5190   -9.2240 C   0  0  0  0  0  0  0  0  0  0  0  0
   -2.0390   22.1150   -7.2780 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6090   21.0030   -8.2230 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.0430   20.3530   -7.7350 S   0  0  1  0  0  0  0  0  0  0  0  0
  1  3  1  0
  1  9  1  0
  3  5  1  0
  9  8  1  0
 12  2  1  1
 12  4  1  0
 12  6  1  0
 12 11  1  0
  5  7  1  0
  7  8  1  0
  7 10  1  0
 10 11  1  0
M  END

A PDB, CIF, etc. file is the same. It has a per-atom tabular representation of the properties, with an optional connectivity part (CONECT entries) for non-standard residues (not AAs and DNA).
Now when these are loaded into memory, they become an array of atoms and bonds, each with their properties —graph network.
However, the coordinates within get often converted into a matrix for speedy operations.
For example to calculate an atom to atom distance matrix, converting the coordinates with the array of atoms to a matrix can be very easily be converted into a distance matrix via simple matrix calculations.
So both matrix representations and graph network representations are used.
For 3D visualisation, a pre-existing library is used and bonds and atoms become primitive shapes, whose splines may be connected to each other (in knots/vertices) or simply the bonds shapes clip through the atoms. That is there is not graph relationship.


---

