Skip to content

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:

Name Type Description Default
token str

token copy from polly.

None
Usage

from polly.OmixAtlas import OmixAtlas

omixatlas = OmixAtlas(token)

create(display_name, description, repo_name='', image_url='', components=[], category='private', data_type=None, org_id='')

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:

Name Type Description Default
display_name str

Display name of the omixatlas as shown on the GUI.

required
description str

description of the omixatlas.

required
repo_name str

repo_name which is used to create index in database.

''
image_url str

URL of the image which should be kept as the icon for omixatlas.

''
components list

Optional Parameter.

[]
category str

Optional parameter(public/private/diy_poa).Immutable argument. By default it is private.

'private'
data_type str

Optional Parameter(single_cell/rna_seq).Immutable argument. By default it is None. If category is public or diy_poa then data_type is mandatory.

None
org_id str

Optional Parameter. Org Id is mandatory to be passed when category of omixatlas is diy_poa. Org Id can be found on admin panel.

''

Returns:

Type Description
pd.DataFrame

Dataframe after creation of omixatlas.

Raises:

Type Description
ValueError

Repository creation response is in Incorrect format.

get_all_omixatlas(query_api_version='v2', count_by_source=True, count_by_data_type=True)

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:

Name Type Description Default
query_api_version str

query api version

'v2'
count_by_source bool

count by source

True
count_by_data_type bool

count by data type

True

Returns:

Type Description

It will return a list of JSON objects. (See Examples)

Raises:

Type Description
wrongParamException

invalid parameter passed

omixatlas_summary(repo_key, query_api_version='v2', count_by_source=True, count_by_data_type=True)

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:

Name Type Description Default
repo_key str

repo_id or repo_name.

required
query_api_version str

query api version

'v2'
count_by_source bool

count by source

True
count_by_data_type bool

count by data_type

True

Returns:

Type Description

It will return a JSON object. (see examples)

Raises:

Type Description
wrongParamException

invalid paramter passed.

update(repo_key, display_name='', description='', image_url='', workspace_id='', components=[])

This function is used to update an omixatlas.

Parameters:

Name Type Description Default
repo_key str/int

repo_name/repo_id for that Omixatlas

required
display_name str

Display name of the omixatlas as shown on the GUI.

''
description str

Description of the omixatlas.

''
image_url str

URL of the image which should be kept as the icon for omixatlas.

''
workspace_id str

ID of the Workspace to be linked to the Omixatlas.

''
components list

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.

repo_key = "geo" # repo_id or repo_name for the omixatlas
omixatlas.omixatlas_summary(repo_key)
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.

omixatlas.get_all_omixatlas()
{
  "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