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

control protein graph construction verbosity #242

Merged
merged 6 commits into from
Jan 3, 2023

Conversation

davidfstein
Copy link
Contributor

@davidfstein davidfstein commented Dec 2, 2022

Reference Issues/PRs

What does this implement/fix? Explain your changes

Fixes #238
Adds verbosity control to the protein graph construction. The drawback is that this solution still involves the creation of a Progress context even if no progress is shown. However, this overhead is minimal and obviates the need for try/catch/finally if using Progress non-contextually or shallow wrappers in construct_graph.

What testing did you do to verify the changes in this PR?

Passes the included tests.

Pull Request Checklist

  • Added a note about the modification or contribution to the ./CHANGELOG.md file (if applicable)
  • Added appropriate unit test functions in the ./graphein/tests/* directories (if applicable)
  • Modify documentation in the corresponding Jupyter Notebook under ./notebooks/ (if applicable)
  • Ran python -m py.test tests/ and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g., python -m py.test tests/protein/test_graphs.py)
  • [x ] Checked for style issues by running black . and isort .

@davidfstein
Copy link
Contributor Author

@a-r-j Seems the docker build is failing. I didn't edit the build at all, is it working on master?

@a-r-j
Copy link
Owner

a-r-j commented Dec 5, 2022

It can be a little unstable. I'm quite confident a rebuild will resolve the problem.

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2022

Codecov Report

Base: 40.27% // Head: 47.93% // Increases project coverage by +7.66% 🎉

Coverage data is based on head (f98ecf3) compared to base (8123f42).
Patch coverage: 52.14% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   40.27%   47.93%   +7.66%     
==========================================
  Files          48       92      +44     
  Lines        2811     5526    +2715     
==========================================
+ Hits         1132     2649    +1517     
- Misses       1679     2877    +1198     
Impacted Files Coverage Δ
graphein/ml/diffusion.py 0.00% <0.00%> (ø)
graphein/ppi/graph_metadata.py 0.00% <0.00%> (ø)
graphein/ppi/visualisation.py 0.00% <0.00%> (ø)
graphein/protein/analysis.py 0.00% <0.00%> (ø)
graphein/protein/features/sequence/utils.py 28.00% <0.00%> (+3.00%) ⬆️
graphein/protein/features/utils.py 27.77% <0.00%> (ø)
graphein/rna/subgraphs.py 83.87% <ø> (ø)
graphein/rna/utils.py 38.46% <ø> (ø)
graphein/rna/visualisation.py 28.57% <ø> (+28.57%) ⬆️
graphein/testing/__init__.py 100.00% <ø> (ø)
... and 85 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -697,12 +701,13 @@ def construct_graph(
if config is None:
config = ProteinGraphConfig()
with Progress(transient=True) as progress:
Copy link
Owner

Choose a reason for hiding this comment

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

Do you think it would be better to use a pattern like this:

from contextlib import nullcontext

cm = Progress(transient=True) if verbose else nullcontext():

with cm as progress:
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah thats really nice, didn't know about nullcontext. I'll refactor

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@a-r-j a-r-j merged commit 47c4d0e into a-r-j:master Jan 3, 2023
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.

Quiet mode for loading protein models
3 participants