Access COSMIC cancer mutation database. Query somatic mutations, Cancer Gene Census, mutational signatures, gene fusions, for cancer research and precision oncology. Requires authentication.
Access COSMIC cancer mutation database. Query somatic mutations, Cancer Gene Census, mutational signatures, gene fusions, for cancer research and precision oncology. Requires authentication.
COSMIC Database
Overview
COSMIC (Catalogue of Somatic Mutations in Cancer) is the world's largest and most comprehensive database for exploring somatic mutations in human cancer. Access COSMIC's extensive collection of cancer genomics data, including millions of mutations across thousands of cancer types, curated gene lists, mutational signatures, and clinical annotations programmatically.
When to Use This Skill
This skill should be used when:
Downloading cancer mutation data from COSMIC
Accessing the Cancer Gene Census for curated cancer gene lists
Retrieving mutational signature profiles
Querying structural variants, copy number alterations, or gene fusions
Analyzing drug resistance mutations
Working with cancer cell line genomics data
Integrating cancer mutation data into bioinformatics pipelines
Researching specific genes or mutations in cancer contexts
Prerequisites
Account Registration
COSMIC requires authentication for data downloads:
sample_info - Sample metadata and tumor information
# Download all coding mutations
download_cosmic_file(
email="user@email.com",
password="password",
filepath="GRCh38/cosmic/latest/CosmicMutantExport.tsv.gz"
)
Cancer Gene Census
Access the expert-curated list of ~700+ cancer genes with substantial evidence of cancer involvement.
# Download Cancer Gene Census
download_cosmic_file(
email="user@email.com",
password="password",
filepath="GRCh38/cosmic/latest/cancer_gene_census.csv"
)
Use cases:
Identifying known cancer genes
Filtering variants by cancer relevance
Understanding gene roles (oncogene vs tumor suppressor)
Target gene selection for research
Mutational Signatures
Download signature profiles for mutational signature analysis.
Retrieve copy number alterations and gene expression data.
Available data types:
copy_number - Copy number gains/losses
gene_expression - Over/under-expression data
# Download copy number data
download_cosmic_file(
email="user@email.com",
password="password",
filepath="GRCh38/cosmic/latest/CosmicCompleteCNA.tsv.gz"
)
Resistance Mutations
Access drug resistance mutation data with clinical annotations.
import pysam
vcf = pysam.VariantFile('CosmicCodingMuts.vcf.gz')
for record in vcf.fetch('17', 7577000, 7579000): # TP53 regionprint(record.id, record.ref, record.alts, record.info)
Data Reference
For comprehensive information about COSMIC data structure, available files, and field descriptions, see references/cosmic_data_reference.md. This reference includes:
Complete list of available data types and files
Detailed field descriptions for each file type
File format specifications
Common file paths and naming conventions
Data update schedule and versioning
Citation information
Use this reference when:
Exploring what data is available in COSMIC
Understanding specific field meanings
Determining the correct file path for a data type
Planning analysis workflows with COSMIC data
Helper Functions
The download script includes helper functions for common operations:
Get Common File Paths
from scripts.download_cosmic import get_common_file_path
# Get path for mutations file
path = get_common_file_path('mutations', genome_assembly='GRCh38')
# Returns: 'GRCh38/cosmic/latest/CosmicMutantExport.tsv.gz'# Get path for gene census
path = get_common_file_path('gene_census')
# Returns: 'GRCh38/cosmic/latest/cancer_gene_census.csv'
Available shortcuts:
mutations - Core coding mutations
mutations_vcf - VCF format mutations
gene_census - Cancer Gene Census
resistance_mutations - Drug resistance data
structural_variants - Structural variants
gene_expression - Expression data
copy_number - Copy number alterations
fusion_genes - Gene fusions
signatures - Mutational signatures
sample_info - Sample metadata
Troubleshooting
Authentication Errors
Verify email and password are correct
Ensure account is registered at cancer.sanger.ac.uk/cosmic
Check if commercial license is required for your use case
File Not Found
Verify the filepath is correct
Check that the requested version exists
Use latest for the most recent version
Confirm genome assembly (GRCh37 vs GRCh38) is correct
Large File Downloads
COSMIC files can be several GB in size
Ensure sufficient disk space
Download may take several minutes depending on connection
The script shows download progress for large files
Commercial Use
Commercial users must license COSMIC through QIAGEN
When using COSMIC data, cite:
Tate JG, Bamford S, Jubb HC, et al. COSMIC: the Catalogue Of Somatic Mutations In Cancer. Nucleic Acids Research. 2019;47(D1):D941-D947.