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

Add effect/pvalue selectors to ExpressionAPI() #103

Merged
merged 4 commits into from
Aug 28, 2024

Conversation

cmatKhan
Copy link
Member

This adds a branch protection CI and also the ability to select the expression/pvalue columns from the ExpressionAPI().

An example with McIsaac

# Remember to configure your environment, probably with a 
# .env file

from yeastdnnexplorer.interface import *

expression = ExpressionAPI()

# get the expression table records (metadata)

expression_res = await expression.read()

expression_df = expression_res.get("metadata")

# pull the data with the default (set in the FileFormat record)
# effect column, in this case shrunken log2foldchange

expression.push_params({"id": "3396"})

expression_res = await expression.read(retrieve_files=True)

shrunken_data = expression_res.get("data").get("3396")

# push 'effect_colname' on and pull again

expression.push_params({"effect_colname": "log2_cleaned_ratio"})

expression_res = await expression.read(retrieve_files=True)

non_shunken_data = expression_res.get("data").get("3396")

Please be very careful with this and check assumptions. In particular:

  1. Only set effect_colname or pvalue_colname if selecting data from a single datasource. See improve error handling of effect_colname and pvalue_colname #102
  2. Check assumptions -- shrunken mcisaac data should have more zeros that non shrunken. Avg abs(non shrunken) should be >= avg(shrunken), etc.

More information on all of the data in the database can be found here:

https://github.com/cmatKhan/parsing_yeast_database_data?tab=readme-ov-file

These are the columns of interest in mcisaac

  • log2_ratio - log2(red / green) subtracting value at time zero
  • log2_cleaned_ratio - Non-specific stress response and prominent outliers removed
  • log2_shrunken_timecourses - selected timecourses with observation-level shrinkage based on local FDR (false discovery rate). Most users of the data will want to use this column.

Let's use log2_cleaned_ratio, but we might try log2_ratio, also

)

This should only allow pulls from a branch called `dev` or `patch` directly to main. otherwise, pull requests will be required to be against `dev`

Adding the `use_cache` option to AbstractRecordAndFilesAPI(). Also
did some `dev` branch maintenance to rebase onto the curren state
of `main`

removing use_cache setting; cache_key updated to include effect and pvalue colnames
@cmatKhan cmatKhan requested a review from ejiawustl August 23, 2024 19:58
cmatKhan and others added 3 commits August 23, 2024 15:01
* adding perturbation response relationship tutorial

* addressed the changes to the notebook: added analysis to all graphs, typehinting and docstrings to methods, and other misc changes

* added new methods and analysis to enable comparison between different dataset combinations. Added everything under the last subtitle, with each section having smaller subheadings underneath to group everything

