[chimerax-users] alphafold block

Roberto Marabini roberto.marabini.cnb at gmail.com
Tue Feb 15 05:14:17 PST 2022


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


More information about the ChimeraX-users mailing list