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

Makes haddock3 restraints subcommands available as web service #841

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

sverhoeven
Copy link
Contributor

@sverhoeven sverhoeven commented Mar 27, 2024

You are about to submit a new Pull Request. Before continuing make sure you read the contributing guidelines and that you comply with the following criteria:

  • You have sticked to Python. Please talk to us before adding other programming languages to HADDOCK3
  • Your PR is about CNS
  • Your code is well documented: proper docstrings and explanatory comments for those tricky parts
  • You structured the code into small functions as much as possible. You can use classes if there is a (state) purpose
  • Your code follows our coding style
  • You wrote tests for the new code
  • tox tests pass. Run tox command inside the repository folder
  • -test.cfg examples execute without errors. Inside examples/ run python run_tests.py -b
  • PR does not add any dependencies, unless permission granted by the HADDOCK team
  • PR does not break licensing
  • Your PR is about writing documentation for already existing code 🔥
  • Your PR is about writing tests for already existing code :godmode:

In the haddock3 webapp I want to make a restraints file (*.tbl) from a list of active residues in 2 models/structures/molecules.
I decided not to replicate that algorithm or have a complicated shell script behind a generic web service, but make the web service part of haddock3 repo. As the web service only exposes endpoints that are quick and do not need cns.

With this PR you can do

pip install fastapi uvicorn
uvicorn --port 5000 haddock.clis.restraints.webservice:app

This have the Swagger UI running at http://127.0.0.1:5000/docs#/

127 0 0 1_5000_docs

@mgiulini
Copy link
Contributor

hi Stefan, I would also expose the other endpoints (restrain_bodies, calc_accessibility), as they can be useful in the webapp (for ex. to target the whole surface)

@sverhoeven sverhoeven changed the title Makes some haddock3 restraints subcommands available as web service Makes haddock3 restraints subcommands available as web service Mar 28, 2024
@sverhoeven sverhoeven marked this pull request as ready for review April 17, 2024 11:26
@sverhoeven
Copy link
Contributor Author

hi Stefan, I would also expose the other endpoints (restrain_bodies, calc_accessibility), as they can be useful in the webapp (for ex. to target the whole surface)

Other restrain endopoints added and also added a preprocess_pdb endpoint.

@sverhoeven
Copy link
Contributor Author

@rvhonorato could you have a look at the web service code.
@mgiulini could you have a look at the passive_from_active function? I had to move the guts in the cli module to the librestraints module.

@rvhonorato
Copy link
Member

hey @sverhoeven I'm out of the loop about the purpose of this. The code lgtm tho

@mgiulini mgiulini self-requested a review April 24, 2024 08:39
Copy link
Contributor

@mgiulini mgiulini left a comment

Choose a reason for hiding this comment

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

hi @sverhoeven , I checked the function. Moving the guts to the shared library makes sense irrespectively of this PR.

@sverhoeven
Copy link
Contributor Author

@mgiulini could this PR be merged?

Then I can update the deployments in https://github.com/i-VRESSE/haddock3-webapp to use the main haddock3 branch.

@mgiulini
Copy link
Contributor

hi @sverhoeven no problem for me, but I see it fails the codacy-coverage-reporter-linux, not being able to run the integration tests..@rvhonorato do you know what is happening here?

@rvhonorato
Copy link
Member

FYI i've been working on this: https://github.com/rvhonorato/haddock-restraints to add all these functionalities to the frontend via rust/webassembly and also to serve as the base for the GenTBL service. Seems like it overlaps a bit with this here.

@rvhonorato
Copy link
Member

@rvhonorato do you know what is happening here?

Yes, it's written in the error message:

2024-05-27 07:52:56.094Z error [CodacyCoverageReporter] Invalid configuration: Either a project or account API token must be provided or available in an environment variable  - (CodacyCoverageReporter.scala:28)

We should figure out a way that external contributors can also run these, but since our continuous integration pipeline is just for show I've added a conditional: #904

@sverhoeven could you please rebase?

@sverhoeven
Copy link
Contributor Author

thanks @rvhonorato , checks are green now.

@rvhonorato rvhonorato self-assigned this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants