generatebio / chroma

A generative model for programmable protein design
Apache License 2.0
627 stars 74 forks source link

HTTPError: 500 Server Error: Internal Server Error for url: https://chroma-weights.generatebiomedicines.com/downloads?token=%5B<api-key>%5D&weights=chroma_backbone_v1.0.pt #44

Closed Hanoriega closed 4 months ago

Hanoriega commented 5 months ago

Hello, I have been trying to re-design an n-terminal, I am fairly still new to coding/commands, so please be gentle and thorough with explanation.
I have created a py file as such: name: VP2_test.py Code inside file:

from chroma import api api.register_key("api-key")

from chroma import Protein, Chroma chroma = Chroma()

protein = Protein('TAPGKKRPVEPSPQRSPDSSTGIGKKGQQPARKRLNFGQTGDSESVPDPQPLGEPPAAPSGVGPNTMAAGGGAPMADNNEGADGVGSSSGNWHCDSTWLGDRVITTSTRTWALPTYNNHLYKQISNGTSGGATNDNTYFGYSTPWGYFDFNRFHCHFSPRDWQRLINNNWGFRPKRLSFKLFNIQVKEVTQNEGTKTIANNLTSTIQVFTDSEYQLPYVLGSAHQGCLPPFPADVFMIPQYGYLTLNNGSQAVGRSSFYCLEYFPSQMLRTGNNFQFTYTFEDVPFHSSYAHSQSLDRLMNPLIDQYLYYLSRTQTTGGTANTQTLGFSQGGPNTMANQAKNWLPGPCYRQQRVSTTTGQNNNSNFAWTAGTKYHLNGRNSLANPGIAMATHKDDEERFFPSNGILIFGKQNAARDNADYSDVMLTSEEEIKTTNPVATEEYGIVADNLQQQNTAPQIGTVNSQGALPGMVWQNRDVYLQGPIWAKIPHTDGNFHPSPLMGGFGLKHPPPQILIKNTPVPADPPTTFNQSKLNSFITQYSTGQVSVEIEWELQKENSKRWNPEIQYTSNYYKSTSVDFAVNTEGVYSEPRPIGTRYLTRNL') protein = chroma.design(protein, design_selection="resid 1-65 around 5.0")

protein.to("test.pdb")

Everytime I try to run in windows prompt:

Python VP2_test.py

It gives me this error and I am unsure why it is giving me the error.

