Basic Functions
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:
-
token
(str
, default:None
) –token copy from polly.
Usage
from polly.OmixAtlas import OmixAtlas
omixatlas = OmixAtlas(token)
create
create(display_name, description, repo_name='', image_url='', components=[], category='private', data_type=None, org_id='', controls={})
This function is used to create a new omixatlas. The arguments category, data_type and org_id can only be set during creation of Omixatlas and cannot be updated afterwards.
Parameters:
-
display_name
(str
) –Display name of the omixatlas as shown on the GUI.
-
description
(str
) –description of the omixatlas.
-
repo_name
(str
, default:''
) –repo_name which is used to create index in database.
-
image_url
(str
, default:''
) –URL of the image which should be kept as the icon for omixatlas.
-
components
(list
, default:[]
) –Optional Parameter.
-
category
(str
, default:'private'
) –Optional parameter(public/private/diy_poa).Immutable argument.
-
data_type
(str
, default:None
) –Optional Parameter(single_cell/rna_seq).Immutable argument.
-
org_id
(str
, default:''
) –Optional Parameter. Org Id is mandatory to be passed when category
Returns:
-
DataFrame
–Dataframe after creation of omixatlas.
Raises:
-
ValueError
–Repository creation response is in Incorrect format.
get_all_omixatlas
This function will return the summary of all the Omixatlas on Polly which the user has access to. Please use this function with default values for the paramters.
Parameters:
-
query_api_version
(str
, default:'v2'
) –query api version
-
count_by_source
(bool
, default:True
) –count by source
-
count_by_data_type
(bool
, default:True
) –count by data type
Returns:
-
list
–It will return a list of JSON objects. (See Examples)
Raises:
-
wrongParamException
–invalid parameter passed
omixatlas_summary
This function will return you a object that contain summary of a given Omixatlas. Please use the function with the default values for optional parameters.
Parameters:
-
repo_key
(str
) –repo_id or repo_name.
-
query_api_version
(str
, default:'v2'
) –query api version
-
count_by_source
(bool
, default:True
) –count by source
-
count_by_data_type
(bool
, default:True
) –count by data_type
Returns:
-
object
–It will return a JSON object. (see examples)
Raises:
-
wrongParamException
–invalid paramter passed.
update
update(repo_key, display_name='', description='', image_url='', workspace_id='', components=[], controls={})
This function is used to update an omixatlas.
Parameters:
-
repo_key
(str / int
) –repo_name/repo_id for that Omixatlas
-
display_name
(str
, default:''
) –Display name of the omixatlas as shown on the GUI.
-
description
(str
, default:''
) –Description of the omixatlas.
-
image_url
(str
, default:''
) –URL of the image which should be kept as the icon for omixatlas.
-
workspace_id
(str
, default:''
) –ID of the Workspace to be linked to the Omixatlas.
-
components
(list
, default:[]
) –List of components to be added.
Examples
OmixAtlas class of polly-python can be initialised using the code block below:-
# 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()
Get summary of an OmixAtlas
This function returns the summary datasets present in an OmixAtlas. It takes repo ID or repo name as input. User can fetch this information using get_all_omixatlas function.
This function returns a dictionary as shown below:-{
"data": {
"repo_name": "geo",
"repo_id": "9",
"indexes": {
"files": "geo_files",
"gct_col_metadata": "geo_gct_col_metadata"
},
"v2_indexes": {
"files": "geo_files",
"gct_col_metadata": "geo_gct_col_metadata"
},
"linked_workspace_id": null,
"sources": [
{
"geo": 109692
}
],
"datatypes": [
{
"transcriptomics": 109692
}
],
"dataset_count": 109692,
"disease_count": 6898,
"tissue_count": 1100,
"organism_count": 318,
"cell_line_count": 5170,
"cell_type_count": 911,
"drug_count": 3398,
"data_type_count": 1,
"data_source_count": 1,
"sample_count": 2884128.0,
"normal_sample_count": 520243
}
}
Get summary of all accessible OmixAtlas
This function returns a dictionary containing information about all the OmixAtlases which the user has access to.
{
"data": [
{
"repo_name": "geo",
"repo_id": "9",
"indexes": {
"files": "geo_files",
"gct_col_metadata": "geo_gct_col_metadata"
},
"v2_indexes": {
"files": "geo_files",
"gct_col_metadata": "geo_gct_col_metadata"
},
"linked_workspace_id": null,
"sources": [
{
"geo": 109692
}
],
"datatypes": [
{
"transcriptomics": 109692
}
],
"dataset_count": 109692,
"disease_count": 6898,
"tissue_count": 1100,
"organism_count": 318,
"cell_line_count": 5170,
"cell_type_count": 911,
"drug_count": 3398,
"data_type_count": 1,
"data_source_count": 1,
"sample_count": 2884128.0,
"normal_sample_count": 520243
},
...
...
{
"repo_name": "immport",
"repo_id": "1621422280385",
"indexes": {
"files": "immport_files",
"gct_col_metadata": "immport_gct_col_metadata"
},
"v2_indexes": {
"files": "immport_files",
"gct_col_metadata": "immport_gct_col_metadata"
},
"linked_workspace_id": null,
"sources": [
{
"immport": 200118
}
],
"datatypes": [
{
"lab measurement": 142296
},
{
"proteomics": 36990
},
{
"titer": 10613
},
{
"pcr": 7786
},
{
"cytometry": 2433
}
],
"dataset_count": 200118,
"disease_count": 81,
"tissue_count": 10,
"organism_count": 2,
"cell_line_count": 1,
"cell_type_count": 2,
"drug_count": 47,
"data_type_count": 5,
"data_source_count": 1,
"sample_count": 168429.0,
"normal_sample_count": 25887
}
]
}
Creating an OmixAtlas
A data-admin of Polly can create an Omixatlas as shown below:
result = omixatlas.create(display_name = "demo omixatlas", description = "testing datatype param")
print(result)
OmixAtlas 1676623460836 Created
Repository Id Repository Name Category Display Name Description
0 1676623460836 demo_omixatlas private demo_omixatlas testing datatype param
Please note that other attributes such as repo_name
, image_url
, components
, category
, org_id
and data_type
are optional parameters. Users can refer to attribute definition in create function to know more.
For bulk RNA seq DIY accounts, the following code block can be used:-
result = omixatlas.create(display_name = "diy bulk rna omixatlas", description = "this is for bulk rna seq diy customer",
category = "diy_poa", data_type = "bulk_rna_seq", org_id = "123456")
print(result)
Similarly, for single-cell DIY accounts, the following code block can be used:-
result = omixatlas.create(display_name = "diy single cell omixatlas", description = "this is for single cell diy customer",
category = "diy_poa", data_type = "single_cell", org_id = "123456")
print(result)
Updating an OmixAtlas
An Omixatlas can only be updated if it's licence is managed by an organization. Data-admins of Polly can update properties of an Omixatlas.
res = omixatlas.update(display_name = "geo", description = "this is the revised description of demo omixatlas")
print(result)
Repository Id Repository Name Category Display Name Description
1643016586529 geo private Geo OmixAtlas this is the revised description of demo omixatlas
Please note that as of release 0.2.9, the attributes such as repo_name
, repo_id
, org_id
, category
, data_type
are immutable and can not be updated. To know more about parameters which can be updated, please refer to the update function