<p>You looked at this <a href="https://github.com/rcsb/mmtf-python" rel="nofollow noreferrer">https://github.com/rcsb/mmtf-python</a> </p>

<p>"The python implementation of the MMTF API, decoder and encoder."</p>

CC BY-SA 3.0
2017-06-13T21:56:16.187Z
but how to use it to convert between MMTF and something else?
marcin
CC BY-SA 3.0
2018-04-28T23:37:29.870Z
There's also a C++ encoder/decoder available here: https://github.com/rcsb/mmtf-cpp
Jose Duarte
CC BY-SA 3.0
2017-06-13T18:55:36.833Z
2017-06-13T18:55:36.833Z
Marcin Magnus
<p>You can use PyMol to change the PDB to mmtf or other format. First open the PDB file and then choose file-&gt;export molecule-&gt; choose which format you want to save as</p>

CC BY-SA 4.0
2021-10-24T05:17:41.950Z
2021-10-24T05:17:41.950Z
NingNing Chen
<p>You can do this with <a href="https://github.com/BioJulia/BioStructures.jl" rel="nofollow noreferrer">BioStructures.jl</a> in Julia. All the 6 transformations between PDB/mmCIF/MMTF are possible.</p>

<p>For example, PDB to MMTF:</p>

<pre><code>using BioStructures
struc = read(in_filepath, PDB)
writemmtf(out_filepath, struc)
</code></pre>

<p>mmCIF to MMTF:</p>

<pre><code>using BioStructures
struc = read(in_filepath, MMCIF)
writemmtf(out_filepath, struc)
</code></pre>

CC BY-SA 4.0
2020-03-31T11:31:48.683Z
2020-03-31T11:31:48.683Z
jgreener
<p>This <a href="https://gist.github.com/sbliven/b7cc2c5305aa3652a75a580ae7c6ce33" rel="nofollow noreferrer">python script</a> uses <a href="https://biopython.org/" rel="nofollow noreferrer">Biopython</a> and does the job well even on large structures. For example:</p>

<p><code>python cif2pdb.py 4ckh-assembly-1.cif 4ckh-assembly-1.pdb</code> </p>

<p>This generates the structure below.</p>

<p><a href="https://i.sstatic.net/wWiJG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wWiJG.png" alt="A large protein structure"></a></p>

CC BY-SA 4.0
2019-11-27T13:50:52.690Z
The question was about converting to/from MMTF.
For PDB <-> mmCIF there are too many tools to list them all. For example, I'm maintaining [gemmi](https://github.com/project-gemmi/gemmi) which should be at least an order of magnitude [faster](https://github.com/project-gemmi/mmcif-benchmark) than BioPython and it also converts more fields (but I'm obviously biased).
marcin
CC BY-SA 4.0
2019-11-27T16:15:16.257Z
@marcin Thanks for the heads up. Since this is probably a more common conversion, I've opened a new [question](https://bioinformatics.stackexchange.com/questions/10896/how-to-quickly-and-robustly-convert-between-mmcif-and-pdb).
James
CC BY-SA 4.0
2019-11-27T12:46:55.427Z
2019-11-27T12:46:55.427Z
James
<p>I wrote a very quick and dirty script to handle conversion between file types using BioJava.</p>

<p><a href="https://github.com/eedlund/Utils/tree/master/BioUtils" rel="nofollow noreferrer">https://github.com/eedlund/Utils/tree/master/BioUtils</a></p>

<p>Download the jar file <a href="https://github.com/eedlund/Utils/raw/master/BioUtils/BioUtils.jar" rel="nofollow noreferrer">here</a></p>

<p>To run: <code>java -jar BioUtils.jar $FILE $TYPE</code></p>

<p>where \$FILE is a PDB or mmCIF file you'd like to convert and \$TYPE is the format of the output file [PDB, CIF, MMTF].</p>

CC BY-SA 3.0
2017-08-03T16:04:14.843Z
Does this take into account biological assemblies, or simply convert e.g. MMTF to a PDB of the asymmetric unit?
Harry
CC BY-SA 3.0
2017-06-14T22:42:30.370Z
2018-04-29T06:03:10.153Z
2018-04-29T06:03:10.153Z
Rosalind Was Robbed
<p>I'd like to test <a href="http://mmtf.rcsb.org" rel="noreferrer">MMTF</a>, a new format for storing biomolecular structures which is promoted by RCSB as a more compact alternative to mmCIF and PDB.</p>

