BioJava:CookBook:PDB:mmcif
From BioJava
How do I read a .mmcif file?
mmcif is an alternative file format to PDB files ( 1,2 ). It is not entirely easy to write a parser for it, as such BioJava solves this problem for you. The mmcif files are parsed into the same BioJava data structure as the PDB files. The example below demonstrates how to load the content into the BioJava data model for protein structures. The design of the source code allows you to also hook in your own data model. For this you will require to implement the MMcifConsumer interface.
The mmcif parsing code is still under development and will be released with the next biojava release. To use it at the moment you will require a recent build from SVN.
@since 1.7 public static void main(String[] args){ String fileName = args[0]; InputStream inStream = new FileInputStream(fileName); MMcifParser parser = new SimpleMMcifParser(); SimpleMMcifConsumer consumer = new SimpleMMcifConsumer(); // The Consumer builds up the BioJava - structure object. // you could also hook in your own and build up you own data model. parser.addMMcifConsumer(consumer); try { parser.parse(new BufferedReader(new InputStreamReader(inStream))); } catch (IOException e){ e.printStackTrace(); } // now get the protein structure. Structure cifStructure = consumer.getStructure(); }
For more info on how to work with the BioJava structure data model see BioJava:CookBook:PDB:atoms.

