Skip to content

fit.petab_v2.conversion

The conversion of a problem of PEtab v1 to PEtab v2, with its simulations.

sbmlsim reads PEtab v2 only. A problem of PEtab v1, e.g. a case of the v1 test suite or a problem of the benchmark collection, is converted once with petab.v2.petab1to2 and read as the problem of PEtab v2 it is then.

The reference simulations of such a problem are tables of PEtab v1, with the conditions of a simulation (simulationConditionId, preequilibrationConditionId) where PEtab v2 has its experiment (experimentId). They are converted with the problem: the problem with the simulations in place of its measurements is converted as well, so the simulations get the experiments petab1to2 gives the measurements, and are compared with a simulation of the problem of PEtab v2 row by row. Nothing after the conversion reads PEtab v1.

convert_v1

convert_v1(yaml_file, output_dir, simulation_files=())

Convert a problem of PEtab v1 and its simulations to PEtab v2.

Parameters:

Name Type Description Default
yaml_file Path

the YAML file of the problem of PEtab v1.

required
output_dir Path

the directory the problem of PEtab v2 is written to, it must not exist or be empty.

required
simulation_files Sequence[Path]

the tables of the reference simulations of the problem, in PEtab v1; they are written to SIMULATIONS_FILE of the output directory as one table of PEtab v2, i.e. a measurement table with the column simulation.

()

Returns:

Type Description
Path | None

The table of the simulations, None without simulation files.

Raises:

Type Description
Exception

what petab1to2 raises for a problem it cannot convert.

convert_simulations

convert_simulations(yaml_file, simulation_files)

Convert the simulations of a problem of PEtab v1 to PEtab v2.

Parameters:

Name Type Description Default
yaml_file Path

the YAML file of the problem of PEtab v1.

required
simulation_files Sequence[Path]

the tables of its simulations, in PEtab v1.

required

Returns:

Type Description
DataFrame

The simulations as one table of PEtab v2, i.e. a measurement table

DataFrame

with the experiments petab1to2 gives the measurements and the

DataFrame

column simulation.

Raises:

Type Description
Exception

what petab1to2 raises for a problem it cannot convert.

measurement_table

measurement_table(directory)

Read the measurement tables of a problem of PEtab v2 as one table.

Parameters:

Name Type Description Default
directory Path

the directory of the problem, with its one YAML file.

required

Returns:

Type Description
DataFrame

The measurements in the order of the files of the problem.

Raises:

Type Description
ValueError

if the directory has no YAML file or the problem no measurement table.