Skip to main content

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 oncoref tumor cohorts.
  • Mechanical transforms & QC — pan_cancer_expression(normalize=...), fpkm_to_tpm, renormalize_to_million, tpm_to_housekeeping_normalized, classify_gene_qc, and aggregate_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:

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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pirlygenes 6.4.3
File Size Uploaded Provenance Actions
pirlygenes-6.4.3.tar.gz 2.4 MB Without provenance Details for pirlygenes-6.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pirlygenes 6.4.3
File Interpreter ABI Platform Actions
pirlygenes-6.4.3-py3-none-any.whl Python 3 none any Details for pirlygenes-6.4.3-py3-none-any.whl

Total release size: 4.6 MB

Release files / pirlygenes-6.4.3.tar.gz

Download URL pirlygenes-6.4.3.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
9bf8aa626b8787132784d9402ddbb655b7a7e13097b8a5126a62f5911fcdd2bd
BLAKE2b-256 checksum
How to use checksums
1569eb753d7ff77061288e6199059a5fad95d5918855f24ea7caf22302929a3f
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.3-py3-none-any.whl

Download URL pirlygenes-6.4.3-py3-none-any.whl
Size 2.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8fb2193ad6a31efa4b110c6f58ae64b106f19f4c404cbe50aa5f717587f808b7
BLAKE2b-256 checksum
How to use checksums
00d313a7189be803d798401c375e54dc8a5f4d4e011254fda7aea206225ed232
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.3

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.

Release history Release notifications | RSS feed

This release

6.4.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page