These are the main functions meant for external use in functions.py:
- new_project
- get_project_json
- update_project
In order to use the functions, these prerequisites have to be fulfilled:
- A running instance of Microreact which can be accessed with http(s) from the location where Python is running
- An personal access token that will permit creation of projects in Microreact for a user
When a user is logged into Microreact, his/her access token will be visible at https://MICROREACT_BASE:URL/my-account/settings. The calling system should have a stored copy of this token for each user.
Mandatory arguments:
- project_name: str
- tree_calcs: list
- metadata_keys: list
- metadata_values: list
- mr_access_token: str
- mr_base_url: str
Optional arguments:
- public: bool=False
- verify: bool=True
The name of the project as it will appear in Microreact. The project owner can later change the name from inside Microreact.
A list of dicts (or dict-like objects like MongoDB documents) which represent the trees that should be exported to Microreact.
The dicts must contain these keys:
- method: str - this string will be used as name for the tree in Microreact
- result: str - this is the actual tree structure formatted in Newick format
This is a list of str elements that will be used as column names in the data table in Microreact.
This should be a list of lists where each element in the outer list represents a column in the data table and the elements in each inner list hold the actual data for that column.
The access token for the users who will own the project in Microreact.
The base URL for the Microreact instance.
Optional Booelan. If set to True, the created Microreact project will be public. Default is False.
Optional Boolean. If set to False, it will not be checked if the Microreact instance has a valid SSL certificate. Default is True.
new_project will return a dict with the following keys:
- isOwner: wether the user is owner of the project (in fact always True)
- id: unique project id generated by Microreact
- url: project URL
Mandatory arguments:
- project_name: str
- metadata:url: str
- columns: list
- mr_access_token: str
- mr_base_url: str
Optional arguments:
- tree_calcs: list=list()
- hidden: list=list()
- public: bool=False
- verify: bool=True
The name of the project as it will appear in Microreact. The project owner can later change the name from inside Microreact.
Thie URL to fetch the metadata from.
A list of column names to be fetched from the external resource. Only the columns listed here will actually be fetched.
The access token for the users who will own the project in Microreact.
The base URL for the Microreact instance.
A list of dicts (or dict-like objects like MongoDB documents) which represent the trees that should be exported to Microreact.
The dicts must contain these keys:
- method: str - this string will be used as name for the tree in Microreact
- result: str - this is the actual tree structure formatted in Newick format
hidden
A list of columns that should be hidden in the Microreact project.
Optional Booelan. If set to True, the created Microreact project will be public. Default is False.
Optional Boolean. If set to False, it will not be checked if the Microreact instance has a valid SSL certificate. Default is True.
new_project will return a dict with the following keys:
- isOwner: wether the user is owner of the project (in fact always True)
- id: unique project id generated by Microreact
- url: project URL