pirlygenes
Curated cancer gene knowledge and reference expression data.
pirlygenes is the curated data layer for cancer RNA analysis:
- Curated gene-set panels — therapy targets (ADC, CAR-T, TCR-T, bispecifics, radioligands, TCEs), cancer-testis antigens, surfaceome, cancer-key panels, lineage/family panels, rule tables, and narrative gene sets.
- ENSG-keyed gene families — mtDNA, NUMTs, rRNA + pseudogenes, ribosomal proteins, histones, hemoglobins, immune-receptor segments, small ncRNAs, and MALAT1/NEAT1.
- Reference expression matrices — pan-cancer TCGA × HPA panel, HPA cell-type expression, ESTIMATE signatures, and compatibility wrappers over
oncoreftumor cohorts. - Mechanical transforms & QC —
pan_cancer_expression(normalize=...),fpkm_to_tpm,renormalize_to_million,tpm_to_housekeeping_normalized,classify_gene_qc, andaggregate_gene_expression.
Low-level reference ingestion, source matrices, empirical summaries, and canonical clean-TPM 16/9/75 mechanics are owned by oncoref. Per-sample analysis (deconvolution, signature scoring, QC narration, reports) lives in pirl-trufflepig.
Install
Requires Python 3.11–3.14 (pandas 3 + current oncoref / pyensembl).
pip install pirlygenes
For per-sample analysis, install pirl-trufflepig (the bare trufflepig PyPI name is unrelated; the CLI command and Python import are trufflepig):
pip install pirl-trufflepig
trufflepig run --sample expr.tsv --workspace out --cancer-type PRAD
Documentation
Start with the documentation map:
- Available gene sets and expression references
- Gene canonicalization contract
- Cancer-classification ontology
- Reference-expression ownership and parity
- Normalization and mapping audit
- CTA curation and provenance
Quickstart
Most accessors are re-exported at the top level (from pirlygenes import pan_cancer_expression works for any of the ~140 names in pirlygenes.__all__); submodule paths are the canonical homes.
Gene-set panels, identifiers, and families
from pirlygenes.gene_sets_cancer import (
CTA_gene_names, # ~360 cancer-testis antigens (active OncoRef policy)
surface_protein_gene_names, # 2,799 surfaceome genes
cancer_surfaceome_gene_names, # 147 tumor-specific surface targets
therapy_target_gene_names, # "ADC", "CAR-T", "TCR-T", "bispecific-antibodies",
# "radioligand", "multispecific-TCE" (+ approved/trials)
cancer_type_registry, # cancer-type registry DataFrame
resolve_cancer_type, # "prostate" / "PRAD" / "SARC_DDLPS" → registry code
CANCER_TYPE_NAMES, # registry-backed {code: display_name} view
lineage_genes_by_cancer_type, # per-cancer lineage panels
cancer_family_panel, # broad-family panel, e.g. cancer_family_panel("LUAD")
therapy_benefit_toxicity_evidence,# curated clinical benefit/toxicity rows
housekeeping_gene_ids,
mitochondrial_gene_ids,
tme_marker_gene_ids,
TCGA_MEDIAN_PURITY, # per-cohort median tumor purity (Aran et al., 2015)
)
from pirlygenes.gene_ids import find_canonical_gene_ids_and_names
from pirlygenes.gene_names import display_name, short_gene_name, aliases
from pirlygenes.gene_families import (
gene_family_names,
gene_family_ids,
gene_family_for_ensembl_id,
rrna_and_pseudogene_ids,
ribosomal_protein_ids,
)
Reference expression matrices and transforms
from pirlygenes.expression import (
pan_cancer_expression, # 19,784 genes × TCGA/HPA reference columns
cancer_expression, # single cancer type, clean TPM by default
cancer_enriched_genes, # genes enriched in one cancer vs background
cancer_reference_expression, # oncoref-backed tumor cohort summaries
available_cancer_expression_references,
hpa_cell_type_expression, # HPA single-cell consensus (via oncoref)
estimate_signatures, # Yoshihara 2013 stromal/immune signatures
classify_gene_qc, # symbol/ENSG → GeneQcClass
aggregate_gene_expression, # transcript → gene rollup
)
# Default: normalize="tpm_clean" applies the canonical 16/9/75 clean-TPM transform
# (16% ribosomal protein, 9% technical, 75% biological) and adds *_TPM_clean / *_nTPM_clean.
df = pan_cancer_expression()
# Other normalization modes (combinable as a list; e.g. ["tpm_clean", "hk", "percentile"]):
pan_cancer_expression(normalize=None) # raw FPKM/nTPM + deterministic *_TPM
pan_cancer_expression(normalize="tpm_clean_log1p") # natural log1p clean TPM
pan_cancer_expression(normalize="hk") # housekeeping-normalized TPM
pan_cancer_expression(include_computed_rollups=True) # opt-in BTC/CRC/NET/NSCLC/SGC rollups
For multi-source cohorts, cancer_reference_expression(format="wide") requires selecting a single source_cohort=, passing pool=True for comparable sources, or keeping the default long format.
Dataset discovery and caching
from pirlygenes import clear_dataset_cache, data_roots, dataset_paths, get_data
paths = dataset_paths() # read-only CSV/shard map (no downloads)
bundled = dataset_paths(bundled_only=True) # local wheel/checkout files only
roots = data_roots() # bundled dir, then active downloaded bundle
clear_dataset_cache() # after editing local files in place
Small curated CSVs ship inside the wheel under pirlygenes/data/. Larger derived matrices (cohort-expression-matrices/, pan-cancer-expression.csv, hpa-cell-type-expression.csv) download lazily from the matching GitHub Release into ~/.cache/pirlygenes/bundled_data/ (override with PIRLYGENES_BUNDLED_DATA). Empirical summaries, source matrices, and registries delegate to oncoref. See docs/gene-sets.md for the complete dataset and accessor catalog.
CLI
pirlygenes provides cohort-level data inspection and plotting commands:
pirlygenes data status
pirlygenes data list
pirlygenes data sources SARC_DDLPS
pirlygenes downloads list
pirlygenes plot patient-coverage --gene-set cta --source all
pirlygenes plot patient-coverage --gene-set cta --threshold-mode percentile --threshold 95
pirlygenes plot cta-curation --out cta_curation_out
patient-coverage defaults to threshold_mode="auto" (clean-TPM threshold 25 for linear-TPM-comparable RNA-seq cohorts, p95 within-sample percentile for microarray/non-comparable cohorts).
Package boundary
oncoref— empirical expression ingestion, source/sample registries, per-sample matrices, empirical summaries, representatives, percentiles, proteoform artifacts, and active CTA target-selection policy.pirlygenes— curated clinical/target gene sets, ENSG gene families, compatibility wrappers, derived pan-cancer/cohort views, and mechanical expression transforms.pirl-trufflepig— per-sample analysis, QC narration, deconvolution, signature scoring, and clinical reports.
For 4.x/5.x migration history (CLI move to trufflepig, cohort_expression_matrices() rename), see docs/README.md and pirl-unc/trufflepig#1.
License
Apache 2.0 — see LICENSE.
Metadata
Release files for pirlygenes 6.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pirlygenes-6.4.2.tar.gz | 2.4 MB | Without provenance | Details for pirlygenes-6.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pirlygenes-6.4.2-py3-none-any.whl | Python 3 | none | any | Details for pirlygenes-6.4.2-py3-none-any.whl |
Total release size: 4.6 MB
Release files / pirlygenes-6.4.2.tar.gz
| Download URL | pirlygenes-6.4.2.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c5d6928e37feef6e7d7fd654775ce3ec6c1f19137dc3bd51b5b0fd55580fa11
|
|
BLAKE2b-256 checksum How to use checksums |
508dfbf9f479712f382d4c933fa1acaae0b61dec704d413694b46f9729354dfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / pirlygenes-6.4.2-py3-none-any.whl
| Download URL | pirlygenes-6.4.2-py3-none-any.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c87ace0b38da3ae739c9b76fd1482ce64924cbaeb70dd9d5c26017a7c5f4d796
|
|
BLAKE2b-256 checksum How to use checksums |
683f3855705fcedb66426b37157ac03daf567eb96fcc729bbed31e0b42e54f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Security for pirlygenes 6.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.