alterlab-cosmic — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited alterlab-cosmic (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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.
This skill should be used when:
| Scenario | Use Instead |
|---|---|
| Germline variant pathogenicity (ACMG/AMP, ClinVar stars) | alterlab-clinvar |
| Mutation frequency / OncoPrint / survival in TCGA or MSK cohorts via a keyless API | alterlab-cbioportal |
| CRISPR/RNAi gene dependency in cancer cell lines | alterlab-depmap |
| Population allele frequencies in non-cancer cohorts | alterlab-gnomad |
COSMIC requires authentication for data downloads:
uv pip install requests pandas
# pysam is only needed if you read the VCF-format downloads
uv pip install pysamCOSMIC's current download service delivers each product as a .tar archive (the gzipped TSV or VCF plus a README describing every column) at an explicit release path, e.g. grch38/cosmic/v104/Cosmic_GenomeScreensMutant_Tsv_v104_GRCh38.tar. Scripted downloads are a two-step call: GET https://cancer.sanger.ac.uk/api/mono/products/v1/downloads/scripted?path=<archive path>&bucket=downloads with HTTP Basic auth (email:password) returns JSON with a signed url, which you then fetch without auth. The legacy /cosmic/file_download/... endpoint and legacy names such as CosmicMutantExport.tsv.gz or cancer_gene_census.csv no longer work for scripts — the old endpoint now redirects to the login page.
Use the scripts/download_cosmic.py script to download COSMIC data files:
from scripts.download_cosmic import download_cosmic_file, get_common_file_path
# Cancer Gene Census, current release (v104), GRCh38
download_cosmic_file(
email="[email protected]",
password="your_password",
filepath=get_common_file_path("gene_census"),
# = "grch38/cosmic/v104/Cosmic_CancerGeneCensus_Tsv_v104_GRCh38.tar"
)# Download using shorthand data type (prompts for the password)
python scripts/download_cosmic.py [email protected] --data-type mutations
# Download a specific archive path
python scripts/download_cosmic.py [email protected] \
--filepath grch38/cosmic/v104/Cosmic_CancerGeneCensus_Tsv_v104_GRCh38.tar
# GRCh37 and/or a pinned release
python scripts/download_cosmic.py [email protected] \
--data-type gene_census --assembly GRCh37 --version v103If the scripted endpoint changes, copy the command shown under Scripted download for any file on https://cancer.sanger.ac.uk/cosmic/download/cosmic and set COSMIC_SCRIPTED_URL.
tar -xf Cosmic_CancerGeneCensus_Tsv_v104_GRCh38.tar # -> gzipped TSV + READMEimport glob
import pandas as pd
# Column names differ from the legacy exports — check the README in each archive.
gene_census = pd.read_csv(glob.glob("Cosmic_CancerGeneCensus*GRCh38*.tsv.gz")[0], sep="\t")
print(gene_census.columns.tolist())
# VCF products (e.g. VCF/Cosmic_GenomeScreensMutant_Vcf_...) extract to .vcf.gz files
import pysam
vcf = pysam.VariantFile(glob.glob("Cosmic_GenomeScreensMutant*_GRCh38.vcf.gz")[0])Every data type downloads through the same download_cosmic_file(...) call shown in Quick Start — only the filepath changes. Use the --data-type shortcut (CLI) or get_common_file_path(...) (Python) to build the path, or pass the filepath directly. See references/cosmic_data_reference.md for full field descriptions.
| Data type | Shortcut | Archive (grch38/cosmic/v104/…, verified 2026-09) |
|---|---|---|
| Coding mutations, genome-wide screens (WGS/WES) | mutations | Cosmic_GenomeScreensMutant_Tsv_v104_GRCh38.tar |
| Coding mutations, targeted screens | targeted_mutations | Cosmic_CompleteTargetedScreensMutant_Tsv_v104_GRCh38.tar |
| Coding mutations (VCF) | mutations_vcf | VCF/Cosmic_GenomeScreensMutant_Vcf_v104_GRCh38.tar |
| Non-coding variants (VCF) | non_coding_vcf | VCF/Cosmic_NonCodingVariants_Vcf_v104_GRCh38.tar |
| Mutations in CGC genes | mutation_census | Cosmic_MutantCensus_Tsv_v104_GRCh38.tar |
| Cancer Gene Census | gene_census | Cosmic_CancerGeneCensus_Tsv_v104_GRCh38.tar |
| Resistance mutations | resistance_mutations | Cosmic_ResistanceMutations_Tsv_v104_GRCh38.tar |
| Structural variants / breakpoints | structural_variants / breakpoints | Cosmic_StructuralVariants_Tsv_… / Cosmic_Breakpoints_Tsv_… |
| Gene fusions | fusion_genes | Cosmic_Fusion_Tsv_v104_GRCh38.tar |
| Copy number | copy_number | Cosmic_CompleteCNA_Tsv_v104_GRCh38.tar |
| Gene expression | gene_expression | Cosmic_CompleteGeneExpression_Tsv_v104_GRCh38.tar |
| Samples / tumour classification | sample_info / classification | Cosmic_Sample_Tsv_… / Cosmic_Classification_Tsv_… |
| Mutational signatures | signatures | separate site — https://cancer.sanger.ac.uk/signatures/downloads/ |
Notes:
field splits oncogenes from tumor suppressors (TSG), and Tier 1/2 grades the evidence.
targeted-screen files; combine both for full coverage.
are downloaded from the signatures site, not through the product archives.
COSMIC provides data for two reference genomes:
Specify the assembly in file paths (lower-case directory, upper-case suffix):
# GRCh38 (recommended)
filepath = "grch38/cosmic/v104/Cosmic_GenomeScreensMutant_Tsv_v104_GRCh38.tar"
# GRCh37 (legacy)
filepath = "grch37/cosmic/v104/Cosmic_GenomeScreensMutant_Tsv_v104_GRCh37.tar"v104 = May 2026); the download servicelists only versioned paths, so pin one — get_common_file_path() defaults to the current release
v103 2025-11, v104 2026-05); check the release notes before assuming
Current files use upper-case column names (e.g. GENE_SYMBOL, SAMPLE_NAME), while tumour site/histology live in the sample/classification tables linked by COSMIC IDs. Confirm exact names in each archive's README before filtering. For a one-off slice (one gene, primary site, or sample) the web Filtered download option avoids pulling the multi-GB files at all.
Filter mutations by gene:
import glob
import pandas as pd
# Extracted from Cosmic_GenomeScreensMutant_Tsv_v104_GRCh38.tar (multi-GB)
tsv = glob.glob('Cosmic_GenomeScreensMutant*GRCh38*.tsv.gz')[0]
mutations = pd.read_csv(tsv, sep='\t', low_memory=False)
tp53_mutations = mutations[mutations['GENE_SYMBOL'] == 'TP53']Identify cancer genes by role (normalize headers, then look up the role column):
cgc = pd.read_csv(glob.glob('Cosmic_CancerGeneCensus*GRCh38*.tsv.gz')[0], sep='\t')
cgc.columns = cgc.columns.str.upper().str.replace(' ', '_')
role = cgc['ROLE_IN_CANCER'].fillna('')
oncogenes = cgc[role.str.contains('oncogene')]
tumor_suppressors = cgc[role.str.contains('TSG')]Work with VCF files (GRCh38 coordinates, bgzip + tabix index required for fetch):
import pysam
vcf = pysam.VariantFile(glob.glob('Cosmic_GenomeScreensMutant*GRCh38*.vcf.gz')[0])
for record in vcf.fetch('17', 7668400, 7687500): # TP53 locus, GRCh38
print(record.id, record.ref, record.alts, record.info)For comprehensive information about COSMIC data structure, available files, and field descriptions, see references/cosmic_data_reference.md. This reference includes:
Use this reference when:
The download script includes helper functions for common operations:
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/v104/Cosmic_GenomeScreensMutant_Tsv_v104_GRCh38.tar'
# Get path for gene census, pinned to an older release
path = get_common_file_path('gene_census', version='v103')
# Returns: 'grch38/cosmic/v103/Cosmic_CancerGeneCensus_Tsv_v103_GRCh38.tar'The accepted data_type shortcuts are the ones in the Available Data Types table above (signatures returns None — use the signatures download site).
CosmicMutantExport.tsv.gz, cancer_gene_census.csv) andGRCh38/cosmic/latest/... paths from older tutorials are not in the current service
reporting require a COSMIC commercial licence: https://www.cosmickb.org/licensing
COSMIC data integrates well with:
When using COSMIC data, cite the current database paper: Sondka Z, Dhir NB, Carvalho-Silva D, et al. COSMIC: a curated database of somatic variants and clinical data for cancer. Nucleic Acids Research. 2024;52(D1):D1210-D1217. doi:10.1093/nar/gkad986
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.