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

Removing Bioscrape XML and adding SBML Functionality #108

Merged
merged 20 commits into from
Jun 25, 2021

Conversation

WilliamIX
Copy link
Collaborator

@WilliamIX WilliamIX commented Jun 16, 2021

  • Bioscrape XML writing removed (reading still supported for backwards compatibility)
  • Bioscrape XML examples removed
  • Lineage simulation removed from the advanced examples (I forgot those were there)
  • Add delays and new rule types to SBML writing/reading with annotations
  • Add tests to ensure all SBML reading/writing work for all objects supported
  • Confirm underscores are consistently removed from the start of parameters and not added. Concerned about line 476 of sbmlutil.py (and there are some other places...) maybe we could test for this?

Linked to issues #99 #8 #107

@ayush9pandey ayush9pandey marked this pull request as ready for review June 24, 2021 02:50
@ayush9pandey
Copy link
Collaborator

@WilliamIX This PR is now ready for review. I have added delay support and rule support with SBML (and added a bunch of tests for these). Other changes are minor and there's some refactoring of sbmlutil. Please feel free to add more tests wherever appropriate.
also, have a look at issue #110 and let me know if we can fix it with this PR..

@ayush9pandey
Copy link
Collaborator

The ODE rule reading/writing is fixed now.

@WilliamIX
Copy link
Collaborator Author

This all looks good to me. @ayush9pandey can you please approve the PR whenever you are ready and we can release a new version of bioscrape?

@ayush9pandey
Copy link
Collaborator

Yes, I will take a look at everything once again, particularly for any old XML or underscores-to-parameter code.

@ayush9pandey
Copy link
Collaborator

All done! Let's merge this one.

