Package: michelanglo-api
MichelaNGLo-apiA python module to interact with the Michelaɴɢʟo server (https://michelanglo.sgc.ox.ac.uk)
programmatically.InstallationPython 3.6 or higher.pip3 install michelanglo-apiDocumentation for VenusAPIvenus=VenusAPI()# venus = VenusAPI(url='http://0.0.0.0:8088/') for localdata=venus.analyse(gene='LZTR1',mutation='S244C')# dictionary with data.venus.match_species('pink')# ['Clove pink', 'Pink fawn lily', 'Pink hibiscus mealybug', 'Pink tip anemone',...]venus.get_taxid('cat')# 9685venus.get_uniprot('LTR1',9606)# Q8N653venus.from_transcript(enst,gene_mutation)# uniprot and protein mutationvenus.random()# uniprot, protein mutation and speciesDocumentation for MikeAPINotesThe details of the requests accepted by Michelaɴɢʟo are described inits documentation.You may interact with the server however you please. This code is just to make life easier.There are three tiers of users. Basic, priviledged, admin. Basic users cannot add JS to the site as this is a security threat
(cookie theft)... And it prevents users from makingpages that behave maliciously or similar.AuthenticateTo start, authenticate.mike = MikeAPI('username','password')The argumenturlsets other address outside of the SGC one, such ashttp://0.0.0.0:8088.
The password and username can be ommitted, in which case they are either read from the environment variablesMICHELANGLO_PASSWORDandMICHELANGLO_USERNAMEor the user is prompted.To check all workedmike.verify_user(). This will show yourrank(seeuser priviledges in the site).Instance attributes:.urlis 'https://michelanglo.sgc.ox.ac.uk/' unless altered (e.g.local version of Michelanglo).usernameis the username.passwordis the raw password, so do not share pickles!.visited_pages,.owned_pagesand.public_pagesare lists filled by.refresh_pages().requestis the requests session object.Instance methods:.post(route, data=None, headers=None)does the requests for other methods....post_json(route, data=None, headers=None)as above but decodes the json reply....login(). called automatically during initialisation..verify_user(). check whether you are still logged in..refresh_pages(). gets the lists.visited_pages,.owned_pagesand.public_pages(and.allif admin).get_page(uuid)returns theMikePageinstance for a given page. See below..set_page(uuid, data)sets theMikePageinstance for a given page.  See below..delete_page(uuid)delete.  See below.Page editingTo see what pages you own, you can use:mike.owned_pagesPages you created/editedmike.visited_pagesPages you visitedmike.public_pagesAll pages in gallerymike.all_pages(admin only)These are lists ofMikePageinstances that arenotretrieved. Retrieval would reset the expiration date and would be heavy.page = mike.owned_pages[0].retrieve()A specific page can be explicitly retrieved.page = mike.get_page('abcdedf-uuid-string-of-page')Pages can be edited:page.title = 'Hello World'
page.commit()But not all attribute changes are allowed. To understand what does an attribute do (apart from usinghelp) you can query it with:page.what_is('location_viewport')Note that two properties are Enums,.publichandled byPrivacyand.location_viewporthandled byLocation.
This is to avoid arbitrary values:p.public = Privacy['public']
p.public = p.public.__class__['public'] # if you forgot/don't want to import `Privacy`.In addition two methods alter the page with new keys (commitstill required).page.clear_revisions()andpage.refresh_image().To display in a Jupyter notebook a link and a thumbnail usepage.show_link(), however will not work in terminal.Some methods are duplicated betweenMikeAPIandMikePage.page.retrieve()=mike.set_page(uuid)page.commit()=mike.set_page(uuid, page)page.delete()=mike.del_page(uuid)page.shorten(short)=mike.shorten_page(uuid, short)There is no difference.Altering 'loadfun' (the JS) and 'pdb' is restricted to admin and approved users.As changing the variable name in 'proteins' for the PDB code requires it to be changed in 'pdb'.page.proteins[2]['value'] = 'altered_variable_name'
page.pdb['altered_variable_name']The method.rename_protein_variable()does this for you.Proteins stored in GitHub can be added viapage.append_github_entry(self, username, repo, path)where the name
will be a sluggified filename.Page creationNew pages can be added using either a pdb code or a filename with additional arguments as used by prolinks,
but with underscores instead of spaces.new_page = mike.convert_pdb(code='1UBQ', data_focus='residue', data_selection='20:A')
new_page = mike.convert_pdb(filename='/home/my_protein.pdb')Admin commandsSome commands are for admins only. Please do not try them out or you will get automatically blocked.TablesSeetable.md"Merging"The objectMikePagedoes not have a merge uuids like the website has. The reason for this is because this would be rather
redundant and convoluted. To add structures to a page use the following methods:append_github_entryappend_pdbfileappend_pdbblockremove_proteinOr operate upon the manually. PDBBlocks are stored in.pdbs(Dict[str: str]),
while.proteins(List[dict]) stores the protein information.MoreFor more, seeSphinx generated documentation.To DoGet Uniprot chain definitionsread/write MD from/to cellPlotlyWith JS priviledges it is possible to add a Plotly plot, by exporting viafig.write_html("file.html", include_plotlyjs='cdn')and getting the content of<body>and adding to the description (with corrected indentation).
Unfortunately, whereas the path-element of class.pointcontains the data values to determine what residue it is,
I am not sure how to detect a specific click as this detects a click for the whole series...document.getElementById('xxxx').on('plotly_hover', data =>
    data.points.forEach(d => NGL.getStage().compList[0].addRepresentation("hyperball", { sele: ''+d.data.x[0]}))
)