Skip to content

Instantly share code, notes, and snippets.

@matteoferla
Created September 13, 2021 10:39
Show Gist options
  • Save matteoferla/9ebc7863a28739cd8317d4e8d73e32d5 to your computer and use it in GitHub Desktop.
Save matteoferla/9ebc7863a28739cd8317d4e8d73e32d5 to your computer and use it in GitHub Desktop.
Colabs cell to upload a given structure within `output_dir` to Michelanglo
Display the source blob
Display the rendered blob
Raw
#@title Upload to Michelanglo (optional)
#@markdown [Michelanglo](https://michelanglo.sgc.ox.ac.uk/) is a website that
#@markdown allows the creation, annotation and sharing of a webpage with an interactive protein viewport.
#@markdown ([examples](https://michelanglo.sgc.ox.ac.uk/gallery)).
#@markdown The created pages are private —they have a 1 in a quintillion change to be guessed within 5 tries.
#@markdown Registered users (optional) can add interactive annotations to pages.
#@markdown A page created by a guest is editable by registered users with the URL to it
#@markdown (this can be altered in the page settings).
#@markdown Leave blank for guest:
username = '' #@param {type:"string"}
password = '' #@param {type:"string"}
#@markdown Choose initial model.
chosen_rank = 1 #@param {type:"integer"}
import os
os.system(f'pip3 install michelanglo-api')
import site
site.main()
from michelanglo_api import MikeAPI
if not username:
mike = MikeAPI.guest_login()
else:
mike = MikeAPI(username, password)
filenames = [for filename in os.listdir('output_dir') if f'rank_{chosen_rank}' filename]
if len(filenames) == 0:
raise ValueError(f'Could not find rank {chosen_rank} in {output_dir}')
elif any(['_relaxed' in filename for filename in filenames]): # relaxed is better!
filename = [filename for filename in filenames if '_relaxed' in filename ][0]
else:
filename = filenames[0]
page = mike.convert_pdb(filename=filename)
page.show_link()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment