calc.CellComposition(values=values, dry_weights=False, molecular_formula=False)
CellComposition() contains biomass elemental composition and molar weight. CellComposition() requires values dictionary for initialization. CellComposition() returns None if both dry_weights and molecular_formula are False. There are 2 ways to initialize CellComposition():
1. dry_weights = True: Store dry weight percentages of carbon, hydrogen, nitrogen and oxygen in values dictionary and ash fraction in biomass (obtained experimentally). See below for example.
2. molecular_formula = True: Store biomass molecular formula of biomass in values dictionary as shown below.
Values is a required parameter in CellComposition(). molecular_formula or dry_weights variable determines how to values dictionary is used. Values dictionary stores 5 key-value pairs for carbon, hydrogen, oxygen, nitrogen and ash_fraction.
Values dictionary stores dry-weight percentages between 0 and 100 and ash fraction
1. values['C']: dry weight percentage of carbon (between 0 and 100)
2. values['H']: dry weight percentage of hydrogen (between 0 and 100)
3. values['N']: dry weight percentage of nitrogen (between 0 and 100)
4. values['O']: dry weight percentage of oxygen (between 0 and 100)
5. values['ash_fraction']: dry weight percentage of ash (between 1 and 100)
Example:
values = { 'C':47,'H':4.15,'N':10,'O':31,'ash_fraction': 7.85}
Values dictionary stores molecular formula of biomass
1. values['C']: default 1 (biomass normalized to 1 mol carbon)
2. values['H']: hydrogren subscript in biomass formula (mol hydrogen normalized to 1 mol carbon)
3. values['N']: nitrogen subscript in biomass formula (mol nitrogen normalized to 1 mol carbon)
4. values['O']: oxygen subscript in biomass formula (mol oxygen normalized to 1 mol carbon)
5. values['ash_fraction']: dry weight percentage of ash (between 1 and 100)
Example: Values dictionary for CH1.66N0.194O0.269
values = { 'C':1,'H':1.66,'N':0.194,'O':0.269,'ash_fraction': 7.85}
CellComposition().biomass_composition
Returns dictionary with biomass composition and biomass molecular formula string. Example:
print(CellComposition().biomass_composition)
Out:
{'C':1,'H':1.66,'N':0.194,'O':0.269,
'formula': 'C(H-1.66)(N-0.194)(O-0.269)'}
CellComposition().biomass_molar_weight
Returns numerical molar weight of biomass. Example:
print(CellComposition().biomass_molar_weight)
Out:
22.48
calc.BiomassEquation(biomass_composition=biomass_composition, substrate='glucose')
BiomassEquation() object solves biomass growth equations. This class must be initialized with biomass composition. CellComposition().biomass_composition or dictionary with similar schema are valid inputs. Biomass composition dictionary schema:
biomass_composition = {'C':1,'H':1.66,'N':0.194,'O':0.269}
Biomass growth equation has 4 equations and 5 variables (a,b,c,d,e). An additional equation is needed to solve the system of biomass equations with linear equation solver. This is provided in 4 ways. See BiomassEquation().solve_biomass_equation() for details.
BiomassEquation().set_gas_io_values()
BiomassEquation.set_gas_io_values(inlet_N2=None,inlet_O2=None,outlet_CO2=None,outlet_N2=None,outlet_O2=None)
This function sets gaseous inlet-outlet exchange values in percent (0 to 100) to determine respiratory quotient. It uses percentage values. Molar values must be normalized to percentages first.
One of inlet_N2 or inlet_O2 may be omitted. The omitted variable is determined by subtracting from 100% the provided input value, as these values are percentages. Similarly, only one of outlet_CO2, outlet_N2, outlet_O2 may be omitted. This is also determined by subtracting from 100% the 2 provided input values.
BiomassEquation().solve_biomass_equation()
BiomassEquation().solve_biomass_equation(rq=None,biomass_yield_mol=None,biomass_yield_gram=None,biomass_molar_weight=None)
Returns string form of biomass growth equation and stores biomass growth solution in biomass_equation_solution. Solves biomass growth equation with linear equation solver. Biomass growth equation has 4 equations and 5 variables (a,b,c,d,e). An additional equation is needed to solve the system of biomass equations with linear equation solver. This is provided in one of 4 ways:
1. Respiratory quotient with BiomassEquation().solve_biomass_equation():
Provide gaseous inlet-outlet values before running solve_biomass_equation(). Respiratory quotient (RQ) is calculated and (RQ=d/b) is used as the 5th equation to solve linear system of biomass equation. Example:
be = calc.BiomassEquation(biomass_composition)
be.set_gas_io_values(79,21,10,83,7)
be.solve_biomass_equation()
solution = be.biomass_equation_solution
2. Use biomass yield (gram):
solve_biomass_equation() is provided 2 inputs:
Biomass molar weight and biomass yield by gram are used to calculate molar yield (MY) of biomass per mole of substrate. (MY=c) is used as the 5th equation to solve linear system of biomass equation. Example:
be = calc.BiomassEquation(biomass_composition)
be.solve_biomass_equation(biomass_yield_gram=1.4, biomass_molar_weight=biomass_molar_weight)
solution = be.biomass_equation_solution
3. Use biomass molar yield:
solve_biomass_equation() is provided biomass molar yield (biomass_yield_mol) as input. This is molar yield (MY) of biomass per mole of substrate. (MY=c) is used as the 5th equation to solve linear system of biomass equation. Example:
be = calc.BiomassEquation(biomass_composition)
be.solve_biomass_equation(biomass_yield_mol=0.4)
solution = be.biomass_equation_solution
4. Manually provide respiratory quotient:
Respiratory quotient (RQ) is provided as input to solve_biomass_equation. (RQ=d/b) is used as the 5th equation to solve linear system of biomass equation. Example:
be = calc.BiomassEquation(biomass_composition)
be.solve_biomass_equation(rq=0.67)
solution = be.biomass_equation_solution
BiomassEquation().biomass_equation_solution
Returns dictionary with solution of biomass growth equation. Only has value after solve_biomass_equation() is run. Dictionary object has 4 keys:
Example:
{
'string': 'C6H12O6 + 0.078NH3 + 5.546O2 -> 0.4C(H-1.660)(N-0.194)(O-0.269) + 5.6CO2 + 5.784H2O',
'molar_coeff': {'NH3': 0.078, 'O2': 5.546, 'biomass': 0.4, 'CO2': 5.6, 'H2O': 5.784},
'biomass_composition': {'C': 1, 'H': 1.66, 'N': 0.194, 'O': 0.269, 'formula': 'C(H-1.660)(N-0.194)(O-0.269)'},
'rq': 1.01
}
calc.BiomassEquation().substrate
Returns string of substrate name provided as input to biomass growth equation object. Glucose is default substrate for biomass growth. To change substrate to hexane:
hexane_biomass_growth = calc.BiomassEquation(biomass_composition, substrate='hexane')
Helper class of constants used in calculations. Has atomic weights and molecular representation of substrates.
Constants().atomic_weights[key]
Returns atomic weight of element key. Key is shortform symbol, like C for carbon. Example:
print(Constants().atomic_weights['C'])
print(Constants().atomic_weights['H'])
print(Constants().atomic_weights['N'])
print(Constants().atomic_weights['O'])
Out:
12.001
1.00784
14.00674
15.994
Return substrate dictionary. Key is substrate name string, like hexane. Supported substrates: hexane and glucose.
print(Constants().substrates['hexane'])
Out:
{ 'formula': 'C6H14','C':6,'H':14,'N':0,'O':0}
Constants().get_molar_weight(compound)
Returns molecular weight of compound. Compound is dictionary with keys for carbon, hydrogen, nitrogen and oxygen subscript values in molecular formula. Compound is equivalent to CellComposition().biomass_composition. CellComposition().biomass_composition and BiomassEquation().substrate can be used as input to Constants().get_molar_weight(compound).
print(Constants().get_molar_weight({'C':6,'H':14,'N:0,'O':0}))
Out:
86.176
This module contains functions for bioreactor calculations like growth rate, time to achieve titer and batch and fed-batch bioreactor modeling.
bioreactor.specific_growth_rate_from_doubling_time(doubling time)
bioreactor.specific_growth_rate_from_doubling_time(doubling_time)
Returns float value of specific growth rate under exponential growth given doubling time of biomass. This function calculates specific growth rate using the formula below.
Unit: inverse doubling time unit (like h-1)
Formula: specific growth rate = log-natural(2) / doubling_time
Example
from bioreactor-model import bioreactor
print(bioreactor.specific_growth_rate_from_doubling_time(15))
Out:
0.046209812037329684
bioreactor.time_to_titer(titer, qp, cell_seed_volume, doubling_time, growth='exponential', titer_unit='g/l', qp_unit='g/cell.hr', seed_unit='cell/l', time_unit='hr')
Returns dictionary with integer value and unit of time. This function calculates the time taken for a bioreactor production process with exponential biomass growth (doubling phase) to achieve the specified product titer. This function assumes doubling of biomass and requires the following inputs:
Example
from bioreactor-model import bioreactor
print(bioreactor.time_to_titer(titer=5,qp=0.000000000004,cell_seed_volume=500000,doubling_time=15,seed_unit='cell/ml'))
Out:
{'value': 103, 'unit':'hr'}