# cBioPortal Cancer Genomics Scraper (`ninhothedev/cbioportal-scraper`) Actor

$0.5/1K 🔥 cBioPortal Genomics! Extract cancer studies, mutations & clinical profiles by gene. No key. JSON, CSV, Excel or API in seconds. Fuel oncology and precision-medicine research ⚡

- **URL**: https://apify.com/ninhothedev/cbioportal-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## cBioPortal Cancer Genomics Scraper

Extract **cancer genomics data from [cBioPortal](https://www.cbioportal.org/)** — the
open-access platform hosting 300+ curated cancer study cohorts from TCGA, MSK-IMPACT,
Broad, ICGC and more. Pull the study catalog, gene lookups, the cancer-type taxonomy,
and per-study somatic mutations as clean, structured JSON. **No API key required.**

Runs on the free public cBioPortal REST API (`https://www.cbioportal.org/api`).

> Estimated cost: **~$0.50 per 1,000 records** on the Apify platform.

### Modes

| Mode | What you get |
|------|--------------|
| `studies` (default) | The full catalog of cancer study cohorts with sample counts, reference genome, PubMed id, citation and cancer type — filterable by cancer type and free-text search. |
| `genes` | HUGO / Entrez gene records. Look up a specific list (`geneSymbols`) or walk the gene catalog. |
| `cancertypes` | The cancer-type OncoTree taxonomy (id, name, short name, parent, color). |
| `mutations` | Per-study somatic mutations for an explicit gene list. Requires `studyId` + `geneSymbols`. |

### Input

| Field | Type | Description |
|-------|------|-------------|
| `mode` | select | `studies`, `genes`, `cancertypes`, or `mutations`. Default `studies`. |
| `cancerTypeFilter` | string | *Studies mode.* Substring match on cancer-type id/name, e.g. `brca`. |
| `searchQuery` | string | *Studies mode.* Substring match on study name/id, e.g. `tcga`. |
| `geneSymbols` | array | HUGO symbols, e.g. `["TP53","KRAS"]`. Used by `genes` and required by `mutations`. |
| `studyId` | string | *Mutations mode.* A study id such as `brca_tcga_pub`. |
| `maxItems` | integer | Max records (1–5000). Default 300. |

#### Example — breast-cancer studies

```json
{ "mode": "studies", "cancerTypeFilter": "brca", "maxItems": 100 }
```

#### Example — TP53 mutations in a TCGA breast cohort

```json
{ "mode": "mutations", "studyId": "brca_tcga_pub", "geneSymbols": ["TP53"] }
```

### Output samples

**Study**

```json
{
  "type": "study",
  "study_id": "brca_tcga_pub",
  "name": "Breast Invasive Carcinoma (TCGA, Nature 2012)",
  "cancer_type": "Breast Invasive Ductal Carcinoma",
  "cancer_type_id": "idc",
  "sample_count": 825,
  "sequenced_sample_count": 507,
  "reference_genome": "hg19",
  "pmid": "23000897",
  "url": "https://www.cbioportal.org/study/summary?id=brca_tcga_pub",
  "source": "cbioportal"
}
```

**Mutation**

```json
{
  "type": "mutation",
  "study_id": "brca_tcga_pub",
  "sample_id": "TCGA-A1-A0SK-01",
  "entrez_gene_id": 7157,
  "hugo_symbol": "TP53",
  "protein_change": "M133K",
  "mutation_type": "Missense_Mutation",
  "chromosome": "17",
  "start_position": 7578532
}
```

### Use cases

- **Cancer research** — assemble cohort metadata across hundreds of published studies.
- **Biomarker discovery** — pull somatic mutation frequencies for candidate genes.
- **Cohort selection** — filter studies by cancer type, sample count and reference genome.
- **Precision oncology** — map gene variants observed across tumor datasets.

### Data source, licensing & terms

Data comes from cBioPortal's public REST API. cBioPortal is an open-source project;
much of the study data derives from TCGA and other consortia. Individual studies
carry their own **data-use terms** — most curated public cBioPortal data is available
under the **Open Database License (ODbL)**, but you are responsible for checking the
license/attribution of each specific study before redistribution or publication.
This actor only reads publicly exposed API endpoints and does not bypass any access
control. Please cite cBioPortal (Cerami et al. 2012; Gao et al. 2013) and the original
study publications where required.

### Related actors

- [Clinical Trials Scraper](https://apify.com/ninhothedev/clinical-trials-scraper)
- [UniProt Scraper](https://apify.com/ninhothedev/uniprot-scraper)
- [Reactome Pathways Scraper](https://apify.com/ninhothedev/reactome-pathways-scraper)
- [STRING Interactions Scraper](https://apify.com/ninhothedev/string-interactions-scraper)

# Actor input Schema

## `mode` (type: `string`):

What to scrape. 'studies' = the catalog of 300+ cancer study cohorts (with filters). 'genes' = HUGO/Entrez gene lookup. 'cancertypes' = the cancer-type taxonomy. 'mutations' = per-study somatic mutations for an explicit gene list (needs studyId + geneSymbols).

## `cancerTypeFilter` (type: `string`):

Studies mode only. Case-insensitive substring matched against the study cancer-type id / name, e.g. 'brca' for breast cancer, 'luad' for lung adenocarcinoma.

## `searchQuery` (type: `string`):

Studies mode only. Case-insensitive substring matched against study name and study id, e.g. 'tcga' or 'msk'.

## `geneSymbols` (type: `array`):

HUGO gene symbols. Used by 'genes' mode (lookup each) and required by 'mutations' mode. Example: \["TP53", "KRAS"].

## `studyId` (type: `string`):

Required for 'mutations' mode. A cBioPortal study id such as 'brca\_tcga\_pub' or 'luad\_tcga\_pub' (find them via 'studies' mode).

## `maxItems` (type: `integer`):

Maximum number of records to return (1-5000).

## Actor input object example

```json
{
  "mode": "studies",
  "geneSymbols": [
    "TP53",
    "KRAS"
  ],
  "studyId": "brca_tcga_pub",
  "maxItems": 300
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "geneSymbols": [
        "TP53",
        "KRAS"
    ],
    "studyId": "brca_tcga_pub"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/cbioportal-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "geneSymbols": [
        "TP53",
        "KRAS",
    ],
    "studyId": "brca_tcga_pub",
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/cbioportal-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "geneSymbols": [
    "TP53",
    "KRAS"
  ],
  "studyId": "brca_tcga_pub"
}' |
apify call ninhothedev/cbioportal-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/cbioportal-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Dannw4gpVTSb4JdZz/builds/Jgj5B8sF0FfcTuBXK/openapi.json