@ayush9pandey ayush9pandey merged commit 365d21c into dev Jun 25, 2021
@ayush9pandey ayush9pandey deleted the Bioscrape-XML-Removal branch June 25, 2021 19:25
ayush9pandey added a commit that referenced this pull request Aug 22, 2022
Safe mode (#67) changes:
      * Deterministic Safe Interface Code written
      * Creating some tests
      * Interface Safemode unit tests complete
      * Updated py_simulate_model to allow Safe Deterministic simulations
      * Added checks to safemode, timestep control to py_simulate_model, code reuse in massaction propensities
      * SafeLineageCSimInterface created: this interface is analogous to the SafeModelCSimInterface and does some basic checking (and warning messages) at the expense of speed.
     * lineage notebooks cleanup: added turbidostat example for lineages, lineage examples split into two notebooks
      * Lineage fixes: Fixed an indexing bug, py_SimulateTurbidostat returns dataframes, and Turbidostat example plotting, improved py_SimulateTurbidostat wrapper


SBML read/write changes:
      * Bioscrape annotations fix (#65)
      * renamed local parameters extended to bioscrape propensity annotations
      * Added Unit Tests for SBML reading and writing with and without annotations
      * Fix for SBML kinetic law formula when importing and writing SBML #89 (#93)
      * add checks to rate law math ast


* Testing and other packaging related changes:
      * Model comparison removed from test_utils
      * Adds a test to make sure running initialize twice isn't a problem.
      * changing paths to work across platforms
      * added pandas to requirements
      * Added tests to compare general propensities to bioscrape propensities
      * update readme travis tag (#75)
      * Switch to Github Actions (#84):  Switching from Travis CI to Github actions. Now tests on Mac OS, Linux, and Windows with python versions 3.6, 3.7, and 3.8
      * Making Bioscrape pip Installable (#86): This PR creates a single setup.py file which automatically compiles Bioscrape's cython code.
      * Manifest is ignored
      * Mid-debug version, trying to figure out why simulations produce NaNs in serialization testing
      * Fixes some bugs in serialization testing


Bug fixes:
      * C vector bug fix (#69): Clears c_vectors in model._create_vectors
      * Remove underscore from parameter definition (#68)
      * Fixed Bioscrape XML loading and added deprecated warning for bioscrape XML


Lineage changes:
      * Lineage beta (#71)
      * Fixed global volume distribution problem wasn't checking cell death correctly
      * Minor changes to lineages: Fixed a bug where arrays of length 0 were being made.
      * Tried to find other places to debug this seg-fault problem. I believe it might now be an issue when running bioscrape inside jupyter notebooks??? When running on the prompt I can run tons of simulations no problem.
      * Added new lineage examples
      * Makes Models and LineageModels picklable; Refactors test_propensities_via_annotations.py test.
      * Adds turbidostat capability to Lineages, along with unit tests for the priority queue used by turbidostat
      * Removes a few unused files
      * index bounds checking for Lineage.py_get_schnitz
      * Fixed perfect partitioning rounding error
      * Fixes np.object-related warning.
      * Fixes a warning in serialization tests
      * Fixed some bugs involving SimulateSingleCell with length 0 or 1 timepoints arrays.
      


Inference changes:
      * add priors, and custom prior
      * py_inference wrapper added
      * add beta and gamma prior
      * add custom prior documenting notebook
      * gaussian prior fix
      * bug fixes for log uniform prior and pdf computation bound checks
      * option to set initial parameter seed. print convergence diagnostics
      * first cut at lmfit support for inference
      * renaming inference files and functions to be agnostic to external parameter inference packages
      * 1. inference.pyx bug with multiple measurements fixed. 2. Added LMFit support for least squares type parameter id. 3. Refactor inference example notebooks. 4. Added inference example notebooks.
      * first cut at delay support for inference
      * change convergence_diagnostics error to warning
      * fix tests
      * refactor inference examples
      * add inference test
      * add emcee version requirement for progress bar update
      * add requirement for scipy>1.6.4 and add lmfit
      * testing suite for inference
      * allow lower scipy versions
      * Fixed deterministic safemode tests
      * raises errors in deterministic safe mode - errors do not stop integration
      * less parallelization so tests don't use up all the RAM
      * Slight change to how linege's SimulateSingleCell handles simulation with a single timepoint, to avoid infinite loops.
      * Add simulation control keywords rtol atol and hmax to inference and bioscrape deterministic simulation
      * fixed a bug which caused the CSimInterface to not update its parameters
      * more init_seed options, including guassian and normal priors + checking for positivity
      * filename option in py_inference
      * loguniform prior sampling initializaiton
      * parameters now can vary in log space
      * precision added to sensitivity analysis and Inference objects now save a list of params along with costs
      * ability to skip resetting up the cost function + optional file writing.
      * ability to reset PID default parameters programatically


Other core bioscrape changes:
      * Expands serialization tests to check deterministic simulations as well as stochastic ones.
      * minor fix to sympy_species_and_parameters
      * merged turbidostat and serialization
      * Merges serialization and turbidostat into dev, with minor fixes.
      * Cython Statistics for SSA Trajectories (#101): SSResult.emperical_distribution and py_empirical_distribution cythonize distribution and marginal distribution calculations. SSAresult.first_moment, second_moment, correlation, and standard_deviation cython methods now all exist. As well as python wrappers.
      * added max_counts_list to allow truncation of the empirical distribution
      * add doc strings
      * Fast statistics for SSA trajectories examples
      * Rules and simulator upgrade (#106)
      * DeterministicDilutionSimulator, SafeModeSSASimulator, TimeDependentSSASimulator, and Core Lineage/Propogate Simulators deleted
      * Major Rule Update:
            ** Rules fire consistently, even when there are no reactions.
            ** New Rule types and firing frequencies, including specific times, every timestep, and every update.
            ** Tests of these new rule features
      * Recomputed all the frozen sim results: Why? Previously, delay reactions firing if no reactions could fire. Propensities are now recomputed ever dt, so the old results also are no longer valid.      
      * version update to 1.0.3
      

Bioscrape XML deprecated now with the following commits:
      * Removing Bioscrape XML and adding SBML Functionality (#108)
      * Removed Bioscrape XML writing, bioscrape XML from the examples, and cell lineages from the advanced examples
      * remove propensity_annotation keyword, always write annotation to bioscrape exported SBML models
      * delay annotation working with propensity annotation
      * remove underscore shenanigans in rule writing
      * refactor import sbml
      * add rule annotation. add rule testing with annotation
      * fix ODE rule SBML writing and loading
      * remove all underscore-to-parameter code
      * check basic notebook - runs without problems
      * turn off input_printout in propensity test


New features: Sensitivity analysis (#111)
      * add tests for sensitivity analysis
      * apply rules in sensitivity analysis

Co-authored-by: William Poole <wpoole@caltech.edu>
Co-authored-by: Ayush Pandey <ayush.9.pandey@gmail.com>
Co-authored-by: Sam Clamons <sclamons@gmail.com>
ayush9pandey added a commit that referenced this pull request Oct 21, 2022
* Inference updates, new features, and bug fixes (#102)

* add custom prior documenting notebook
* gaussian prior fix
* bug fixes for log uniform prior and pdf computation bound checks
* option to set initial parameter seed. print convergence diagnostics
* first cut at lmfit support for inference
* renaming inference files and functions to be agnostic to external parameter inference packages
* 1. inference.pyx bug with multiple measurements fixed. 2. Added LMFit support for least squares type parameter id. 3. Refactor inference example notebooks. 4. Added inference example notebooks.
* first cut at delay support for inference
* change convergence_diagnostics error to warning
* fix tests
* refactor inference examples
* add inference test
* add emcee version requirement for progress bar update
* add requirement for scipy>1.6.4 and add lmfit
* testing suite for inference
* allow lower scipy versions
* add empty line at end of test_inference

* Rules and simulator upgrade (#106)

* DeterministicDilutionSimulator, SafeModeSSASimulator, TimeDependentSSASimulator, and Core Lineage/Propogate Simulators deleted

* Major Rule Update:
** Rules fire consistently, even when there are no reactions.
** New Rule types and firing frequencies, including specific times, every timestep, and every update.
** Tests of these new rule features

* Recomputed all the frozen sim results: Why? Previously, delay reactions firing if no reactions could fire. Propensities are now recomputed ever dt, so the old results also are no longer valid.

* SafeLineageCSimInterface created: this interface is analogous to the SafeModelCSimInterface and does some basic checking (and warning messages) at the expense of speed.

* lineage notebooks cleanup: added turbidostat example for lineages, lineage examples split into two notebooks

* Lineage fixes: Fixed an indexing bug, py_SimulateTurbidostat returns dataframes, and Turbidostat example plotting, improved py_SimulateTurbidostat wrapper

Co-authored-by: William Poole <wpoole@caltech.edu>

* Fix a minor bug in delay simulator (#103)

* delay simulation bug fix
* fix error from merge dev

* Removing Bioscrape XML and adding SBML Functionality (#108)

* Removed Bioscrape XML writing, bioscrape XML from the examples, and cell lineages from the advanced examples

* remove propensity_annotation keyword, always write annotation to bioscrape exported SBML models

* delay annotation working with propensity annotation

* remove underscore shenanigans in rule writing

* refactor import sbml

* add rule annotation. add rule testing with annotation

* fix ODE rule SBML writing and loading

* remove all underscore-to-parameter code

* check basic notebook - runs without problems

* turn off input_printout in propensity test

Co-authored-by: William Poole <wpoole@caltech.edu>
Co-authored-by: ayush9pandey <ayush.9.pandey@gmail.com>

* New features: Sensitivity analysis (#111)

* add priors, add beta and gamma prior, and custom prior, documentation to the notebook

* py_inference wrapper added

* option to set initial parameter seed. print convergence diagnostics

* Added LMFit support for least squares type parameter id. and added inference example notebooks.

* delay support for inference

* add tests for sensitivity analysis

* apply rules in sensitivity analysis

* minor changes

* version update to 1.0.3

* Fixed some bugs involving SimulateSingleCell with length 0 or 1 timepoints arrays.

* Deterministic safe mode (#113)

* Fixed deterministic safemode tests
* raises errors in deterministic safe mode - errors do not stop integration
* less parallelization so tests don't use up all the RAM

Co-authored-by: William Poole <wpoole@caltech.edu>

* Slight change to how linege's SimulateSingleCell handles simulation with a single timepoint, to avoid infinite loops.

* Wp inference (#118)

* Add simulation control keywords rtol atol and hmax to inference and bioscrape deterministic simulation

* fixed a bug which caused the CSimInterface to not update its parameters

* more init_seed options, including guassian and normal priors + checking for positivity

* filename option in py_inference

* loguniform prior sampling initializaiton

* parameters now can vary in log space

* precision added to sensitivity analyss and Inference objects now save a list of params along with costs

* ability to skip resetting up the cost function + optional file writing.

* ability to reset PID default parameters programatically

Co-authored-by: William Poole <wpoole@caltech.edu>

* Delete test_printing.py

* Infinite loop fix (#115)

* Improved infinite loop fixes.
* Delete test_printing.py

Co-authored-by: Sclamons

* fix docstring

* Fixes issue #123 : sbml_warnings keyword error (#134)

* fix sbml_warning issue with load reaction

* Fix sensitivity analysis bug #126 and #125 (#136)

Summary of changes:
* fix sensitivity analysis bug that changed original parameter values

* add docstring to py_sensitivity_analysis

* delete old files and manual fix to match dev by deleting wrongly committed files

* A cluster of changes to inference  (#138)

New features:

* `parameter_conditions`: A new argument for `py_inference` that lets you set parameter conditions for data trajectories. Similar to `initial_conditions` that are on the model states, this sets conditions on parameters.
* Add multiple files to write MCMC results: `mcmc_results.csv` writes the samples and `mcmc_results.txt` writes `cost_progress`.
* Add stricter inference testing (optional) and add debug to stochastic pid interface

Refactoring of Inference module:

* remove old init_param_vals code that seemed not to be in use
* update plot_mcmc_results behavior
* set convergence_check default to False and modify gitignore
* fix stochastic trajectories likelihood initial state set
* add param condition to inference unit tests
* refactor extract_data and check that parameter being estimated is not being varied through parameter_conditions
* remove emcee thread argument
* longer inference test, and change discard argument of emcee

Co-authored-by: William Poole <wp_ix@hotmail.com>

* Fix #135 by adding dtype double to inference timepoints and data (#140)

* update version number to 1.1.0

Co-authored-by: William Poole <wp_ix@hotmail.com>
Co-authored-by: William Poole <wpoole@caltech.edu>
Co-authored-by: sclamons <sclamons@SEC-Macbook-Pro.local>
Co-authored-by: Sam Clamons <sclamons@gmail.com>
ayush9pandey added a commit that referenced this pull request Feb 25, 2023
* Removed Bioscrape XML writing, bioscrape XML from the examples, and cell lineages from the advanced examples

* remove propensity_annotation keyword, always write annotation to bioscrape exported SBML models

* delay annotation working with propensity annotation

* remove underscore shenanigans in rule writing

* refactor import sbml

* add rule annotation. add rule testing with annotation

* fix ODE rule SBML writing and loading

* remove all underscore-to-parameter code

* check basic notebook - runs without problems

* turn off input_printout in propensity test

Co-authored-by: William Poole <wpoole@caltech.edu>
Co-authored-by: ayush9pandey <ayush.9.pandey@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants