<p>Consider <strong>mmJSON</strong>.</p>
<p>Each of the three PDB sites had the same problem: using mmCIF files in web-based viewers is inefficient. To solve this problem three new file formats were introduced:</p>
<ul>
<li>MMTF at RCSB,</li>
<li>BinaryCIF at PDBe,</li>
<li>mmJSON at PDBj.</li>
</ul>
<p><strong>MMTF</strong> has the smallest files – it's aggressively optimized for size.
It is based on MessagePack, but on top of it uses a number of custom compression schemes, which make the format rather complex.
Usually it's not a problem – MMTF developers made an effort to provide libraries for reading MMTF files in the most popular programming languages. But you need to install these libraries.
To make the file smaller, MMTF doesn't contain all the metadata from mmCIF, which may be a blocker in some cases.
What is nice is that the MMTF developers reached out to other developers in this field, organized some gathering and they were taking comments and suggestions from the outside.
As the result, a few popular programs such as PyMOL and JMol can also read MMTF.</p>
<p><strong>BinaryCIF</strong> is clearly based on (or at least inspired by) MMTF.
So it's also built on top of MessagePack with a number of custom compression schemes.
It includes all the mmCIF metadata, which makes the files slightly bigger, but I think it's a good trade-off.
Initially there was only TypeScript code for reading it, now I see that there are also implementations in Java in Python.</p>
<p><strong>mmJSON</strong> is 1:1 equivalent of mmCIF, but uses JSON instead of CIF.
There is no extra compression added, but having the data from mmCIF re-ordered column-wise makes gzip compression much more efficient (this was also noted by MMTF developers).
If the file is stored as json.gz or downloaded in web browser (with the usual compression between the server and the client) its size is 30-40% of gzipped mmCIF. It's not as small as MMTF and BinaryCIF (which are several times smaller than mmCIF) and this is the only downside.</p>
<p>The advantage is that you can read in it any language like all other JSON files.
No need to install/update MessagePack + MMTF/BinaryCIF libraries.</p>
<p>A few years ago I compared reading MMTF and mmJSON in Python – reading mmJSON was order of magnitude faster. It may be very different with libraries in other languages, but generally JSON parsers are fast.
The fastest ones parse GBs per second. Reading binary formats can be faster, but decompression schemes can also make it slower.
Anyway, all the three formats are fast enough to read.</p>
<p>Sadly, I don't think that mmJSON is as popular as it should be.
Perhaps I'm the only person using it outside of PDBj.
That's why I'm writing this answer.</p>
<p>The mmJSON files are available at:
<a href="https://pdbj.org/help/mmjson" rel="nofollow noreferrer">https://pdbj.org/help/mmjson</a></p>

CC BY-SA 4.0
2021-09-29T14:33:22.587Z
Thanks ! Really useful added context and experience.

Your POV on mmJSON is really interesting if one want to read/parse it in a JS or Python based stack.

Do you know if pdbj.org is in good sync with rcsb.org (on which we sync regularly)?


Is the transformation mmCIF => mmJSON reliable (Matteo said above that some conversions are glitchy)?
ashas
CC BY-SA 4.0
2021-09-29T21:06:46.043Z
@ashas all the wwPDB sites are updated on Wednesdays. I suppose the conversion is reliable, I don't know about any problems.
marcin
CC BY-SA 4.0
2021-09-25T15:07:46.940Z
2021-09-25T15:17:40.513Z
2021-09-25T15:17:40.513Z
marcin
<p>So binaryCIF is newer and is heavily inspired by MMTF.</p>
<p><a href="https://github.com/nglviewer/ngl" rel="nofollow noreferrer">NGL</a>, the most &quot;loved&quot; JS library (IMO) to show protein fetches proteins as MMTF, while Mol* uses bCIF —Mol* has the official repo of the bCIF format. Alex Rose, developed the former at the RCSB PDB, and the latter in collaboration with the PDBe. He also worked with Antony Bradley, the main author on the MMTF format, who left the RCSB PDB, some 4+ years ago. So there is definitely no competition there.</p>
<ul>
<li>The MMTF download of the RCSB works well: <a href="https://mmtf.rcsb.org/download.html" rel="nofollow noreferrer">https://mmtf.rcsb.org/download.html</a></li>
<li>The MMTF format did not catch on —okay, mmCIF is only slowly replacing PDB, which is still the only accepted format for analyses—, hence the need for a bCIF format</li>
<li>The libraries to do the conversion aren't without glitches</li>
<li>In the distant future bCIF will be the sole binary format</li>
<li>mmCIF &lt;--&gt; bCIF conversion is easier</li>
</ul>
<p>However, I really ought to stress that mmCIF is a better choice to bCIF or mmTF. And even then many tools still hate mmCIFs and use PDB format.
If memory footprint is not really a problem, then stick with mmCIF. If you are running a webserver, you may be sending data as gzipped making this a moot point.</p>
<p>Last year for my site, <a href="https://michelanglo.sgc.ox.ac.uk/" rel="nofollow noreferrer">michelanglo</a>, I was faced with a dilemma: Mol* has dotted lines for gaps and does not crash the browser with a virus or  someone wanting to show hyperball representation on all residues. However, it was not documented (and then glitchy) so I firmly stuck with NGL, which is excellent. For file formats, I stick with PDB and a metadata dictionary as I know the format well and is despite having the jankiest syntax and no real metadata support (REMARK... ha!), does not break isopetides, disulfides or for no apparent reason.</p>

