136 lines
2.8 KiB
Markdown
136 lines
2.8 KiB
Markdown
# Examples
|
|
|
|
This directory contains example scripts demonstrating various use cases of TCGA Downloader.
|
|
|
|
## Examples
|
|
|
|
### 1. Basic Query and Download
|
|
|
|
**File:** `basic_query_download.py`
|
|
|
|
Demonstrates:
|
|
- Querying a single TCGA project
|
|
- Creating a manifest file
|
|
- Downloading files using the manifest
|
|
|
|
```bash
|
|
python examples/basic_query_download.py
|
|
```
|
|
|
|
### 2. Batch Query Multiple Projects
|
|
|
|
**File:** `batch_query.py`
|
|
|
|
Demonstrates:
|
|
- Querying multiple TCGA projects in one command
|
|
- Combining results from multiple queries
|
|
- Statistics for combined results
|
|
|
|
```bash
|
|
python examples/batch_query.py
|
|
```
|
|
|
|
### 3. Advanced Filtering
|
|
|
|
**File:** `advanced_filtering.py`
|
|
|
|
Demonstrates:
|
|
- Querying with sample type filter
|
|
- Querying with platform filter
|
|
- Multiple filter criteria at once
|
|
|
|
```bash
|
|
python examples/advanced_filtering.py
|
|
```
|
|
|
|
### 4. Using Configuration Files
|
|
|
|
**File:** `using_config.py`
|
|
|
|
Demonstrates:
|
|
- Creating a default configuration file
|
|
- Using configuration for other commands
|
|
|
|
```bash
|
|
python examples/using_config.py
|
|
tcga-downloader query --file config.json
|
|
```
|
|
|
|
### 5. Validate Downloads
|
|
|
|
**File:** `validate_downloads.py`
|
|
|
|
Demonstrates:
|
|
- Loading a manifest file
|
|
- Validating manifest structure
|
|
- Checking downloaded files against manifest
|
|
- Verifying MD5 checksums
|
|
|
|
```bash
|
|
python examples/validate_downloads.py
|
|
```
|
|
|
|
## Running Examples
|
|
|
|
Make sure you have TCGA Downloader installed:
|
|
|
|
```bash
|
|
pip install -e .
|
|
```
|
|
|
|
Then run any example:
|
|
|
|
```bash
|
|
cd examples
|
|
python <example_name>.py
|
|
```
|
|
|
|
## Common TCGA Projects
|
|
|
|
- TCGA-BRCA: Breast invasive carcinoma
|
|
- TCGA-LUAD: Lung adenocarcinoma
|
|
- TCGA-COAD: Colon adenocarcinoma
|
|
- TCGA-PRAD: Prostate adenocarcinoma
|
|
- TCGA-SKCM: Skin cutaneous melanoma
|
|
- TCGA-KIRC: Kidney renal clear cell carcinoma
|
|
- TCGA-GBM: Glioblastoma multiforme
|
|
|
|
## Common Data Types
|
|
|
|
- Gene Expression
|
|
- Copy Number Variation
|
|
- DNA Methylation
|
|
- miRNA Expression
|
|
- Protein Expression
|
|
- Somatic Mutation
|
|
|
|
## Interactive Mode
|
|
|
|
**File:** `interactive_example.py`
|
|
|
|
Demonstrates:
|
|
- Dynamic project selection from API
|
|
- Dynamic data type selection based on selected project
|
|
- Interactive menu-driven workflow
|
|
|
|
Usage:
|
|
```bash
|
|
tcga-downloader interactive --out manifest.tsv --out-dir ./data
|
|
```
|
|
|
|
The interactive mode provides a user-friendly menu-driven workflow:
|
|
|
|
1. **Dynamic Project List**: Fetches available TCGA projects from GDC API
|
|
2. **Project Selection**: Interactive menu to select a project
|
|
3. **Dynamic Data Types**: Fetches available data types for selected project
|
|
4. **Data Type Selection**: Interactive menu to select data type
|
|
5. **Manifest Generation**: Creates manifest based on selections
|
|
6. **Download**: Downloads files using gdc-client
|
|
|
|
Usage:
|
|
```bash
|
|
tcga-downloader interactive --out manifest.tsv --out-dir ./data
|
|
```
|
|
|
|
This mode requires `questionary` library, which is included in the main package dependencies.
|