Bio Files: Read and write common biology file formats
This library contains functionality to load and save data in common biology file formats. It operates on data structures that are specific to each file format; you will need to convert to and from the structures used by your application. The API docs, and examples below are sufficient to get started.
Currently supported formats:
- Mol2 (Molecules)
- SDF (Molecules)
- Map (Electron density, e.g. from crystallography, Cryo EM)
- AB1 (Sequence tracing)
- FRCMOD (Amber force field data for small molecules)
Planned:
- PDBQT
- MTZ
- DNA
- CIF structure formats (2fo-fc etc)
For Genbank, we recommend GB-IO. For atom coordinate mmCIF and PDB, we recommend PDBTBX. We do not plan to support these in these formats in bio_files due to these high-quality libraries.
The API is straightforward to use. It operates using structs with public fields, which you can explore
using the API docs, or your IDE. These structs generally include these three methods: new(), save() and load().
new() accepts &str for text files, and a R: Read + Seek for binary. save() and load() accept &Path.
Example use:
/// A single endpoint to save a number of file types
Note that the above examples expect that your application has a struct representing the molecule that has
From<Mol2>, and to_mol2(&self) (etc) methods. The details of these depend on the application. For example: