10.1.2.1.2. freeflux.core.mdv

Define the MDV class.

10.1.2.1.2.1. Attributes

__author__

natAbuns

10.1.2.1.2.2. Classes

MDV

Define MDV (i.e., mass isotopomer distribution vector) object and its operations.

10.1.2.1.2.3. Functions

_isotopomer_combination(n_atoms, n_natural_isotops)

get_natural_MDV(n_atoms[, base_atom])

Calculate the MDV of an unlabeled fragment.

get_substrate_MDV(atom_nos, labeling_pattern, ...[, ...])

Calculate the MDV of a fragment from labeled substrate.

gen_conv(arr1, arr2)

conv(mdv1, mdv2)

Perform convolution between two MDVs.

diff_conv(mdv_mdvder1, mdv_mdvder2)

10.1.2.1.2.4. Module Contents

freeflux.core.mdv.__author__ = 'Chao Wu'[source]
freeflux.core.mdv.natAbuns[source]
class freeflux.core.mdv.MDV(fractions, nonnegative=True, normalize=True, base_atom='C')[source]

Define MDV (i.e., mass isotopomer distribution vector) object and its operations.

Convolution between mdv1 and mdv2 can be performed in three ways: 1. mdv1.conv(mdv2); 2. mdv1*mdv2; 3. mdv.conv(mdv1, mdv2).

The zero element for convolution is MDV([0]), and the identity element is MDV([1]).

Scalar multiplication (a*mdv) and MDV addition (mdv1 + mdv2) are also supported. In these cases, the resulting MDV are not automatically normalized.

In addition to C, MDV can be built based on H, N, O, Si, and S.

Parameters:
  • fractions (list or array) – MDV vector.

  • nonnegative (bool) – Whether to keep the elements >= 0.

  • normalize (bool) – Whether to normalize MDV vector to ensure the sum equals one.

  • base_atom (str) – Base atom for MDV.

value[source]

MDV vector.

Type:

array

n_atoms[source]

# of atom.

Type:

int

base_atom[source]

Base atom for MDV.

Type:

str

fl(or fractional_labeling)[source]

Fractional labeling.

Type:

float

value[source]
base_atom = 'C'[source]
__iter__()[source]
__getitem__(key)[source]
Parameters:

key (int or slice) – Index.

__array__()[source]
conv(mdv)[source]

Note. Assume that the mdv convolved has the same base atom.

Parameters:

mdv (list or array or MDV)

__mul__(other)[source]
Parameters:

other (scalar, list, array or MDV)

__rmul__(other)[source]
Parameters:

other (MDV)

__add__(other)[source]
Parameters:

other (MDV)

__radd__(other)[source]
Parameters:

other (MDV)

_correction_matrix(X, n_Xs)[source]
Parameters:
  • X (str) – Which element the correction matrix will be generated for.

  • n_Xs (int) – # of X atoms in metabolite or metabolite fragment, these atoms will be corrected.

correct_for_natural_abundance(atom_dict)[source]
Parameters:

atom_dict (dict) – element needs to be corrected => # of corresponding atoms in metabolite (fragment).

correct_for_inoculum(fraction)[source]
Parameters:

fraction (float in [0, 1]) – Fraction of inoculum in biomass measured.

property n_atoms[source]
property fl[source]
fractional_labeling[source]
__repr__()[source]
freeflux.core.mdv._isotopomer_combination(n_atoms, n_natural_isotops)[source]
Parameters:
  • n_atoms (int) – # of atoms.

  • n_natural_isotops (int) – # of natural isotopmers.

Returns:

combs2

Return type:

dict

Example

>>> _isotopomer_combination(2, 3)
OrderedDict([(0, [Counter({0: 2})]), (1, [Counter({0: 1, 1: 1})]), (2, [Counter({0: 1, 2: 1}),
Counter({1: 2})]), (3, [Counter({1: 1, 2: 1})]), (4, [Counter({2: 2})])])
freeflux.core.mdv.get_natural_MDV(n_atoms, base_atom='C')[source]

Calculate the MDV of an unlabeled fragment.

Parameters:
  • n_atoms (int) – # of atoms.

  • base_atom (str) – Base atom for MDV.

freeflux.core.mdv.get_substrate_MDV(atom_nos, labeling_pattern, percentage, purity, label_atom='C')[source]

Calculate the MDV of a fragment from labeled substrate. Currently this function only supports H, C or N-labeled substrate.

Parameters:
  • atom_nos (list of int) – Atom NOs, starting from 1.

  • labeling_pattern (str or list of str) –

    Labeling pattern of substrate, ‘0’ for unlabeled atom, ‘1’ for labeled atom, e.g., ‘100000’ for 1-13C glucose.

    List if tracer with multiple labeling patterns are used.

    Natural substrate (with all ‘0’s) don’t need to be explicitly set.

    If str, labeling_pattern should not be natural substrate.

  • percentage (float or list of float) –

    Molar percentage (in range of [0,1]) of corresponding tracer. Sum of percentage should be <= 1, and the rest will be considered as natural substrate.

    List if tracer with multiple labeling patterns are used.

    • If list, len(percentage) should be equal to len(labeling_pattern).

    • If float, labeling_pattern should not be natural substrate.

  • purity (float or list of float) –

    Labeled atom purity (in range of [0,1]) of corresponding tracer.

    List if tracer with multiple labeling patterns are used.

    • If list, len(purity) should be equal to len(labeling_pattern).

    • If float, labeling_pattern should not be natural substrate.

  • label_atom (str) – Labeled atom, i.e., base atom in the MDV. Currently supports only “H”, “C” and “N”.

freeflux.core.mdv.gen_conv(arr1, arr2)[source]
Parameters:
  • arr1 (list or array) – If one of the arrs is 2-D, the function performs 2-D convolution of MDV (array) and MDV derivative.

  • arr2 (list or array) – If one of the arrs is 2-D, the function performs 2-D convolution of MDV (array) and MDV derivative.

freeflux.core.mdv.conv(mdv1, mdv2)[source]

Perform convolution between two MDVs.

Parameters:
Returns:

mdv

Return type:

MDV

freeflux.core.mdv.diff_conv(mdv_mdvder1, mdv_mdvder2)[source]
Parameters:
  • mdv_mdvder1 (2-list of arrays) – namely [MDV, MDVder], MDVder in shape of (len(MDV), len(v))

  • mdv_mdvder2: – 2-list of arrays: namely [MDV, MDVder], MDVder in shape of (len(MDV), len(v))

Returns:

  • mdv (array)

  • mdvder (2-D array) – In shape of (len(MDV), len(v)).