Reports
OmixAtlas class enables users to interact with functional properties of the omixatlas such as create and update an Omixatlas, get summary of it's contents, add, insert, update the schema, add, update or delete datasets, query metadata, download data, save data to workspace etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token |
str
|
token copy from polly. |
None
|
Usage
from polly.OmixAtlas import OmixAtlas
omixatlas = OmixAtlas(token)
delete_linked_report(repo_key, dataset_id, report_id)
Delete the link of the report in workspaces with the specified dataset in OmixAtlas. On success displays a success message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_name/repo_id of the repository which is linked. |
required |
dataset_id |
str
|
dataset_id of the dataset to be unlinked |
required |
report_id |
str
|
report id associated with the report in workspaces that is to be deleted. This id can be found when invoking the fetch_linked_report() function. |
required |
Raises:
Type | Description |
---|---|
InvalidParameterException
|
Invalid parameter passed |
Returns:
Type | Description |
---|---|
None
|
None |
fetch_linked_reports(repo_key, dataset_id)
Fetch linked reports for a dataset_id in an OmixAtlas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_name/repo_id of the repository for which to fetch the report |
required |
dataset_id |
str
|
dataset_id of the dataset which to fetch the reports. |
required |
Raises:
Type | Description |
---|---|
InvalidParameterException
|
invalid parameters |
RequestException
|
api request exception |
UnauthorizedException
|
unauthorized to perform this action |
Returns:
Type | Description |
---|---|
pd.DataFrame
|
A Dataframe with the details of the linked reports - who added the report, when it was added and the link. |
generate_report(repo_key, dataset_id, workspace_id, workspace_path='')
This function is used to generate a metadata distribution report for a dataset belonging to the geo repository. The generated report is then saved to the workspace provided. This is a MVP release to minimise time taken by users to determine relevance of a dataset in their research, we’re enabling auto-generation of reports. These reports will contain dataset/sample level metadata and graphs showing sample distribution. It will help them figure out which cohorts could be of interest in a given dataset. This template can be modified and we’re open to user’s feedback. This report is available on the user’s local path as well as an option to upload the report to workspaces is given. A message will be displayed on the status of the operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_name/repo_id for which the report is to be generated |
required |
dataset_id |
str
|
dataset_id for which the report is to be generated |
required |
workspace_id |
int
|
workspace_id to where the report is to be uploaded |
required |
workspace_path |
str
|
workspace_path to which the report is to be uploaded |
''
|
Raises:
Type | Description |
---|---|
InvalidParameterException
|
Empty or Invalid Parameters |
UnsupportedRepositoryException
|
repo other than GEO/ Unsupported repo |
UnauthorizedException
|
unauthorized to perform this task |
Returns:
Type | Description |
---|---|
None
|
None |
link_report(repo_key, dataset_id, workspace_id, workspace_path, access_key)
This function is used to link a file (html or pdf) present in a workspace with the specified dataset in OmixAtlas. On success it displays the access key URL and a success message. Org admins can now link a report present in a workspace with the specified datasets in an OmixAtlas. Once a report is linked to a dataset in OmixAtlas, it can be fetched both from front-end and polly-python. A message will be displayed on the status of the operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_name/repo_id of the repository to be linked |
required |
dataset_id |
str
|
dataset_id of the dataset to be linked |
required |
workspace_id |
str
|
workspace_id for the file which is to be linked |
required |
workspace_path |
str
|
workspace_path for the file which is to be linked |
required |
access_key |
str
|
access_key(private or public) depending upon the link access type to be generated. If public, then anyone with a Polly account with the link will be able to see the report. If private, only individuals who have access to the workspace where reports is stored will be able to see them. |
required |
Raises:
Type | Description |
---|---|
InvalidParameterException
|
invalid parameters |
Returns:
Type | Description |
---|---|
None
|
None |
link_report_url(repo_key, dataset_id, url_to_be_linked)
This function is used to link a URL with the specified dataset in OmixAtlas. A message will be displayed on the status of the operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_key |
str
|
repo_name/repo_id of the repository to be linked |
required |
dataset_id |
str
|
dataset_id of the dataset to be linked |
required |
url_to_be_linked |
str
|
The url which is to be linked |
required |
Raises:
Type | Description |
---|---|
InvalidParameterException
|
invalid parameters |
Returns:
Type | Description |
---|---|
None
|
None |
Examples
# Install polly python
pip install polly-python
# Import libraries
from polly.auth import Polly
from polly.omixatlas import OmixAtlas
# Create omixatlas object and authenticate
AUTH_TOKEN=(os.environ['POLLY_REFRESH_TOKEN'])
Polly.auth(AUTH_TOKEN)
omixatlas = OmixAtlas()
Link html/pdf with a dataset
This function links a given report present in a workspace to the dataset_id of the given OmixAtlas.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
workspace_id = 8108 # workspace_id as an integer
workspace_path = "GSE100000_GPL17021_report.html"
access_key = "private" # access can be made public if required, access_key="public"
omixatlas.link_report(repo_key, dataset_id, workspace_id, workspace_path, access_key)
File Successfully linked to dataset id = GSE100000_GPL17021. The URL for the private access is 'https://polly.elucidata.io/manage/restricted/file?id=8108&path=%2Fprojects%2F8108%2Ffiles%2FGSE100000_GPL17021_report.html'
Link URL with a dataset
This function is used to link a URL with the specified dataset in OmixAtlas. It must be a secure link i.e https://abc.com
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
url_to_be_linked = "'https://polly.elucidata.io/manage/restricted/file?id=8108&path=%2Fprojects%2F8108%2Ffiles%2FGSE100000_GPL17021_report.html'"
link_report_url(repo_key, dataset_id, url_to_be_linked)
Fetch reports linked with a dataset
This function is used to list of reports linked with the given dataset.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
reports_dataframe = omixatlas.fetch_linked_reports(repo_key, dataset_id)
reports_dataframe
Added_by | Added_time | URL | Report_id | |
---|---|---|---|---|
0 | vivek.mathpal@elucidata.io | 17/02/2023 06:09:21 | https://polly.elucidata.io/manage/restricted/f... | 6aea293d-b30b-45bd-af0f-d83dcaa88b64 |
Delete linked reports
This function is used to delete a particular report linked to the respective dataset.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
report_id = "6aea293d-b30b-45bd-af0f-d83dcaa88b64"
omixatlas.delete_linked_report(repo_key, dataset_id, report_id)
Linked file with report_id = '6aea293d-b30b-45bd-af0f-d83dcaa88b64' deleted.
Generate template report
This function generates a report for GEO as per a template and uploads it to the given workspace_id
.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
workspace_id = 8108 # workspace_id as an integer
omixatlas.generate_report(repo_key, dataset_id, workspace_id)
Query execution succeeded (time taken: 2.72 seconds, data scanned: 5.218 MB)
Fetched 1 rows
Query execution succeeded (time taken: 8.82 seconds, data scanned: 124.330 MB)
Fetched 6 rows
App saved to ./GSE100000_GPL17021_report.html
INFO:root:File uploaded successfully to workspace-id = 8108 at path = GSE100000_GPL17021_report.html!