
Hi, Thanks for the suggestion but I do not think it will work. The main problem here is that Colab window does not appear, and therefore can not be launched, until the python script is done. That is, if I write some code as run(session, "alphafold predict %s" % sequence_data) ... print("test") Colab window will not pop up until the print statement is executed. Where can I find the documentation related to callbacks? On Tue, Feb 15, 2022 at 7:34 PM Tom Goddard <goddard@sonic.net> wrote:
Hi Roberto,
When the AlphaFold prediction completes it loads the best model into ChimeraX. So I suggest checking periodically if any model has been loaded, for example,
if len(session.models) > 0: break # AlphaFold model has been opened.
Another method is to ask ChimeraX to call a callback when a model gets opened, but that would not let you detect the case where AlphaFold fails and a model is never opened. Currently Colab does not tell ChimeraX if an error occurs in sequence alignment or energy minimization -- it only appears in the AlphaFold Run html panel. Errors in the prediction phase are caught and sent to ChimeraX. I should improve this so all errors get sent back to ChimeraX. It is not obvious how to ask Colab if the jobs is still running -- Colab is meant to be run interactively through a web browser so Colab APIs are not documented to programmatically talk to it as far as I know.
Tom
On Feb 15, 2022, at 5:14 AM, Roberto Marabini via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi,
I would like to write a script that executes "alphafold predict SEQUENCE" and then postprocess the results.
The script would be similar to:
from chimerax.core.commands import run run(session, "alphafold predict %s" % sequence_data) # wait until alphafold is done # and postprocess the file best_model.pdb
but I do not know how to implement the part "wait until alphafold is done" if, after launching alphafold, I create a loop similar to:
=== counter = 0 current_size = _getSize(file_path)
while current_size !=_getSize(file_path) or _getSize(file_path)==0 or not os.path.exists(file_path): current_size =_getSize(file_path) time.sleep(60) counter += 1 if counter > 240: # break after four hours if file is not created break ====
the loop is executed as soon as the alphafold command has been sent to google, the alphafold-colab window is not shown until the loop is finished and therefore, alphafold execution never starts.
So the question is: how can I write a script that waits until the command "alphafold predict ..." finishes and then executes some code.
Thanks
Roberto _______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users