aging-expressions / README.md
antonkulaga's picture
Upload 632 parquet files
c595b34 verified
metadata
dataset_info:
  features:
    - name: sample_id
      dtype: string
    - name: tissue
      dtype: string
    - name: subject_id
      dtype: string
    - name: sex
      dtype: int64
    - name: age
      dtype: string
    - name: death_time
      dtype: string
    - name: estimated_age
      dtype: float64
  license: cc-by-4.0
  language:
    - en
  size_categories:
    - 1K<n<10K
  task_categories:
    - tabular-regression
    - tabular-classification
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/gtex_bulkformer_estimated_age_tpm.parquet

aging-expressions: Age-Stratified Gene Expression Dataset

Dataset Description

This dataset provides age-stratified gene expression data derived from ARCHS4 and GTEx databases, specifically curated for fine-tuning BulkFormer and other bulk RNA-seq deep learning models. The dataset contains TPM-normalized expression values for protein-coding genes, enriched with comprehensive demographic metadata including precise age information.

Key Features:

  • 🎯 Optimized for BulkFormer: Uses the same ~20,000 protein-coding gene subset as BulkFormer training data
  • πŸ“Š TPM Normalization: Expression values normalized using BulkFormer gene lengths for consistency
  • πŸ‘₯ Age-Filtered: Only samples with numeric age in years (excludes gestational age, non-numeric values)
  • 🧬 Ensembl IDs: Genes identified by stable Ensembl IDs for cross-dataset compatibility
  • πŸ”¬ Rich Metadata: Age, sex, tissue, disease, and treatment information extracted from sample characteristics

This dataset enables:

  • Fine-tuning BulkFormer for age prediction tasks
  • Training age-related gene expression models
  • Comparative analysis across tissues and demographics
  • Transfer learning for bulk RNA-seq applications

Dataset Summary

Sources:

  • GTEx Analysis v10 (Release v10, RNASeQCv2.4.2): 9,662 samples across 54 tissue types
  • ARCHS4 v2.2+: 111,000+ age-filtered samples across 62+ tissue types (human)

Gene Selection:

  • Total Genes: ~20,000 protein-coding genes (BulkFormer subset)
  • Gene IDs: Ensembl gene identifiers for consistency
  • Normalization: TPM using BulkFormer gene length information
  • Source: bulkformer_gene_info.csv containing curated protein-coding genes

Sample Characteristics:

  • Age Information: Numeric age in years (filtered from ARCHS4 characteristics)
  • GTEx Age Range: 20-79 years (6 age brackets: 20-29, 30-39, 40-49, 50-59, 60-69, 70-79)
  • ARCHS4 Age Range: 1-122 years (actual numeric ages from sample metadata)
  • Tissues: Blood, brain, liver, lung, skin, muscle, and 50+ other tissue types
  • Format: Parquet files (optimized for fast loading with Polars/Pandas)

Key Features

  1. Optimized for BulkFormer Fine-Tuning:

    • Same ~20,000 protein-coding gene subset used in BulkFormer pre-training
    • TPM normalization using identical gene lengths as BulkFormer
    • Ensembl IDs matching BulkFormer's expected input format
    • Ready for fine-tuning age prediction, tissue classification, or disease detection models
    • Compatible with other bulk RNA-seq deep learning architectures
  2. Rich Demographic Metadata:

    • GTEx samples: Sample/Subject IDs, tissue type, sex (1=male, 2=female), age brackets, estimated age, death circumstances
    • ARCHS4 samples: Sample IDs, numeric age in years, sex (male/female), tissue type, disease status, treatment information
    • All metadata automatically extracted and validated from sample characteristics
    • Age filtering ensures only samples with reliable numeric age values
  3. TPM-Normalized Expression:

    • Raw counts converted to TPM (Transcripts Per Million) for comparability
    • Normalization formula: TPM = (counts / gene_length) * 1e6 / sum(counts / gene_length)
    • Uses BulkFormer's curated gene lengths for consistency
    • Ready for log1p transformation: log(TPM + 1) for deep learning
  4. Protein-Coding Gene Focus:

    • Filtered to ~20,000 high-confidence protein-coding genes
    • Excludes pseudogenes, lncRNAs, and other non-coding RNAs
    • Gene set matches BulkFormer's training data for transfer learning
    • Ensembl IDs provide stable identifiers across datasets
  5. Quality Assurance:

    • GTEx: Analysis v10 with rigorous QC from GTEx consortium
    • ARCHS4: Uniformly processed using STAR alignment and Kallisto quantification
    • Age validation: Excludes gestational age, age in weeks/months/days
    • Memory-optimized processing with 50% reduction in RAM usage