CC BY-SA 4.0
2020-11-07T21:15:42.077Z
Good post. As stated, pdb (from the age of Fortran) remains a strong favourite
M__
CC BY-SA 4.0
2020-11-09T08:20:01.127Z
Thanks a lot for this useful and detailed response : a lot of context, exactly what I needed.

We'll use MMTF essentially to send files to NGL (as you have guessed ;) ), internally our tools will work with PDB and mmCIF.

I'll keep an eye on bCIF, as Mol* has impressive tools (but not needed at our current stage). 

Have a nice day and thanks again !
ashas
CC BY-SA 4.0
2020-11-07T19:41:34.710Z
2021-09-29T04:27:00.717Z
2021-09-29T04:27:00.717Z
Matteo Ferla
<p>Both file formats are advertised as more memory/parsing efficent than old PDB format and its successor mmCIF format, but I can't understand the context (I'm a developer, but pretty new to the field of bioinformatics).</p>
<p>Is BinaryCIF a later iteration of MMTF concepts/ideas (so it's a new competing format) or is the purpose of the two formats different ?</p>
<p>Refs :</p>
<ul>
<li>BinaryCIF: <a href="https://github.com/dsehnal/BinaryCIF" rel="noreferrer">https://github.com/dsehnal/BinaryCIF</a></li>
<li>MMTF: <a href="http://mmtf.rcsb.org/index.html" rel="noreferrer">http://mmtf.rcsb.org/index.html</a></li>
</ul>

<file-formats><pdb><3d-structure>
BinaryCIF vs MMTF formats, which one to choose?
# BinaryCIF vs MMTF formats, which one to choose?

(Asked by: username_0 on 2020-11-06)

Both file formats are advertised as more memory/parsing efficent than old PDB format and its successor mmCIF format, but I can't understand the context (I'm a developer, but pretty new to the field of bioinformatics).

