CBioPortal.py - Interface with the Sloan-Kettering cBioPortal webservice

Author:Ian Sudbery
Release:$Id$
Date:December 09, 2013
Tags:Python

The Sloan Kettering cBioPortal webservice provides access to a database of results of genomics experiments on various cancers. The database is organised into studies, each study contains a number of case lists, where each list contains the ids of a set of patients, and genetic profiles, each of which represents an assay conducted on the patients in the case list as part of the study.

The main class here is the CBioPortal class representing a connection to the cBioPortal Database. Query’s are represented as methods of the class. Study ids or names or case lists can be provided to the constructor to the object, via the setDefaultStudy and setDefaultCaseList methods or to the indevidual query methods. Where ever possible the validity of parameters is checked before the query is executed.

Whenever a query requires a genetic profile id or a list of such ids, but none are given, the list of all profiles for which the show_in_analysis flag is set will be used.

All of the commands provided in the webservice are implemented here and as far as possible the name, syntax and paramter names of the query are identical to the raw commands to the webservice. These queries are:

  • getCancerStudies,
  • getCaseLists,
  • getProfileData,
  • getMutationData,
  • getClinicalData,
  • getProteinArrayInfo,
  • getProteinArrayData,
  • getLink,
  • getOncoprintHTML.

In addition two new queries are implememented that are not part of the webservice:

  • getPercentAltered and
  • getTotalAltered

These emulate the function of the website where the percent of cases that show any alteration for the gene and profiles given are returned (getPercentAltered, or the percent of cases that show an alteration in any of the genes (getTotalAltered) is returned.

examples:

gene_list = [ "TP53",
"BCL2",
"MYC"  ]
portal = CBioPortal()
portal.setDefaultStudy(study = "prad_mskcc")
portal.setDefaultCaseList(case_set_id = "prad_all_complete")
portal.getPercentAltered(gene_list = gene_list)

or more tersely:

portal.CBioProtal()
portal.getPercentAltered(study = "prad_mskcc", case_set_id = "prad_all_complete", 
                         gene_list = ["TP53","BCL2","MYC"], 
                         genetic_profile_id =["prad_mskcc_mrna"])

Any warnings returned by the query are stored in CBioPortal.last_warnings.

Query’s that would give too long an URL are split into smaller querys and the results combined transparently.

A commandline interface is provided for convenience, syntax:

python CBioPortal.py [options] command(s)
exception CBioPortal.CDGSError(error, request)

Bases: exceptions.Exception

exception that handles errors returned by querys in the database

Previous topic

BlatTest.py -

Next topic

<no title>

This Page