| .. | ||
| advanced_filtering.py | ||
| basic_query_download.py | ||
| batch_query.py | ||
| interactive_example.py | ||
| README.md | ||
| using_config.py | ||
| validate_downloads.py | ||
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
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
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
python examples/advanced_filtering.py
4. Using Configuration Files
File: using_config.py
Demonstrates:
- Creating a default configuration file
- Using configuration for other commands
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
python examples/validate_downloads.py
Running Examples
Make sure you have TCGA Downloader installed:
pip install -e .
Then run any example:
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:
tcga-downloader interactive --out manifest.tsv --out-dir ./data
The interactive mode provides a user-friendly menu-driven workflow:
- Dynamic Project List: Fetches available TCGA projects from GDC API
- Project Selection: Interactive menu to select a project
- Dynamic Data Types: Fetches available data types for selected project
- Data Type Selection: Interactive menu to select data type
- Manifest Generation: Creates manifest based on selections
- Download: Downloads files using gdc-client
Usage:
tcga-downloader interactive --out manifest.tsv --out-dir ./data
This mode requires questionary library, which is included in the main package dependencies.