* Calculate variance explained (BrentLab#88)

* fixed adjustment function so its based on enrichment strength

* added new file util.py and new test suite and updated notebook

* Update pyproject.toml

This is already in the dev dependencies. I forgot to go over that.

To add 'production' depdencies with python, you add to the default dependencies section with just:

```
poetry add <package>
```

You can also add dependencies to a group, eg:

```
poetry add --group dev <package>
```

See https://python-poetry.org/docs/cli/#options-4

That way, you can control what dependencies get installed.

For a typical user, I don't think we'll want to install jupyter in the environment. They should have jupyter in their environment, and then install yeastdnnexplorer into it.

* parameterizing the max_adjustment value and adding the calculate_variance_explained function and test suite

* removing the function and test suite for calculating the variance explained and adding the function to the visualizing_and_testing_data_generation_methods notebook

* Added docstrings and typehinting, removed unnecessary work and added exposition to graphs and methods

* updated notebook to use sphinx docstrings, added headings and subheadings and improved exposition

---------

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>
Co-authored-by: Chase Mateusiak <chasem@wustl.edu>

* fixed adjustment function so its based on enrichment strength (BrentLab#86)

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>

* Database Interface (BrentLab#90)

* adding new file for explanation

* adding ParamsDict

* init implementation of the API classes. Documentation and some testing included. RankResponse is not, and the testing is minimal due to the difficulty of testing futures

* adding some words to the project ignore settings

* rank response api working

* addressing unused imports in RankResponseAPI

* updating the database_interface notebook for the new database backend; addressing logging warning on instantiation

* updating the tutorial to show how to use the aggregated data (BrentLab#91)

* table data retrieved as gzip; addtiional columns now present from DB

* Update README.md

closes BrentLab#81

* Adding update to manualqc (BrentLab#96)

* removing new file, part of a demo

* adding update() method to bindingmanualqc; added _delimiter_detect method to AbstractRecords

* addressing pre-commit issues

* This is getting the dev branch rebased onto the main branch (BrentLab#100)

* Calculate variance explained (BrentLab#88)

* fixed adjustment function so its based on enrichment strength

* added new file util.py and new test suite and updated notebook

* Update pyproject.toml

This is already in the dev dependencies. I forgot to go over that.

To add 'production' depdencies with python, you add to the default dependencies section with just:

```
poetry add <package>
```

You can also add dependencies to a group, eg:

```
poetry add --group dev <package>
```

See https://python-poetry.org/docs/cli/#options-4

That way, you can control what dependencies get installed.

For a typical user, I don't think we'll want to install jupyter in the environment. They should have jupyter in their environment, and then install yeastdnnexplorer into it.

* parameterizing the max_adjustment value and adding the calculate_variance_explained function and test suite

* removing the function and test suite for calculating the variance explained and adding the function to the visualizing_and_testing_data_generation_methods notebook

* Added docstrings and typehinting, removed unnecessary work and added exposition to graphs and methods

* updated notebook to use sphinx docstrings, added headings and subheadings and improved exposition

---------

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>
Co-authored-by: Chase Mateusiak <chasem@wustl.edu>

* fixed adjustment function so its based on enrichment strength (BrentLab#86)

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>

* Database Interface (BrentLab#90)

* adding new file for explanation

* adding ParamsDict

* init implementation of the API classes. Documentation and some testing included. RankResponse is not, and the testing is minimal due to the difficulty of testing futures

* adding some words to the project ignore settings

* rank response api working

* addressing unused imports in RankResponseAPI

* updating the database_interface notebook for the new database backend; addressing logging warning on instantiation

* updating the tutorial to show how to use the aggregated data (BrentLab#91)

* table data retrieved as gzip; addtiional columns now present from DB

* Update README.md

closes BrentLab#81

* Adding update to manualqc (BrentLab#96)

* removing new file, part of a demo

* adding update() method to bindingmanualqc; added _delimiter_detect method to AbstractRecords

* addressing pre-commit issues

---------

Co-authored-by: ejiawustl <89940465+ejiawustl@users.noreply.github.com>
Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>

* Add branch protection CI to prevent pulls directly to main (BrentLab#101)

This should only allow pulls from a branch called `dev` or `patch` directly to main. otherwise, pull requests will be required to be against `dev`

* fixed adjustment function so its based on enrichment strength (BrentLab#86)

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>

* adding perturbation response relationship tutorial

* addressed the changes to the notebook: added analysis to all graphs, typehinting and docstrings to methods, and other misc changes

* added new methods and analysis to enable comparison between different dataset combinations. Added everything under the last subtitle, with each section having smaller subheadings underneath to group everything

* added docstring and typehinting to all methods, and added exposition to better explain the different conditions we use the model in. TODO: need to hide some of the output when training models or create an issue if I am unable to do so.

* Update exploring_perturbation_response_relationship notebook, still WIP

* adding notebook, new pyproject

* updated notebook: including a lot of new things based on the research work we have been doing for the last month. This notebook currently ends with a guide on creating the linear models on the cluster, but I can include more recent work involving the correlations and models we have been experimenting with

* went through all notebooks in vim and resolved merges by keeping the current changes

* adding statsmodels to pyproject

---------

Co-authored-by: Eric Jia <ericjia@Erics-MBP-2.attlocal.net>
Co-authored-by: Chase Mateusiak <chasem@wustl.edu>
Co-authored-by: Chase Mateusiak <chase.mateusiak@gmail.com>
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@ejiawustl ejiawustl left a comment

Choose a reason for hiding this comment

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

lgtm

@ejiawustl ejiawustl merged commit f2c448a into BrentLab:dev Aug 28, 2024
7 checks passed
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.

2 participants