odagayev / cbio_py Goto Github PK
View Code? Open in Web Editor NEWA Python client for the cbioPortal Cancer API.
License: MIT License
A Python client for the cbioPortal Cancer API.
License: MIT License
First GitHub post. Here we go.
I want to extract data from the cBioPortal for a project using Python. Following these instructions, I installed cbio_py using the pip installer. However, when I try the second command, from cbio_py import cbio_mod as cb
, I get an HTTPFound: 302
message.
I've tried this in the terminal and in Jupyter Notebook run from Anaconda and on two different laptops and get the same result. Here's the full text of the error in Jupyter.
HTTPFound Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from cbio_py import cbio_mod as cb
File ~/opt/anaconda3/lib/python3.9/site-packages/cbio_py/cbio_mod.py:4, in <module>
1 from bravado.client import SwaggerClient as bravado_client
3 # This is the initialization of many of the data sources that we will need
----> 4 cbioportal = bravado_client.from_url('https://www.cbioportal.org/api/api-docs',
5 config={"validate_requests":False,"validate_responses":False,"validate_swagger_spec": False,})
7 #Fetch all of the studies
8 def getAllStudies(return_type = 'dict'): #I assume the end user will prefer a dictionary object
File ~/opt/anaconda3/lib/python3.9/site-packages/bravado/client.py:98, in SwaggerClient.from_url(cls, spec_url, http_client, request_headers, config)
96 http_client = http_client or RequestsClient()
97 loader = Loader(http_client, request_headers=request_headers)
---> 98 spec_dict = loader.load_spec(spec_url)
100 # RefResolver may have to download additional json files (remote refs)
101 # via http. Wrap http_client's request() so that request headers are
102 # passed along with the request transparently. Yeah, this is not ideal,
103 # but since RefResolver has new found responsibilities, it is
104 # functional.
105 if request_headers is not None:
File ~/opt/anaconda3/lib/python3.9/site-packages/bravado/swagger_model.py:101, in Loader.load_spec(self, spec_url, base_url)
94 def load_spec(self, spec_url, base_url=None):
95 """Load a Swagger Spec from the given URL
96
97 :param spec_url: URL to swagger.json
98 :param base_url: TODO: need this?
99 :returns: json spec in dict form
100 """
--> 101 response = request(
102 self.http_client,
103 spec_url,
104 self.request_headers,
105 ).result()
107 content_type = response.headers.get('content-type', '').lower()
108 if is_yaml(spec_url, content_type):
File ~/opt/anaconda3/lib/python3.9/site-packages/bravado/http_future.py:282, in HttpFuture.result(self, timeout)
279 if 200 <= incoming_response.status_code < 300:
280 return incoming_response
--> 282 raise make_http_exception(response=incoming_response)
HTTPFound: 302
Any advice on solving this? Thanks.
Hi,
is it possible to access RNAseq data (a table of gene expression values) via the package?
So far I came only to this:
cb.getMolecularProfile("laml_tcga_rna_seq_v2_mrna")
However it just returns:
{'datatype': 'CONTINUOUS', 'description': 'mRNA gene expression (RNA Seq V2 RSEM)', 'genericAssayType': None, 'molecularAlterationType': 'MRNA_EXPRESSION', 'molecularProfileId': 'laml_tcga_rna_seq_v2_mrna', 'name': 'mRNA expression (RNA Seq V2 RSEM)', 'patientLevel': False, 'pivotThreshold': None, 'showProfileInAnalysisTab': False, 'sortOrder': None, 'study': CancerStudy(allSampleCount=None, cancerType=None, cancerTypeId='aml', citation=None, cnaSampleCount=None, completeSampleCount=None, description='TCGA Acute Myeloid Leukemia. Source data from <A HREF="http://gdac.broadinstitute.org/runs/stddata__2016_01_28/data/LAML/20160128/">GDAC Firehose</A>. Previously known as TCGA Provisional.', groups='PUBLIC', importDate='2023-06-19 09:43:19', massSpectrometrySampleCount=None, methylationHm27SampleCount=None, miRnaSampleCount=None, mrnaMicroarraySampleCount=None, mrnaRnaSeqSampleCount=None, mrnaRnaSeqV2SampleCount=None, name='Acute Myeloid Leukemia (TCGA, Firehose Legacy)', pmid=None, publicStudy=True, readPermission=True, referenceGenome='hg19', rppaSampleCount=None, sequencedSampleCount=None, status=0, studyId='laml_tcga', treatmentCount=None), 'studyId': 'laml_tcga'}
Thanks for the response,
K.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.