GW-HIVE / GW-HIVE/bioxpress

cBioPortal mRNA expression Z-scores API endpoints

Open
#7 0 comments 0 reactions 1 assignee Assigned to @mariacuria View on GitHub
Dominant language
Python
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

[cBioPortal Swagger API page](https://www.cbioportal.org/api/swagger-ui/index.html)

## Step 0 - Download all available molecular profile IDs and extract mRNA expression molecular profile IDs
This script is located [here](https://github.com/GW-HIVE/bioxpress/blob/cbio/downloader/cbio/dl_molecular_profiles.sh).
```
#!/bin/bash

output_dir="/data/shared/repos/bioxpress/downloads/cbio"
url="https://www.cbioportal.org/api/molecular-profiles?projection=SUMMARY&pageSize=100000&pageNumber=0&direction=ASC"
curl -G "${url}" \
-H "accept: application/json" \
-o "${output_dir}/all_molecular_profiles.json"
```
Only molecular profile IDs with `MRNA_EXPRESSION` as `molecularAlterationType` are relevant. They can be found [here](https://github.com/GW-HIVE/bioxpress/blob/cbio/downloads/cbio/extracted/mrna_expression.json).

Example of relevant data:
```
{
"molecularAlterationType": "MRNA_EXPRESSION",
"datatype": "Z-SCORE",
"name": "mRNA expression z-scores relative to normal samples (log RNA Seq V2 RSEM)",
"description": "Expression z-scores of tumor samples compared to the expression distribution of all log-transformed mRNA expression of adjacent normal samples in the cohort.",
"showProfileInAnalysisTab": true,
"patientLevel": false,
"molecularProfileId": "brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores",
"studyId": "brca_tcga_pan_can_atlas_2018"
}
```
Moreover, not all molecular profiles are relevant; we are only interested in the Z-scores relative to matched normal samples, i.e. the `description` and `molecularProfileId` fields should contain terms like "normal", "diploid" etc.

## Step 1 - Fetch Sample List IDs
Go to Sample Lists -> `GET /api/studies/{studyId}/sample-lists` and find sample list IDs of interest.
In our example, `studyId` is `brca_tcga_pan_can_atlas_2018`.
This sample list seems relevant:
```
{
"category": "all_cases_with_mrna_rnaseq_data",
"name": "Samples with mRNA data (RNA Seq V2)",
"description": "Samples with mRNA expression data (1082 samples)",
"sampleListId": "brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna",
"studyId": "brca_tcga_pan_can_atlas_2018"
}
```

## Step 2 - Fetch molecular data
Go to Molecular Data -> `GET /api/molecular-profiles/{molecularProfileId}/molecular-data`
We need to provide `molecularProfileId`, `sampleListId` and `entrezGeneId`. For example, this is the response for
- `molecularProfileId` = `brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores`
- `sampleListId` = `brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna`
- `entrezGeneId` = 1
```
[
{
"uniqueSampleKey": "VENHQS0zQy1BQUFVLTAxOmJyY2FfdGNnYV9wYW5fY2FuX2F0bGFzXzIwMTg",
"uniquePatientKey": "VENHQS0zQy1BQUFVOmJyY2FfdGNnYV9wYW5fY2FuX2F0bGFzXzIwMTg",
"entrezGeneId": 1,
"molecularProfileId": "brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores",
"sampleId": "TCGA-3C-AAAU-01",
"patientId": "TCGA-3C-AAAU",
"studyId": "brca_tcga_pan_can_atlas_2018",
"value": 1.7607
},
{
"uniqueSampleKey": "VENHQS0zQy1BQUxJLTAxOmJyY2FfdGNnYV9wYW5fY2FuX2F0bGFzXzIwMTg",
"uniquePatientKey": "VENHQS0zQy1BQUxJOmJyY2FfdGNnYV9wYW5fY2FuX2F0bGFzXzIwMTg",
"entrezGeneId": 1,
"molecularProfileId": "brca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores",
"sampleId": "TCGA-3C-AALI-01",
"patientId": "TCGA-3C-AALI",
"studyId": "brca_tcga_pan_can_atlas_2018",
"value": 2.039
},
<...>
]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.