263 step for alphafold multimer query json generation#271
263 step for alphafold multimer query json generation#271AnnaPolensky wants to merge 17 commits intocrosslinkingfrom
Conversation
…also comma-separated input
Elena-kal
left a comment
There was a problem hiding this comment.
One major problem is that inputting the uniprot ids like this: "P69905, P68871" does not work while "P69905 P68871" is fine. Should be fixed by stripping the whitespaces though.
Another issue I came across is that the step is validated (gets the green checkmark) even though there are error messages. This does not happen in other steps.
I also added a few suggestions to the code but overall the code seems fine.
I tested a few structures and used the json file for alphafold predictions. This worked very well. I am also very convinced of the downloads tab, I like it a lot and I think it could be useful for other steps as well.
|
|
||
| # extract protein_ids and number of copies per id and make sure they have the same length | ||
| if "," in protein_ids: | ||
| uniprot_ids = protein_ids.split(",") |
There was a problem hiding this comment.
Maybe also remove all whitespaces. I am not sure whether my problems came from that...
There was a problem hiding this comment.
I think, too, that this caused your problem. I originally did not remove the whitespaces because I only added the comma-separated lists to support copy-paste from Excel where no whitespaces would be included. Changed this now.
| uniprot_ids = protein_ids.split() | ||
| try: | ||
| if "," in number_copies: | ||
| copies_per_id = [int(input) for input in number_copies.split(",")] |
There was a problem hiding this comment.
On the other hand, this split(",") worked I think
There was a problem hiding this comment.
Because we are having an additional cast to an int here, so the cast kind of removes the whitespaces.
| ) | ||
| query_as_string = f"[{json.dumps(query)}]" | ||
| return dict( | ||
| messages={}, |
There was a problem hiding this comment.
Why don't we return messages? And even if we want this to be empty, wouldn't we want the messages to be an empty list not a dict?
There was a problem hiding this comment.
Thanks for pointing out, I added a success message.
| query_as_string = f"[{json.dumps(query)}]" | ||
| return dict( | ||
| messages={}, | ||
| downloads={f"prediction_query_{'_'.join(uniprot_ids)}": query_as_string}, |
There was a problem hiding this comment.
this file name could become very long if we use too many uniprot ids. maybe we could truncate it to prevent this.
There was a problem hiding this comment.
I added another input field, the user now enters the filename themselves.
You can now enter comma- and space-separated ids like "P69905, P68871". Also, changed the validation of the step. Happy to hear that you like the download tab :) |
tE3m
left a comment
There was a problem hiding this comment.
some minor adjustments, but good changes overall
| input_fields=[ | ||
| TextField( | ||
| name="name", | ||
| label="File name and AlphaFold job name for generated query", |
There was a problem hiding this comment.
this label should probably tell the user that the text they enter is only the stem of the filename, since .json is appended automatically
Description
fixes #263


Added a new Output-Tab "Downloads":
Therefore, introduced a new category of step methods, so that we have calc_method, plot_method and download_method.
Used the new download_method, to add a new step "AlphaFoldMultimerQueryJsonGeneration". User can input a list of uniprot ids and how many copies he wants to have of each protein. One can also add a seed if one wants to use a specific seed. Then a json-File is being generated that can be downloaded via the button in the Downloads-Tab.
Changes
backend/protzilla/importing/query_generation.py contains the method for generating the json
backend/protzilla/steps.py contains most of the changes for adding a download_method
frontend/src/components/app/run-screen/run-screen.tsx contains frontend changes for displaying the download-Tab and generating a button for each download.
Testing
Feel free to try different ids and different numbers of copies or try to break the step by putting in different input compared to the specified format.
PR checklist
Development
Mergeability
blackpnpm formatand checked withpnpm lintCode review