Is BinaryCIF a later iteration of MMTF concepts/ideas (so it's a new competing format) or is the purpose of the two formats different ?

Refs :

* BinaryCIF: <https://github.com/dsehnal/BinaryCIF>
* MMTF: <http://mmtf.rcsb.org/index.html>

**Tags:** file-formats, pdb, 3d-structure

---

## 2 answers

### Answer by username_2 on 2020-11-07. Score: 6 | Accepted answer

So binaryCIF is newer and is heavily inspired by MMTF.

[NGL](https://github.com/nglviewer/ngl), the most "loved" JS library (IMO) to show protein fetches proteins as MMTF, while Mol\* uses bCIF —Mol\* has the official repo of the bCIF format. Alex Rose, developed the former at the RCSB PDB, and the latter in collaboration with the PDBe. He also worked with Antony Bradley, the main author on the MMTF format, who left the RCSB PDB, some 4+ years ago. So there is definitely no competition there.

* The MMTF download of the RCSB works well: <https://mmtf.rcsb.org/download.html>
* The MMTF format did not catch on —okay, mmCIF is only slowly replacing PDB, which is still the only accepted format for analyses—, hence the need for a bCIF format
* The libraries to do the conversion aren't without glitches
* In the distant future bCIF will be the sole binary format
* mmCIF <--> bCIF conversion is easier

However, I really ought to stress that mmCIF is a better choice to bCIF or mmTF. And even then many tools still hate mmCIFs and use PDB format.
If memory footprint is not really a problem, then stick with mmCIF. If you are running a webserver, you may be sending data as gzipped making this a moot point.

Last year for my site, [michelanglo](https://michelanglo.sgc.ox.ac.uk/), I was faced with a dilemma: Mol\* has dotted lines for gaps and does not crash the browser with a virus or someone wanting to show hyperball representation on all residues. However, it was not documented (and then glitchy) so I firmly stuck with NGL, which is excellent. For file formats, I stick with PDB and a metadata dictionary as I know the format well and is despite having the jankiest syntax and no real metadata support (REMARK... ha!), does not break isopetides, disulfides or for no apparent reason.

> **Comments:**
> **username_3**: Good post. As stated, pdb (from the age of Fortran) remains a strong favourite  
> **username_0**: Thanks a lot for this useful and detailed response : a lot of context, exactly what I needed.  We'll use MMTF essentially to send files to NGL (as you have guessed ;) ), internally our tools will work with PDB and mmCIF.  I'll keep an eye on bCIF, as Mol* has impressive tools (but not needed at our current stage).   Have a nice day and thanks again !  

---

### Answer by username_1 on 2021-09-25. Score: 2

Consider **mmJSON**.

Each of the three PDB sites had the same problem: using mmCIF files in web-based viewers is inefficient. To solve this problem three new file formats were introduced:

* MMTF at RCSB,
* BinaryCIF at PDBe,
* mmJSON at PDBj.

**MMTF** has the smallest files – it's aggressively optimized for size.
It is based on MessagePack, but on top of it uses a number of custom compression schemes, which make the format rather complex.
Usually it's not a problem – MMTF developers made an effort to provide libraries for reading MMTF files in the most popular programming languages. But you need to install these libraries.
To make the file smaller, MMTF doesn't contain all the metadata from mmCIF, which may be a blocker in some cases.
What is nice is that the MMTF developers reached out to other developers in this field, organized some gathering and they were taking comments and suggestions from the outside.
As the result, a few popular programs such as PyMOL and JMol can also read MMTF.

**BinaryCIF** is clearly based on (or at least inspired by) MMTF.
So it's also built on top of MessagePack with a number of custom compression schemes.
It includes all the mmCIF metadata, which makes the files slightly bigger, but I think it's a good trade-off.
Initially there was only TypeScript code for reading it, now I see that there are also implementations in Java in Python.

**mmJSON** is 1:1 equivalent of mmCIF, but uses JSON instead of CIF.
There is no extra compression added, but having the data from mmCIF re-ordered column-wise makes gzip compression much more efficient (this was also noted by MMTF developers).
If the file is stored as json.gz or downloaded in web browser (with the usual compression between the server and the client) its size is 30-40% of gzipped mmCIF. It's not as small as MMTF and BinaryCIF (which are several times smaller than mmCIF) and this is the only downside.

The advantage is that you can read in it any language like all other JSON files.
No need to install/update MessagePack + MMTF/BinaryCIF libraries.

A few years ago I compared reading MMTF and mmJSON in Python – reading mmJSON was order of magnitude faster. It may be very different with libraries in other languages, but generally JSON parsers are fast.
The fastest ones parse GBs per second. Reading binary formats can be faster, but decompression schemes can also make it slower.
Anyway, all the three formats are fast enough to read.

Sadly, I don't think that mmJSON is as popular as it should be.
Perhaps I'm the only person using it outside of PDBj.
That's why I'm writing this answer.

The mmJSON files are available at:
<https://pdbj.org/help/mmjson>

> **Comments:**
> **username_0**: Thanks ! Really useful added context and experience.  Your POV on mmJSON is really interesting if one want to read/parse it in a JS or Python based stack.  Do you know if pdbj.org is in good sync with rcsb.org (on which we sync regularly)?   Is the transformation mmCIF => mmJSON reliable (Matteo said above that some conversions are glitchy)?  
> **username_1**: @ashas all the wwPDB sites are updated on Wednesdays. I suppose the conversion is reliable, I don't know about any problems.  

---