<p>From <a href="http://mmtf.rcsb.org/faq.html" rel="noreferrer">MMTF FAQ</a>:</p>

<blockquote>
  <ul>
  <li><p>How do I convert a PDBx/mmCIF file to an MMTF file?</p>
  
  <p>The BioJava library contains methods to read and write PDBx/mmCIF files and MMTF files.</p></li>
  </ul>
</blockquote>

<p>Can I do such a conversion, ideally from command line, but without writing my own Java program?</p>

<file-formats><pdb><3d-structure>
Converter between PDB or mmCIF and MMTF
# Converter between PDB or mmCIF and MMTF

(Asked by: username_0 on 2017-06-13)

I'd like to test [MMTF](http://mmtf.rcsb.org), a new format for storing biomolecular structures which is promoted by RCSB as a more compact alternative to mmCIF and PDB.

From [MMTF FAQ](http://mmtf.rcsb.org/faq.html):

> * How do I convert a PDBx/mmCIF file to an MMTF file?
>
>   The BioJava library contains methods to read and write PDBx/mmCIF files and MMTF files.

Can I do such a conversion, ideally from command line, but without writing my own Java program?

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

---

## 5 answers

### Answer by username_6 on 2017-06-14. Score: 2 | Accepted answer

I wrote a very quick and dirty script to handle conversion between file types using BioJava.

<https://github.com/eedlund/Utils/tree/master/BioUtils>

Download the jar file [here](https://github.com/eedlund/Utils/raw/master/BioUtils/BioUtils.jar)

To run: `java -jar BioUtils.jar $FILE $TYPE`

where \$FILE is a PDB or mmCIF file you'd like to convert and \$TYPE is the format of the output file [PDB, CIF, MMTF].

> **Comments:**
> **username_7**: Does this take into account biological assemblies, or simply convert e.g. MMTF to a PDB of the asymmetric unit?  

---

### Answer by username_1 on 2017-06-13. Score: 2

You looked at this <https://github.com/rcsb/mmtf-python>

"The python implementation of the MMTF API, decoder and encoder."

> **Comments:**
> **username_0**: but how to use it to convert between MMTF and something else?  
> **username_2**: There's also a C++ encoder/decoder available here: https://github.com/rcsb/mmtf-cpp  

---

### Answer by username_3 on 2021-10-24. Score: 2

You can use PyMol to change the PDB to mmtf or other format. First open the PDB file and then choose file->export molecule-> choose which format you want to save as


---

### Answer by username_4 on 2020-03-31. Score: 2

You can do this with BioStructures.jl in Julia. All the 6 transformations between PDB/mmCIF/MMTF are possible.
For example, PDB to MMTF:
using BioStructures
struc = read(in_filepath, PDB)
writemmtf(out_filepath, struc)

mmCIF to MMTF:
using BioStructures
struc = read(in_filepath, MMCIF)
writemmtf(out_filepath, struc)


---

### Answer by username_5 on 2019-11-27. Score: 1

This [python script](https://gist.github.com/sbliven/b7cc2c5305aa3652a75a580ae7c6ce33) uses [Biopython](https://biopython.org/) and does the job well even on large structures. For example:

`python cif2pdb.py 4ckh-assembly-1.cif 4ckh-assembly-1.pdb`

This generates the structure below.

[![A large protein structure](https://i.sstatic.net/wWiJG.png)](https://i.sstatic.net/wWiJG.png)

> **Comments:**
> **username_0**: The question was about converting to/from MMTF. For PDB <-> mmCIF there are too many tools to list them all. For example, I'm maintaining [gemmi](https://github.com/project-gemmi/gemmi) which should be at least an order of magnitude [faster](https://github.com/project-gemmi/mmcif-benchmark) than BioPython and it also converts more fields (but I'm obviously biased).  
> **username_5**: @marcin Thanks for the heads up. Since this is probably a more common conversion, I've opened a new [question](https://bioinformatics.stackexchange.com/questions/10896/how-to-quickly-and-robustly-convert-between-mmcif-and-pdb).  

---