Dataset Structure

Data Files

File Name Rows Columns Size Description
gtex_bulkformer_estimated_age_tpm.parquet 9,662 18,255 ~350 MB GTEx samples with TPM-normalized gene expression

Data Fields

Metadata Columns (7 columns)

Column Type Description Example Values
sample_id string GTEx sample identifier "GTEX-QMFR-1926-SM-32PL9"
tissue string Tissue type "Blood", "Brain", "Muscle"
subject_id string GTEx subject/donor identifier "GTEX-QMFR"
sex int64 Biological sex (1=male, 2=female) 1, 2
age string Age bracket from GTEx "20-29", "50-59", "70-79"
death_time string Hardy scale death circumstances "Ventilator Case", "Fast death"
estimated_age float64 Midpoint of age bracket 24.5, 54.5, 74.5

Gene Expression Columns (18,248 columns)

  • Column Names: Gene symbols (e.g., TP53, BRCA1, APOE)
  • Data Type: float64
  • Values: TPM-normalized gene expression (0 to ~1,000,000)
  • Transformation: Ready for log1p transformation: log(TPM + 1)

Data Splits

This dataset does not have predefined train/test splits. Users should create their own splits based on their research needs:

  • Age-stratified splits: Ensure balanced age distribution across splits
  • Tissue-stratified splits: For tissue-specific analyses
  • Subject-level splits: Avoid data leakage by splitting at subject level (not sample level)

Example Record

{
  "sample_id": "GTEX-QCQG-0006-SM-5SI8M",
  "tissue": "Blood",
  "subject_id": "GTEX-QCQG",
  "sex": 2,
  "age": "50-59",
  "death_time": "Ventilator Case",
  "estimated_age": 54.5,
  "TP53": 125.34,
  "BRCA1": 12.56,
  "APOE": 234.78,
  # ... 18,245 more genes
}

Data Processing Pipeline

This dataset is created from ARCHS4 and GTEx raw data using the aging-expressions package. The processing pipeline extracts age information, normalizes expression to TPM using BulkFormer gene lengths, and filters to protein-coding genes for optimal compatibility with deep learning models.

Source Data

ARCHS4 Data (for tissue-specific parquet files):

  1. ARCHS4 Human Gene Expression: human_gene_v2.latest.h5 (~50GB)

  2. ARCHS4 Sample Metadata: Embedded in HDF5 file

    • Sample characteristics from GEO
    • Contains age, sex, tissue, disease, and treatment information
    • Extracted using metadata enrichment algorithms

GTEx Data (for consolidated parquet file):

  1. GTEx Expression Data: GTEx_Analysis_v10_RNASeQCv2.4.2_gene_tpm.gct.gz

    • Raw TPM values from GTEx portal
    • 25,150 genes Γ— 9,662 samples
  2. GTEx Phenotype Data: GTEx_Analysis_v10_Annotations_SubjectPhenotypesDS.txt

    • Subject-level demographic information
    • Age brackets, sex, death circumstances
  3. GTEx Sample Attributes: GTEx_Analysis_v10_Annotations_SampleAttributesDS.txt

    • Sample-level tissue annotations

BulkFormer Gene Information:

  • BulkFormer Gene Info: bulkformer_gene_info.csv
    • ~20,000 protein-coding genes with Ensembl IDs
    • Gene lengths for TPM normalization
    • Source: BulkFormer model repository

Processing Steps

The complete pipeline: Download β†’ Prepare β†’ Upload

# 1. Download raw data
uv run download archs4 human
uv run download gtex all
uv run download bulkformer data

# 2. Prepare TPM-normalized parquet files
uv run prepare archs4  # Creates tissue-specific files
uv run prepare gtex    # Creates consolidated file

# 3. Upload to HuggingFace (optional)
uv run upload

Detailed Processing Steps:

  1. Age Filtering (ARCHS4):

    • Extract age from sample characteristics (characteristics_ch1 field)
    • Filter to samples with numeric age in years (exclude gestational age, age in months/weeks)
    • Validate age range (1-122 years, oldest verified human)
    • Result: 111,000+ samples with reliable age information
  2. Metadata Extraction:

    • ARCHS4: Extract age, sex, tissue, disease, treatment from GEO characteristics
    • GTEx: Join phenotype and sample attributes, compute estimated age from brackets
    • Normalize tissue names (e.g., "whole blood" β†’ "blood", "pbmc" variations β†’ "pbmc")
    • Encode categorical variables consistently
  3. Gene Filtering:

    • Filter to genes present in BulkFormer gene list (~20,000 protein-coding genes)
    • Map gene symbols to Ensembl IDs using BulkFormer gene info
    • Remove genes without valid Ensembl IDs or gene length information
    • ARCHS4: 67,000 β†’ ~20,000 genes retained
    • GTEx: 25,150 β†’ ~18,000 genes retained
  4. TPM Normalization:

    • ARCHS4: Convert raw counts to TPM using formula: TPM = (counts / gene_length_kb) * 1e6 / sum(counts / gene_length_kb)
    • GTEx: Data already in TPM format, validate consistency
    • Use BulkFormer gene lengths for normalization (identical to BulkFormer training)
    • Memory-optimized implementation (50% RAM reduction via inline calculations)
  5. Ensembl ID Mapping:

    • Replace gene symbols with Ensembl IDs as column names
    • Ensures compatibility across datasets and model versions
    • Genes without Ensembl mappings are dropped with warnings
  6. Quality Control:

    • Validate sample IDs match between expression and metadata
    • Check for missing values in critical columns
    • Ensure data type consistency (float64 for expression, proper types for metadata)
    • Tissue-level validation (minimum sample counts, unique tissue names)
  7. Output Generation:

    • Save to Parquet format using streaming mode (memory efficient)
    • ARCHS4: One file per tissue (e.g., blood_bulkformer_age_tpm.parquet)
    • GTEx: Single consolidated file (gtex_bulkformer_estimated_age_tpm.parquet)
    • Lazy evaluation ensures minimal memory footprint during writes

Age Bracket Mapping

GTEx Age Range Estimated Age Count (approx)
20-29 24.5 ~500
30-39 34.5 ~1,000
40-49 44.5 ~1,800
50-59 54.5 ~2,800
60-69 64.5 ~2,500
70-79 74.5 ~1,000

Usage

Loading the Dataset

Using Polars (Recommended)

import polars as pl

# Load the full dataset
df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

print(f"Shape: {df.shape}")
print(f"Columns: {df.columns[:10]}")

Using Pandas

import pandas as pd

# Load the full dataset
df = pd.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

print(f"Shape: {df.shape}")
print(df.head())

Using HuggingFace Datasets

from datasets import load_dataset

dataset = load_dataset("longevity-genie/aging-expressions", split="train")
df = dataset.to_pandas()

Example Analyses

1. Age-Stratified Gene Expression

import polars as pl

df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

# Analyze TP53 expression across age groups
age_analysis = df.group_by("age").agg([
    pl.count().alias("n_samples"),
    pl.col("TP53").mean().alias("tp53_mean"),
    pl.col("TP53").std().alias("tp53_std"),
    pl.col("BRCA1").mean().alias("brca1_mean"),
])

print(age_analysis.sort("age"))

2. Tissue-Specific Expression

import polars as pl

df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

# Get blood samples only
blood_samples = df.filter(pl.col("tissue") == "Blood")

# Analyze aging genes in blood
aging_genes = ["CDKN2A", "TP53", "TERT", "SIRT1", "FOXO3"]
blood_aging = blood_samples.select(["estimated_age", "sex"] + aging_genes)

print(blood_aging.describe())

3. Sex-Stratified Analysis

import polars as pl

df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

# Compare gene expression between sexes
sex_comparison = df.group_by("sex").agg([
    pl.count().alias("n_samples"),
    pl.col("XIST").mean().alias("xist_mean"),  # X-inactivation gene
    pl.col("DDX3Y").mean().alias("ddx3y_mean"),  # Y chromosome gene
])

print(sex_comparison)

4. Prepare for Machine Learning

import polars as pl
import numpy as np

df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

# Separate metadata from expression
metadata_cols = ["sample_id", "tissue", "subject_id", "sex", "age", "death_time", "estimated_age"]
gene_cols = [c for c in df.columns if c not in metadata_cols]

# Log-transform expression data
df_log = df.with_columns([
    (pl.col(gene).log1p().alias(gene)) for gene in gene_cols
])

# Create train/test split (stratified by age)
from sklearn.model_selection import train_test_split

train_df, test_df = train_test_split(
    df_log, 
    test_size=0.2, 
    stratify=df_log["age"], 
    random_state=42
)

print(f"Train: {len(train_df)}, Test: {len(test_df)}")

5. Integration with BulkFormer

import polars as pl
from bulkformer import BulkFormer, extract_features

df = pl.read_parquet("hf://datasets/longevity-genie/aging-expressions/data/gtex_bulkformer_estimated_age_tpm.parquet")

# Prepare expression matrix for BulkFormer
metadata_cols = ["sample_id", "tissue", "subject_id", "sex", "age", "death_time", "estimated_age"]
gene_cols = [c for c in df.columns if c not in metadata_cols]

# Extract expression matrix
expr_df = df.select(gene_cols)

# Use BulkFormer for feature extraction or downstream tasks
# (See BulkFormer documentation for details)

Dataset Statistics

Sample Distribution

  • Total Samples: 9,662
  • Total Subjects: ~800 (each subject contributes multiple tissue samples)
  • Sex Distribution:
    • Male (sex=1): ~60%
    • Female (sex=2): ~40%

Tissue Coverage

54 GTEx tissues including:

  • Blood: Whole blood samples
  • Brain: Multiple brain regions (cortex, cerebellum, etc.)
  • Heart: Atrial and ventricular tissue
  • Liver: Hepatic tissue
  • Muscle: Skeletal muscle
  • Adipose: Subcutaneous and visceral fat
  • Skin: Sun-exposed and not sun-exposed
  • And 47 more tissues

Gene Coverage

  • Total Genes: 18,248 protein-coding genes
  • Gene ID Type: Ensembl gene IDs (via gene symbols)
  • Expression Range: 0 to ~1,000,000 TPM
  • Median Genes Detected per Sample: ~15,000 (TPM > 0)

Data Source & Citation

GTEx Project

This dataset is derived from ARCHS4 and the GTEx (Genotype-Tissue Expression) Project.

ARCHS4

ARCHS4 (All RNA-seq and ChIP-seq Sample and Signature Search) provides uniformly processed gene expression data from GEO and SRA.

ARCHS4 Citation:

@article{lachmann2018massive,
  title={Massive mining of publicly available RNA-seq data from human and mouse},
  author={Lachmann, Alexander and Torre, Denis and Keenan, Alexandra B and Jagodnik, Kathleen M and Lee, Hoyjin J and Wang, Lily and Silverstein, Moshe C and Ma'ayan, Avi},
  journal={Nature communications},
  volume={9},
  number={1},
  pages={1366},
  year={2018},
  publisher={Nature Publishing Group}
}

ARCHS4 Portal: https://maayanlab.cloud/archs4/

Data Version: ARCHS4 v2.2+ (continuously updated)

GTEx

The GTEx Project is supported by the Common Fund of the Office of the Director of the National Institutes of Health, and by NCI, NHGRI, NHLBI, NIDA, NIMH, and NINDS.

GTEx Citation:

@article{gtex2020,
  title={The GTEx Consortium atlas of genetic regulatory effects across human tissues},
  author={GTEx Consortium},
  journal={Science},
  volume={369},
  number={6509},
  pages={1318--1330},
  year={2020},
  publisher={American Association for the Advancement of Science}
}

GTEx Portal: https://gtexportal.org/

Data Version: GTEx Analysis Release v10 (2022-06-06)

aging-expressions Package

This dataset was processed using the aging-expressions Python library:

GitHub: https://github.com/longevity-genie/aging-expressions

Citation:

@software{aging_expressions,
  title={aging-expressions: Age-stratified gene expression analysis toolkit},
  author={Longevity Genie Team},
  year={2025},
  url={https://github.com/longevity-genie/aging-expressions}
}

BulkFormer Model

Gene filtering and compatibility are based on the BulkFormer foundation model:

BulkFormer Citation:

@article{bulkformer2025,
  title={BulkFormer: A large-scale foundation model for human bulk transcriptomes},
  author={[Authors]},
  journal={bioRxiv},
  year={2025},
  doi={10.1101/2025.06.11.659222}
}

GitHub: https://github.com/your-org/BulkFormer

License

This dataset is released under CC BY 4.0 License (Creative Commons Attribution 4.0 International).

Conditions

  • βœ… Share: Copy and redistribute the material in any medium or format
  • βœ… Adapt: Remix, transform, and build upon the material for any purpose
  • βœ… Attribution: You must give appropriate credit to both:
    • The GTEx Project (original data source)
    • The aging-expressions package (data processing)

GTEx Data Use Agreement

Users of this dataset must also comply with the GTEx Data Use Certification Agreement:

  • Data is for research purposes only
  • Do not attempt to identify individual participants
  • Acknowledge GTEx in publications

For full terms, see: https://gtexportal.org/home/dataUseAgreement

Limitations & Considerations

Age Limitations

  • Age Brackets: GTEx provides age as 10-year ranges, not exact ages
  • Age Range: Limited to 20-79 years (no samples < 20 or > 79)
  • Estimated Age: Midpoints are used (e.g., 54.5 for "50-59"), which introduces uncertainty

Sample Considerations

  • Post-mortem Tissue: All GTEx samples are from deceased donors
  • Death Circumstances: Variable (recorded in death_time column)
  • Tissue Quality: Quality varies by death circumstances and preservation
  • Multiple Samples per Subject: Same individual contributes multiple tissues (avoid subject leakage in train/test splits)

Gene Expression Limitations

  • Gene Coverage: 18,248 genes (not all human genes)
  • Gene Filtering: Limited to BulkFormer gene set
  • TPM Normalization: Assumes gene length and library size corrections are accurate
  • Batch Effects: Potential batch effects across collection sites and dates

Demographic Limitations

  • Sex Only: No gender identity information
  • Limited Diversity: GTEx v10 is primarily from donors of European ancestry
  • No Disease Status: Donors are generally healthy (post-mortem collection)

Ethical Considerations

Privacy

  • De-identified Data: All GTEx data is de-identified
  • No Protected Health Information (PHI): Sample IDs are not linkable to individuals
  • IRB Approved: GTEx project has IRB approval from all participating sites

Bias & Fairness

  • Demographic Bias: Dataset skews toward European ancestry, male donors, and middle-aged individuals
  • Tissue Availability Bias: Some tissues are underrepresented due to collection feasibility
  • Research Use Only: Not suitable for clinical decision-making

Responsible Use

  • Research Purposes: This data is for research only, not clinical diagnostics
  • Model Validation: Models trained on this data should be validated on independent cohorts
  • Transparency: Report dataset characteristics when publishing results

Updates & Maintenance

Version History

  • v1.0 (2025-01): Initial release with GTEx v10 data
    • 9,662 samples, 18,248 genes
    • TPM-normalized expression
    • Age-stratified metadata

Future Plans

  • ARCHS4 Integration: Add ARCHS4 human and mouse samples
  • DEE2 Metadata: Incorporate SRA metadata for cross-dataset analysis
  • Tissue Subsets: Create tissue-specific subsets for faster loading
  • Age Prediction Features: Add BulkFormer-derived age predictions

Contact & Support

Questions & Issues

Contributing

Contributions are welcome! See the GitHub repository for:

  • Bug reports
  • Feature requests
  • Documentation improvements
  • Additional analyses

Acknowledgments

This dataset was created by the Longevity Genie team as part of our mission to accelerate aging research through open data and reproducible analysis.

Special thanks to:

  • GTEx Consortium for making this invaluable resource available
  • BulkFormer team for the foundation model and gene annotations
  • Open-source community for tools like Polars, Pandas, and HuggingFace

Last Updated: January 2025
Dataset Version: 1.0
Curator: Longevity Genie Team