matteoferla / MichelaNGLo-app

A web app to convert a PyMOL PSE file or PDB file to a easy to implement NGL.js view that can be implemented easily on any site
https://michelanglo.sgc.ox.ac.uk/
MIT License
25 stars 4 forks source link

Running the app without Venus and pyrosetta #3

Open JonKapla opened 2 years ago

JonKapla commented 2 years ago

Hi,

Thanks for a very cool way of displaying proteins! :)

I'm interested in running the app to get the page creation functionality locally. Since I'm working in a commercial setting there is no way for me to use pyrosetta. Is it possible to deploy the app without Venus and pyrosetta dependencies in a simple way, or are those too intertwined into the code?

It seems I need to somehow disable the calls to the protein analysis functions in michelanglo-protein and remove the Venus stuff from the app, but I simply don't know the best way of doing that. Some guidance would be very much appeciated!

Thanks!

matteoferla commented 2 years ago

Thanks!

About PyRosetta, for ReadTheDocs in a different project of mine, Fragmenstein, I made a mock of PyRosetta, which allows the typehints to crash on import. https://github.com/matteoferla/Fragmenstein/blob/master/fragmenstein/igor/pyrosetta_import.py

This feature/hack was discussed in https://github.com/matteoferla/Fragmenstein/issues/6

For Michelanglo, I am not sure if running beforehand

import sys
sys.modules['pyrosetta'] = 'mocked'
import pyrosetta

will work. If not copying the linked snippet might.

I have an urgent deadline ATM so I cannot test to see which works —sorry

The protein analysis module is required for a few routes beyond Venus. For example in the /name (the dictionary of Uniprot --> PDB comes from there)

JonKapla commented 2 years ago

Thanks for the quick response!

I was suspecting that it would not suffice to just get rid of the protein analysis stuff. I'll give your suggestion a try. Seems like it could work!

Thanks again, I'll report back here to celebrate my victory (or..ehm..more likely to very kindly ask for additional support when it failed miserably)!

JonKapla commented 2 years ago

Ok! I tried your mock snippet, and I made one for pyrosetta_help as well, then I needed to comment out stuff in description.py since it relies on rosetta_help, which does not return the correct datatypes using the mock snippet. Now I got the app running, but I can't fetch from PDB code. This is what is written in mike.log:

CORE reference DATA IS MISSING --trigger by ../protein-data/reference/pdb_chain_uniprot.tsv
There are two options, you have never ever run this script before or the folder ../protein-data/reference is not corrent
this is super experimental (i.e. I've never bother)
Continue y/[n] _
"mike.log" [noeol] 56L, 4191C                                                                                              

A huge step on the way though! To be continued ... :)

matteoferla commented 2 years ago

I have not actually tested a from scratch installation in a long while... and there's a bug the requirements.txt in the main app has pycrypto package, which is incorrect —this package is one of those like PIL and pillow, it should have been pycryptodome —but I assume you got that far.

Anyway. The absence of a valid protein data folder is the reason the server hangs on MICHELANGLO_PROTEIN_DATA=foo python3 app.py --d. There is a [yn] question on whether one wants to download data. In this case it is trying to get protein information to fill the feature trace. The repo https://github.com/matteoferla/MichelaNGLo-human-protein-data (human protein stripped of non uniprot data which require licences) has not been updated, but I can will do so on Tuesday. However, the code ought to handle downloading the Uniprot XML (it predates the lovely new Uniprot API in beta), so I'll look into then about.

JonKapla commented 2 years ago

Thanks Matteo! Loading from a pdb file seems to work, but not the fetch. I'll see what I can do about the protein data directory.

EDIT: Trying today, the fetch seems to work. So it actually seems I have an at least mostly working version of your server up and running. :)

matteoferla commented 2 years ago

Great. I should have specified that yesterday was a holiday here for May day (workers' day, Saint Walpurgis, Calan Mai or Floralia etc etc, but basically a holiday where Morris dancers do silly folk dances while going from pub to pub) so I was offline (hiking).

I have updated the repo https://github.com/matteoferla/MichelaNGLo-human-protein-data with the newest human dataset, so should work glitchlessly. If you require any organism apart from humans let me know.