Skip to content

Revise to use in memory db - #9

Merged
brendanreardon merged 24 commits into
mainfrom
consolidate-file-writing
Mar 9, 2023
Merged

brendanreardon merged 24 commits into
mainfrom
consolidate-file-writing

Conversation

@brendanreardon

@brendanreardon brendanreardon commented Feb 14, 2023 •

Copy link
Copy Markdown
Collaborator

This is backwards compatible revision to run with the underlying moalmanac database existing entirely in memory for the process, rather than reading from TinyDB. Additionally, the codebase has been refactored to allow for additional customizability of which features are executed.

The underlying molecular oncology almanac database has been updated to the v.2023-02-02 release within this pull request.

Additions:

  • A section called function_toggle has been added to config.ini to enable or disable several features of moalmanac, including,
    • Calculate mutational signatures with deconstructSigs,
    • Calculate preclinical efficacy of observed therapeutic sensitivity relationships
    • Calculate model similarity
    • Include preclinical efficacy results into patient actionability report
    • Include model similarity into patient actionability report
    • Generate figures illustrating mutational signatures
    • Generate figures illustrating preclinical efficacy results

Revisions:

  • The underlying moalmanac database is now read and held entirely in memory with the json python library, rather than through TinyDB. Several code revisions were also impacted by this change
    • Functions for almanac annotations within annotator.py no longer require patient_id and output folder to be passed.
    • Querying the underlying moalmanac database was revised to use subset the database using JSON and Pandas dataframes, rather than TinyDB's querying features.
    • The function import_ds within class Almanac within datasources.py was revised and the function import_genes` was added.
    • A function was written within the Almanac class of annotator.py to import genes contained within the moalmanac database.
    • The script create_almanac_db.py within the datasources/moalmanac/ was revised to generate the database from the moalmanac-db GitHub repository. In addition to containing database content, the script adds keys detailing the database version and release information as well as genes contained in the database.
  • Code surrounding preclinical efficacy comparisons and relevant figure generation has been revised to support user configuration of calculations, resulting figure generations being performed, and if these results should be included in the actionability report. Relevant codeblocks have been refactored to support this, including their own sections of moalmanac.py. Figures are now generated and written from moalmanac.py.
    • Removed picture removal from run_tests.sh because incidental figures are no longer generated when testing.
  • Code surrounding mutational signature calculations and relevant figure generation has been revised to support user configuration of running deconstructSigs and resulting figure generations being performed. Relevant codeblocks have been refactored to support this, including their own sections of moalmanac.py. Figures are now generated and written from moalmanac.py.
  • Code surrounding patient profile to cell line comparisons has been revised to support user configuration of having this feature run or not, as well as if it should be included in the actionability report or not.
    • class imports into matchmaker.py have been revised to have one class per line
  • The underlying moalmanac database was renamed from moalmanac.json to molecular-oncology-almanac.json.
  • The reporter.py module has been refactored to generate the report based on an object, in line with Frozen Flask best practices.
  • Figure generation for mutational signatures and preclinical efficacy now occurs within moalmanac.py, rather than within modules of the codebase.
  • A variable has been created within moalmanac.py called output_label to reduce the repetition of calling the profile_id, which is used for output file names.
  • The additional.matches.json output is no longer produced. These results are entirely included in the actionability report output.
  • Classes within annotator.py and datasources.py are no longer explicitly inherited from the object class, per Python 3 practices.
  • Some unit tests were revised to no longer perform within for loops to assist with debugging.
  • Unit tests within test/annotator_tests.py and test/features_test.py were updated to support the latest version of the moalmanac database being used within this release, both the database content and to not use TinyDB.
  • Flask has been upgraded to 2.0.0 in requirements.txt.

Bug fixes:

  • A warning is no longer produced from URL generators when producing the actionability report.
  • almanac-gdsc-mappings.json was revised to include Cetuximab within GDSC for the therapy Cetuximab + Encorafenib.
  • The R wrapper to execute deconstructSigs was not functioning properly if the provided folder name did not end with a forward slash. The function calculate_signatures.py was revised to include a forward slash in the folder name, if the path did not already end with one.

Pre-pull request check list,

  • Relevant documentation has been updated
  • All unit tests pass
  • All outputs pre- and post- changes match by md5 hash
  • All files changed have been reviewed

…y database. The file matchmaker.py now directly imports other classes. Calculating model similarity can be turned on and off in the config.ini file, as well as if the results are included in the actionability report. Added seed to SNFpy
@brendanreardon brendanreardon changed the title Revise to use db entirely in memory Revise to use in memory db Feb 14, 2023

@brendanreardon brendanreardon left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished reviewing all files changed within Pull Request.

@brendanreardon

Copy link
Copy Markdown
Collaborator Author

No relevant documentation needed to be updated as this was an internal, backwards compatible change. config.ini was updated in this pull request in accordance with the method and database versions.

@brendanreardon

Copy link
Copy Markdown
Collaborator Author

Merging pull request.

@brendanreardon
brendanreardon merged commit 2d766ff into main Mar 9, 2023
@brendanreardon
brendanreardon deleted the consolidate-file-writing branch March 9, 2023 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant