Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 3.4.0 #59

Merged
merged 117 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
1bf3664
Fixed variable inversion error
llegregam Apr 29, 2024
5e1afb2
Bump to 3.3.7
llegregam Apr 29, 2024
ee0f8b4
removed obelete TODO
llegregam Apr 29, 2024
8af3a72
Added docstring to Configparser
llegregam Apr 29, 2024
a701111
Bugfix by coercing experiment name to string
llegregam Apr 29, 2024
2eb6165
Sent logs to stream
llegregam Apr 30, 2024
d76c457
Added test for monod model
llegregam Apr 30, 2024
1c75a88
PEP8 cleanup
llegregam Apr 30, 2024
01b8bf5
added logger
llegregam Apr 30, 2024
62ca0ac
Added np functions instead of python operators
llegregam Apr 30, 2024
1139570
added monod model test
llegregam Apr 30, 2024
4a15e6a
Updated lock file
llegregam Apr 30, 2024
05607b6
Changed python minimum version to 3.8.1 to handle flake8 version
llegregam Apr 30, 2024
1ba82cf
Added flake8 testing on the 3.11 python env.
llegregam Apr 30, 2024
3293cd4
Refactoring
llegregam May 6, 2024
3bad2b2
Refactoring
llegregam May 6, 2024
9ec6ea2
IMPORTANT: Changed names "parameters_to_estimate" to "parameters"
llegregam May 7, 2024
5425ad2
IMPORTANT: Changed names "parameters_to_estimate" to "parameters"
llegregam May 7, 2024
49ba17a
refactoring
llegregam May 7, 2024
ed52b89
changed "params_opti" to "parameters" & "params_not_opti" to "args"
llegregam May 7, 2024
0eeda1f
changed "model_name" attr to "name"
llegregam May 14, 2024
4a369c3
Added data for model tests
llegregam May 14, 2024
d704381
changed "model_name" to "name"
llegregam May 14, 2024
2e3bbfa
changed "model_name" to "name"
llegregam May 14, 2024
a1f4734
Fixed bug where t_lag wasn't actually being used in simulation. Made …
llegregam May 14, 2024
6310dd8
Fixed bug where t_lag wasn't actually being used in simulation. Made …
llegregam May 14, 2024
8a756f9
Added clip on values beneath zero.
llegregam May 14, 2024
9e89f31
"model_name" to "name"
llegregam May 14, 2024
000b744
Updated max version to 4.0.0
llegregam May 14, 2024
11a2a0b
Modified test data. Put all sds to 0.2 as default for tests.
llegregam May 14, 2024
1ebb39f
Added unit tests for all models
llegregam May 14, 2024
8135088
refactoring
llegregam May 15, 2024
ad17060
removed clipping of simulated dataframe.
llegregam May 15, 2024
f58a454
split model tests into different files
llegregam May 15, 2024
ac24491
split model tests into different files
llegregam May 15, 2024
4e10007
Removed fold test_models file
llegregam May 15, 2024
e92b75c
Changed some methods to static
llegregam May 15, 2024
48b0169
shifted datasets to test individual test files
llegregam May 15, 2024
3b7050f
type-hint
llegregam May 15, 2024
52e6ce5
finished tests
llegregam May 15, 2024
47d06e2
Added more data points to simulated matrixes for plotting
llegregam May 15, 2024
e14a6c2
Added args (fixed parameters)
llegregam May 15, 2024
bd49622
Added args (fixed parameters)
llegregam May 15, 2024
0d23773
fix model 1
pierremillard May 15, 2024
b3ddf50
Refactoring
llegregam May 16, 2024
5392d17
Made large matrix be created with shape defined by length of the time…
llegregam May 16, 2024
8892ed0
Fixed test data
llegregam May 16, 2024
9e57b2d
refactored
llegregam May 16, 2024
befe34c
updated gitignore
llegregam May 16, 2024
998fd8a
Improved logging and added log file export
llegregam May 16, 2024
9a9a224
Improved logging and added log file export
llegregam May 17, 2024
b02cfee
Removed logs from __init__
llegregam May 17, 2024
2866c73
Fixed tests
llegregam May 17, 2024
2e6d678
Changed "Degradation" to "Degradation constants" & made t-lag default…
llegregam May 17, 2024
2486d81
Fixed tests
llegregam May 17, 2024
d2896c0
Added check_data_path method
llegregam May 17, 2024
7cd6781
Started work on data_path_select from config
llegregam May 17, 2024
9a97c54
Added methods to handle wrong data path in config file
llegregam May 21, 2024
5811214
Spacing
llegregam May 21, 2024
382a635
PEP8
llegregam May 21, 2024
17c6d09
Merge pull request #58 from MetaSys-LISBP/dev_config_data_selector
llegregam May 21, 2024
31e5e3f
Fixed config parser path input prompting.
llegregam May 22, 2024
3666fbf
changed python minimum version to 3.9 for scipy
llegregam May 22, 2024
35de5d7
Made function for generating logger
llegregam May 22, 2024
87d0f08
Removed actions for 3.8 (not supported anymore)
llegregam May 22, 2024
5ec3db9
Update to 3.4.0
llegregam May 22, 2024
08b8fa8
shutdown logger at the end of execution
llegregam May 22, 2024
bf3435d
Added khi2 test results to output expanders
llegregam May 22, 2024
0c80396
Updated some logs
llegregam May 23, 2024
9917fa6
Added Akaike's information criterion (AIC)
llegregam May 23, 2024
594b535
Added Akaike's information criterion (AIC) and model selection in FAQ
llegregam May 23, 2024
8d5aef8
Adding aic_c
llegregam May 23, 2024
27089ab
Added AIC & AICc
llegregam May 24, 2024
0bca475
Added AIC & AICc
llegregam May 24, 2024
c551197
Added AIC & AICc
llegregam May 24, 2024
3fdea86
Updated docs for 3.4.0
llegregam May 24, 2024
2f7ae09
Temporary fix of data_path_config_context retrieving
llegregam May 24, 2024
dfe2999
Added repr ConfigParser
llegregam May 24, 2024
ed64584
update doc
pierremillard May 28, 2024
d4167a7
update doc
pierremillard May 28, 2024
11dd851
update doc
pierremillard May 28, 2024
7a25c59
update doc
pierremillard May 28, 2024
2f4a43b
update doc
pierremillard May 28, 2024
f9afc98
update doc
pierremillard May 28, 2024
748d3e3
update doc
pierremillard May 28, 2024
3b40df1
update readme
pierremillard May 28, 2024
4370561
update doc typo
pierremillard May 28, 2024
a5585e1
update tests
pierremillard May 29, 2024
e60effd
Added AIC to overview
llegregam May 29, 2024
24c5894
Fixed chi2 test p value explanation
llegregam May 29, 2024
a09efe0
Updated image with new name for degradation constants
llegregam May 29, 2024
56d36ee
Added "simulate data from parameters" section
llegregam May 29, 2024
0e66d82
Clean up FAQ
llegregam May 29, 2024
ed8b8fb
PEP8
llegregam May 29, 2024
1d492b7
Rearranged the model testing section
llegregam May 29, 2024
fa1004a
Set rtol back to 1e-3
llegregam May 29, 2024
c31f040
minor changes to text for clarity
llegregam May 29, 2024
34cedea
update validation data
pierremillard May 30, 2024
b537c09
update validation data
pierremillard May 30, 2024
846b94b
Merge branch 'dev' of https://github.com/MetaSys-LISBP/PhysioFit into…
pierremillard May 30, 2024
5bd1f4e
Fixed bug with data paths pointing to config file instead of data
llegregam May 30, 2024
ba3953b
update validation doc
pierremillard May 30, 2024
6398fd5
change test name
pierremillard Jun 4, 2024
32dceab
Updated CLI
llegregam Jun 13, 2024
997baf2
removed useless f-string literal
llegregam Jun 13, 2024
217d39f
Added some debug logs
llegregam Jun 13, 2024
610e053
Added flake8 to tox
llegregam Jun 13, 2024
36efb9a
PEP8
llegregam Jun 13, 2024
608c963
Merge remote-tracking branch 'origin/dev' into dev
llegregam Jun 13, 2024
476bc55
Fixed bug when reading config_file in degradation model
llegregam Jun 13, 2024
e1c154f
added check that chosen data path in config parser is tsvv or txt
llegregam Jun 13, 2024
45f079b
bugfix
llegregam Jun 13, 2024
80d2bfd
added import
llegregam Jun 13, 2024
8590159
removed CI on python 3.8
llegregam Jun 13, 2024
3b8c384
Changed checkout in CI/CD to v4
llegregam Jun 13, 2024
e2c0d82
Removed macos tests
llegregam Jun 13, 2024
118d48e
flake8 linting
llegregam Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ${{ matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
python-version: [ '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{matrix.python-version}}
uses: actions/setup-python@v4
with:
Expand Down
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/venv/
physiofit/__pycache__/__init__.cpython-310.pyc
physiofit/__pycache__/__main__.cpython-310.pyc
physiofit/__pycache__/logger.cpython-310.pyc
physiofit/base/__pycache__/__init__.cpython-310.pyc
physiofit/base/__pycache__/fitter.cpython-310.pyc
physiofit/base/__pycache__/io.cpython-310.pyc
physiofit/__pycache__/
physiofit/base/__pycahe__/
physiofit/last_version.txt
physiofit/ui/__pycache__/__init__.cpython-310.pyc
physiofit/ui/__pycache__/cli.cpython-310.pyc
physiofit/ui/__pycache__/
physiofit.egg-info/dependency_links.txt
physiofit.egg-info/entry_points.txt
physiofit.egg-info/PKG-INFO
Expand All @@ -16,3 +11,4 @@ physiofit.egg-info/SOURCES.txt
physiofit.egg-info/top_level.txt
/versions publi/
/physiofit/data/
/docs/_build/
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ Detailed documentation can be found online at Read the Docs
## Key features

* **calculation of growth rate and extracellular (uptake and production) fluxes**,
* **a set of steady-state and dynamic models** are shipped with PhysioFit,
* a set of **steady-state and dynamic models**,
* **tailor-made models** can be constructed by users,
* Monte-Carlo sensitivity analysis to **estimate the precision on the calculated fluxes**,
* Monte-Carlo sensitivity analysis to **estimate the precision of the calculated fluxes**,
* **evaluation of the goodness of fit and visual inspection of the fitted curves**,
* calculation of the Akaike information criterion to **guide users to identify the most appropriate model**,
* shipped as a **library** with both a **graphical** and a **command line** interface,
* **open-source, free and easy to install** everywhere where Python 3 and pip run,
* **biologist-friendly**.


## Quick-start
PhysioFit requires Python 3.9 or higher and run on all platforms.
Please check [the documentation](https://physiofit.readthedocs.io/en/latest/quickstart.html) for complete
Expand Down
Binary file modified docs/_static/usage/example1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# The full version, including alpha/beta/rc tags
release = __version__


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down Expand Up @@ -52,7 +51,6 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand All @@ -74,11 +72,11 @@

# remove blank pages (between the title page and the TOC, etc.)
'classoptions': ',openany,oneside',
'babel' : '\\usepackage[english]{babel}',
'babel': '\\usepackage[english]{babel}',

# Additional stuff for the LaTeX preamble.
'preamble': r'''
\usepackage{hyperref}
\usepackage{upquote}
'''
}
}
122 changes: 79 additions & 43 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,45 @@ Frequently asked questions (FAQ)
How are fluxes calculated?
------------------------------------------------------------------

We provide details on the flux calculation approach implemented in PhysioFit in the :doc:`method` section.
We provide details on the flux calculation approach implemented in PhysioFit
in the :doc:`method` section.

How many measurements should I use to calculate fluxes?
------------------------------------------------------------------

As in any model-based fitting procedure, more data usually means more accurate and precise flux estimates. The minimal number of
measurements depend on the model used for flux calculation. For instance, for steady-state built-in models provided with PhysioFit, we recommend using
at least 6 to 8 time points, which should provide reliable and meaningful estimates in most situations.
As in any model-based fitting procedure, more data usually means more
accurate and precise flux estimates. The minimal number of measurements
depend on the model used for flux calculation. For instance, for
steady-state built-in models provided with PhysioFit, we recommend using at
least 6 to 8 time points, which should provide reliable and meaningful
estimates in most situations.

Still, the exact answer to this question strongly depends on the uptake/production/growth rates of your (micro)organism
in the conditions you are investigating, on the sampling time interval, on the questions you are addressing, on the model used for flux calculation, and on
many other parameters! You can make some tests by calculating fluxes from (published or theoretical) datasets similar
to those you have in mind.
Still, the exact answer to this question strongly depends on the
uptake/production/growth rates of your (micro)organism in the conditions you
are investigating, on the sampling time interval, on the questions you are
addressing, on the model used for flux calculation, and on many other
parameters! You can make some tests by calculating fluxes from (published or
theoretical) datasets similar to those you have in mind.

Can I calculate fluxes in case of missing values?
------------------------------------------------------------------

Yes, fluxes can still be calculated if some measurement(s) are missing. In this case, let empty the corresponding field
of the input data file.
Yes, fluxes can still be calculated if some measurement(s) are missing. In
this case, leave empty the corresponding field of the input data file.

.. _`conc units`:

What units should be used for input data?
-----------------------------------------

Input data (biomass concentration, metabolites concentrations, and time) can be provided to PhysioFit using any unit.
Still, we recommand to use units for which values are as close to unity as possible to ensure numerical stability (e.g.
3 mM instead of 3.10\ :sup:`-3` M). Importantly, units of the estimated fluxes depend on units of time and metabolites and biomass
concentrations. The concentration of different metabolites can be provided using different units, but a single unit
must be used for all measurements of a given metabolite.
Input data (biomass concentration, metabolites concentrations, and time) can
be provided to PhysioFit using any unit. Still, we recommend using units
for which values are as close to unity as possible to ensure numerical
stability (e.g. 3 mM instead of 3.10\ :sup:`-3` M). Importantly, units of
the estimated fluxes depend on units of time and metabolites and biomass
concentrations. The concentration of different metabolites can be provided
using different units, but a single unit must be used for all measurements
of a given metabolite.

.. seealso:: :ref:`flux units`

Expand Down Expand Up @@ -61,49 +70,75 @@ What parameters values should I use?

Details on PhysioFit parameters can be found in the :doc:`usage` section.

How can I check if my data have been fitted correctly?
Which model should I use?
------------------------------------------------------------------

The quality of the fit can be evaluated based on:
The choice of the model depends on the biological question you are addressing,
the data you have, and the assumptions you are willing to make. We provide a
set of models in PhysioFit, each with its own assumptions and requirements.

* the plots of experimental vs simulated data for the best fit, which should be as close as possible,
* the χ² statistical test results given in the log file (see below for help on interpreting the results).
As a starting point, we recommend using the most relevant model based on
the type of experiment you have conducted. Begin with the simplest model that
fits your data and evaluate the quality of the fit based on the χ² test
results and the plots of experimental vs. simulated data. If the fit is
not satisfactory, you may try more complex models. However, keep in mind
that more complex models often require more data, include more assumptions,
and may lead to overfitting.

.. seealso:: :ref:`chi2 test` and :ref:`bad fit`
If different models fit your data, a good practice for comparing them
is to use the AIC (Akaike Information Criterion). For more information, please
refer to the section "Model comparison" from the :doc:`method` page.

.. _`chi2 test`:

What is a χ² test?
How can I check if my data has been fitted correctly?
------------------------------------------------------------------

A χ² test describes how well a model fits a set of observations. Measures of goodness of fit typically summarize the discrepancy between observed values and the values expected under the model used in PhysioFit (see the :doc:`method` section). It is calculated as the sum of differences between measured and simulated values, each squared and divided by the simulated value.
A good fit corresponds to small differences between measured and simulated values, thereby the χ² value is low. In contrast, a bad fit corresponds to large differences between simulations and measurements, and the χ² value is high.
The quality of the fit can be evaluated based on:

* the plots of experimental vs simulated data for the best fit, which should be as close as possible,
* the χ² statistical test results given in the stat ouput file (see below
for help on interpreting the results).

.. seealso:: :ref:`chi2 test` and :ref:`bad fit`

The resulting χ² value can then be compared with a χ² distribution to determine the goodness of fit. The p-value of one-tail χ² test is calculated by PhysioFit from the best fit and is given in the log file (have a look to the :doc:`usage` section). A p-value close to 0 means poor fitting, and a p-value close to 1 means good fitting (keeping in mind that a p-value very close to 1 can be an evidence that standard deviations might be overestimated). A
p-value between 0.95 and 1 means the model fits the data good enough with respect to the standard deviations provided (at a 95% confidence level). PhysioFit provides an explicit meassage stating wether the flux data are satisfactorily fitted or not (at a 95% confidence interval).

.. _`bad fit`:

My data hasn't been correctly fitted. Why?
------------------------------------------------------------------

A possible reason to explain a bad fit is that standard deviations on measurements (concentration biomass and metabolites) is under-estimated, thereby making the χ² test too stringent. In this case, plots of measured and fitted data should be in agreement. Reliable estimated of standard deviation on measurements must be provided to PhysioFit (have a look to the :doc:`usage` section to see how to check and adjust this parameter).

Another possible reason to explain a bad fit is that a key asumption of the flux calculation method is not respected. For instance,
if you use a steady-state model shipped with PhysioFit, cells might not be strictly in metabolic steady-state, i.e. with
constant fluxes during the whole experiment. If this key asumption does not occur (e.g. cells are continuously adapting
to their environment and fluxes change over time), PhysioFit will not be able to fit the data satisfactorily. In this case,
evaluate wether the deviation is significant or not (e.g. based on the detailed χ² statistics or on the plot of fitted vs
measured data), and evaluate the potential biases that would be introduced by interpreting (or not) these flux values.

In rare situations, it may also be because some parameters have to be tweaked to
help PhysioFit fitting the measurements, which results in obviously aberrant fits (e.g. with flat
time-course profiles for all metabolites). This might happen for instance if some measurements are
provided in units far from unity (e.g. 1.10\ :sup:`-5` M instead of 10 µM). If this situation happens, we suggest modifying the initial values of fluxes, or changing the units of input data, and re-run the flux calculation. For more info on the run parameters and how they may affect the fitting process,
A possible reason to explain a bad fit is that standard deviations on
measurements (concentration biomass and metabolites) is under-estimated,
thereby making the χ² test too stringent. In this case, plots of measured and
fitted data should be in agreement. Reliable estimated of standard deviation
on measurements must be provided to PhysioFit (have a look to the :doc:`usage`
section to see how to check and adjust this parameter).

Another possible reason to explain a bad fit is that a key asumption of the
flux calculation method is not respected. For instance, if you use a
steady-state model shipped with PhysioFit, cells might not be strictly in
metabolic steady-state, i.e. with constant fluxes during the whole
experiment. If this key asumption does not occur (e.g. cells are continuously
adapting to their environment and fluxes change over time), PhysioFit will
not be able to fit the data satisfactorily. In this case, evaluate wether
the deviation is significant or not (e.g. based on the detailed χ²
statistics or on the plot of fitted vs measured data), and evaluate the
potential biases that would be introduced by interpreting (or not) these
flux values.

In rare situations, it may also be because some parameters have to be
tweaked to help PhysioFit fit the measurements, which results in
obviously aberrant fits (e.g. with flat time-course profiles for all
metabolites). This might happen for instance if some measurements are
provided in units far from unity (e.g. 1.10\ :sup:`-5` M instead of 10 µM). If
this situation happens, we suggest modifying the initial values of fluxes,
or changing the units of input data, and re-run the flux calculation. For
more info on the run parameters and how they may affect the fitting process,
please refer to section :ref:`physiofit parameters`.

If you believe the problem is in PhysioFit, we would greatly appreciate
if you could open a new issue on our `issue tracker <https://github.com/MetaSys-LISBP/PhysioFit/issues>`_.
If you think the problem is in PhysioFit, we would greatly appreciate
if you could open a new issue on our `issue tracker <https://github
.com/MetaSys-LISBP/PhysioFit/issues>`_.

I cannot start PhysioFit graphical user interface, can you help me?
-------------------------------------------------------------------
Expand All @@ -121,8 +156,9 @@ Please follow this simple procedure:
* If it is related to your system or your Python installation, you will need to ask some
help from your local system administrator or your IT department so they could
guide you toward a clean installation. Tell them that you wanted "to use the graphical
user interface of PhysioFit, a Python 3.6 software" and what you did so far (installation),
give them the traceback and a link toward the documentation. They should know what to do.
user interface of PhysioFit, a Python 3.9 software" and what you did so
far (installation), give them the traceback and a link toward the
documentation. They should know what to do.
* If you believe the problem is in PhysioFit or that your local system administrator
told you so, then you probably have found a bug! We would greatly appreciate
if you could open a new issue on our `issue tracker <https://github.com/MetaSys-LISBP/PhysioFit/issues>`_.
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ additional tailor-made models can be implemented by users.
**PhysioFit includes the following features:**

* **calculation of growth rate and extracellular (uptake and production) fluxes**,
* **a set of steady-state and dynamic models** are shipped with PhysioFit,
* a set of **steady-state and dynamic models**,
* **tailor-made models** can be constructed by users,
* Monte-Carlo sensitivity analysis to **estimate the precision of the calculated fluxes**,
* **evaluation of the goodness of fit and visual inspection of the fitted curves**,
* calculation of the Akaike information criterion to **guide users to identify the most appropriate model**,
* shipped as a **library** with both a **graphical** and a **command line** interface,
* **open-source, free and easy to install** everywhere where Python 3 and pip run,
* **biologist-friendly**.
Expand Down
Loading
Loading