(hw2) C:\Users\myuser\chroma>python VP2_test.py Traceback (most recent call last): File "C:\Users\myuser\chroma\VP2_test.py", line 6, in chroma = Chroma() File "C:\Users\myuser\chroma\chroma\models\chroma.py", line 84, in init self.backbone_network = graph_backbone.load_model( File "C:\Users\myuser\chroma\chroma\models\graph_backbone.py", line 405, in load_model return utility_load_model( File "C:\Users\myuser\chroma\chroma\utility\model.py", line 104, in load_model weights = api.download_from_generate( File "C:\Users\myuser\chroma\chroma\utility\api.py", line 118, in download_from_generate response.raise_for_status() # Raise an error for HTTP errors File "C:\Users\myuser.conda\envs\hw2\lib\site-packages\requests-2.31.0-py3.9.egg\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://chroma-weights.generatebiomedicines.com/downloads?token=%5Bapi-key%5D&weights=chroma_backbone_v1.0.pt

Can you help me? Thank you

(edited to mask API key)

Hanoriega commented 5 months ago

Also, that token was just generated and used the prompt on the website as to how I should copy and paste the API token.

aismail3-gnr8 commented 5 months ago

It looks like the double quote characters are coming out funny in the API call that's being made. Try enclosing your key in single quotes?

Hanoriega commented 5 months ago

I changed the double quote to single quote:

from chroma import api api.register_key('API_key')

from chroma import Protein, Chroma chroma = Chroma()

protein = Protein('TAPGKKRPVEPSPQRSPDSSTGIGKKGQQPARKRLNFGQTGDSESVPDPQPLGEPPAAPSGVGPNTMAAGGGAPMADNNEGADGVGSSSGNWHCDSTWLGDRVITTSTRTWALPTYNNHLYKQISNGTSGGATNDNTYFGYSTPWGYFDFNRFHCHFSPRDWQRLINNNWGFRPKRLSFKLFNIQVKEVTQNEGTKTIANNLTSTIQVFTDSEYQLPYVLGSAHQGCLPPFPADVFMIPQYGYLTLNNGSQAVGRSSFYCLEYFPSQMLRTGNNFQFTYTFEDVPFHSSYAHSQSLDRLMNPLIDQYLYYLSRTQTTGGTANTQTLGFSQGGPNTMANQAKNWLPGPCYRQQRVSTTTGQNNNSNFAWTAGTKYHLNGRNSLANPGIAMATHKDDEERFFPSNGILIFGKQNAARDNADYSDVMLTSEEEIKTTNPVATEEYGIVADNLQQQNTAPQIGTVNSQGALPGMVWQNRDVYLQGPIWAKIPHTDGNFHPSPLMGGFGLKHPPPQILIKNTPVPADPPTTFNQSKLNSFITQYSTGQVSVEIEWELQKENSKRWNPEIQYTSNYYKSTSVDFAVNTEGVYSEPRPIGTRYLTRNL') protein = chroma.design(protein, design_selection="resid 1-65 around 5.0")

protein.to("test.pdb")

Now, it says:

Data saved to C:\Users\myuser\AppData\Local\Temp\chroma_weights\90e339502ae6b372797414167ce5a632\weights.pt Computing reference stats for 2g3n Data saved to C:\Users\myuser\AppData\Local\Temp\chroma_weights\03a3a9af343ae74998768a2711c8b7ce\weights.pt Loaded from cache Traceback (most recent call last): File "C:\Users\myuser\chroma\VP2_test.py", line 8, in protein = chroma.design(protein, design_selection="resid 1-65 around 5.0") File "C:\Users\myuser\chroma\chroma\models\chroma.py", line 528, in design design_selection = protein.get_mask(design_selection) File "C:\Users\myuser\chroma\chroma\data\protein.py", line 499, in get_mask residue_gtis = self.sys.select_residues(selection, gti=True) File "C:\Users\myuser\chroma\chroma\data\system.py", line 1158, in select_residues val, selex_info = self._select( File "C:\Users\myuser\chroma\chroma\data\system.py", line 1264, in _select val = tree.evaluate(expression) File "C:\Users\myuser\chroma\chroma\data\system.py", line 4518, in evaluate val, rem = self._traverse_expression_tree(E, debug=self.debug) File "C:\Users\myuser\chroma\chroma\data\system.py", line 4478, in _traverse_expression_tree result = _my_eval(op, left, right, debug) File "C:\Users\myuser\chroma\chroma\data\system.py", line 4395, in _my_eval result = self.eval_function(op, left, right) File "C:\Users\myuser\chroma\chroma\data\system.py", line 1559, in _selex_eval D = np.sqrt(((X_j[np.newaxis, :, :] - X_i[:, np.newaxis, :]) ** 2).sum(-1)) IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Do you think the double quotes should be changed elsewhere also?, and why does it say reference stats for 2g3n? Is there a way to change this to 1LP3? Or is there a length cutoff I need to correct for the sequence? Thank you for your reply

aismail3-gnr8 commented 5 months ago

Since you're defining a protein from a sequence directly, there's no structural information. Consequently, the selection fails. Also, note that the normal usage of chroma.design gets sequences and sidechains given backbone coordinates that are already present. If you don't have them, you should probably use chroma.sample. Perhaps you could provide more details on what you're trying to do? If you'd like to draw a backbone that's biased towards a particular sequence, you could sample with a conditioner of type chroma.layers.structure.conditioners.SubsequenceConditioner.

The output concerning reference statistics is because some graph features are standardized relative to a given PDB, which we've chosen to be 2G3N. If you're training your own network, you can certainly standardize these differently or not at all. The documentation of chroma.layers.structure.protein_graph.ProteinFeatureGraph has more details. To be clear, though, the feature normalization does not affect the applicability of the model to arbitrary structures, including others in the PDB.

aismail3-gnr8 commented 4 months ago

Closing this as it hasn't had any activity, @Hanoriega please feel free to reopen if you're still running into trouble!