You can install mmtf-java in two ways: downloading with maven or building jar.

Install MMTF from Maven repository

Java API, encoding and decoding libraries are available from Maven Central Repository. Add the dependency to the pom.xml file of your project along the lines of the snippet below.





Install from git repository

You can get latest source code using git.

$ git clone
$ cd mmtf-java
$ mvn package
Then you'll get the mmtf jar file in mmtf-java/target directory.

Getting structures in MMTF format

You can fetch data in MMTF format though the Java API as follows.

 // Get the message pack byte array from the web by PDB code
 MmtfStructure mmtfData = ReaderUtils.getDataFromUrl("4CUP");

 // Decode message pack byte array as flat arrays holding the structural data
 StructureDataInterface dataInterface = new GenericDecoder(mmtfData);

 // Get the number of chains per model
 int[] chainsPerModel = dataInterface.getChainsPerModel();
This interface provides an access to the structural data as flat arrays, instead of the usual hierarchical data encountered in PDB structures: structure to model to chain to group to atom. Use the getChainsPerModel(), getGroupsPerChain(), getGroupTypeIndices() methods to get a hierarchical view of the structure. Refer to API documentation for more information.