Loading...
 

HDF5 Plug-In

Image
The simulation framework 13CFLUX2 uses the HDF5 file format for storing simulation results. The HDF5 Plug-In allows to load these simulation results and for visualization and post-processing in Omix.

Using the Plug-In

After installing the plug-in, the Data Manager is capable to open HDF5 files. From there, the content of the HDF5 file is accessible in the Quick Visualizer and in OVL by standard API (see here).

The Data Manager displays result files from 13CFLUX2 in pre-formatted manner because the data structure of these files are well known. Each table inside of the HDF5 file is listed in the tree view on the left side of the Data Manager sidebar. By clicking on the individual list entries, the table shoes the corresponding file content. The tooltip of the list entries shoes the identifier of the tables. The table identifier is required to address the table in OVL.

Data Manager sidebar showing HDF5 file content
Data Manager sidebar showing HDF5 file content


We strictly recommend to only use the new API to access HDF5 files from inside OVL.

HDF5 Dialog

The content in a HDF5 file can be inspected in the dialog window shown in the next image:

HDF5 content view
HDF5 content view


The dialog appears when you edit an item property of type HDF5File, for instance, as network property:
extend MetabolicNetwork{
    HDF5File hdf5File;
}

From here, you can also change the loaded HDF5 file. Therefore, click the button "Open File" and select the preferred data file.

The HDF5 Dialog displays result files from 13CFLUX2 in pre-formatted manner because the data structure of these files are well known.

Outdated HDF5 Access Classes

As a deprecated feature, you can also use an independent HDF5 loader class to handle HDF5 files in OVL.
Therefore two packages must be imported, ch.systemsx.cisd.hdf5 and omix.lang.io.hdf5:
import omix.lang.io.hdf5.*;
import ch.systemsx.cisd.hdf5.*;
import java.io.File; // for handling files in general


The class HDF5File manages loading an HDF5 file, thus create a new object of HDF5File with target file.
Thereafter, you can call open() to start reading the file. However, in order to avoid errors you can first check the validity of the file:
HDF5File hdf5File = new HDF5File(new File("results.hdf5"));
if(hdf5File.isValid()){
	IHDF5Writer writer = hdf5File.open();
    // or alternatively:
    // IHDF5Reader reader = hdf5File.openForReading();
    // but never both!
}


HDF5 file contain data of arbitrary type in arbitrary combination, organization and order. Thus, there is no simple way to describe how to access data in the HDF5 file because it depends on the file content. In general, the HDF5 Plug-In is based on JHDF5. Refer to the JHDF5 documentation in order to get information about how to navigate in HDF5 files and extract data. The classes IHDF5Reader/Writer is documented in the JHDF5 API docs.

The following code example illustrates how to search for a certain path and extract data from there:

IHDF5Reader reader = ...
if(reader.exists("/flux/names") && reader.exists("/flux/data")){
	MDArray<String> array = reader.string().readMDArray("/flux/names");
	double[][] values = reader.readDoubleMatrix("/flux/data");
	for (var i = 0; i < array.size(); i++) {
		var label = array.get(i);
		var reaction = getReaction(label);
		if(reaction!=null){
			reaction.fluxData = values[i];
		}
	}
}

If you want to use the HDF5 plug-in to load result files from 13CFLUX2 refer to the 13CFLUX documentation in order to find out how the content of the HDF5 files is organized.