File Format Conversion

In order to convert files in ConKit, we need to use the ConKit I/O framework.

Note

ConKit I/O framework consists of three main functions that handle the relevant parsers: read(), write() and convert(). The latter effectively uses the former two but handles everything in one step.

1. Files can be read in ConKit’s internal hierarchies using simple Python code.

>>> import conkit.io
>>> conpred = conkit.io.read('toxd/toxd.mat', 'ccmpred')

2. Contact prediction hierarchies can also be written in a similarly easy format. Using the “conpred“ hierarchy we have created above:

>>> import conkit.io
>>> conkit.io.write('toxd/toxd.rr', 'casprr', conpred)

3. To convert file formats in single call, you can use the :func:`conkit.io.convert` function.

>>> import conkit.io
>>> conkit.io.convert('toxd/toxd.mat', 'ccmpred', 'toxd/toxd.rr', 'casprr')

You can convert these files to many different other formats, for a full list check out the Table of available file formats.