barkai_compendium / README.md
cmatkhan's picture
Upload README.md with huggingface_hub
cca1a99 verified
metadata
license: mit
language:
  - en
tags:
  - transcription-factor
  - binding
  - chec-seq
  - genomics
  - biology
pretty_name: Barkai ChEC-seq Compendium
size_categories:
  - 100M<n<1B
experimental_conditions:
  temperature_celsius: 30
  cultivation_method: liquid_culture
  growth_phase_at_harvest:
    od600: 4
    stage: overnight_stationary_phase
  media:
    name: synthetic_complete_dextrose
    carbon_source:
      - compound: D-dextrose
        concentration_percent: unspecified
    nitrogen_source: unspecified
configs:
  - config_name: genomic_coverage
    description: Genomic coverage data with pileup counts at specific positions
    dataset_type: genome_map
    default: true
    data_files:
      - split: train
        path: genome_map/*/*/part-0.parquet
    dataset_info:
      features:
        - name: seqnames
          dtype: string
          description: Chromosome or sequence name (e.g., chrI, chrII, etc.)
        - name: start
          dtype: int32
          description: Start position of the genomic interval (1-based coordinates)
        - name: end
          dtype: int32
          description: End position of the genomic interval (1-based coordinates)
        - name: pileup
          dtype: int32
          description: Number of tags (5' of read) at this genomic position
      partition_info:
        - name: Series
          dtype: string
          description: GEO series of the dataset
        - name: Accession
          dtype: string
          description: GEO accession of the specific sample
  - config_name: GSE178430_metadata
    description: Metadata for GSE178430
    dataset_type: metadata
    data_files:
      - split: train
        path: GSE178430_metadata.parquet
    dataset_info:
      features:
        - name: sample_id
          dtype: integer
          description: Unique sample identifier. Uniquely identifies an accession
        - name: series
          dtype: string
          description: the GEO series to which this collection belongs
        - name: accession
          dtype: string
          description: Sample accession identifier
        - name: regulator_locus_tag
          dtype: string
          description: >-
            Systematic gene name (ORF identifier) of the tagged transcription
            factor
        - name: regulator_symbol
          dtype: string
          description: Standard gene symbol of the tagged transcription factor
        - name: strainid
          dtype: string
          description: Strain identifier used in the experiment
        - name: instrument
          dtype: string
          description: Sequencing instrument used for data generation
        - name: genotype
          dtype: string
          description: Full genotype description of the experimental strain
        - name: dbd_donor_symbol
          dtype: string
          description: >-
            Gene symbol of the DNA-binding domain donor (for chimeric
            constructs)
        - name: ortholog_donor
          dtype: string
          description: Ortholog donor information for cross-species constructs
        - name: paralog_deletion_symbol
          dtype: string
          description: Gene symbol of deleted paralog in the strain background
        - name: paralog_resistance_cassette
          dtype: string
          description: Antibiotic resistance cassette used for paralog deletion
  - config_name: GSE209631_metadata
    description: ChEC-seq experiment metadata for transcription factor variant studies
    dataset_type: metadata
    data_files:
      - split: train
        path: GSE209631_metadata.parquet
    dataset_info:
      features:
        - name: sample_id
          dtype: integer
          description: Unique sample identifier. Uniquely identifies an accession
        - name: series
          dtype: string
          description: the GEO series to which this collection belongs
        - name: accession
          dtype: string
          description: Sample accession identifier
        - name: regulator_locus_tag
          dtype: string
          description: >-
            Systematic gene name (ORF identifier) of the tagged transcription
            factor
          role: regulator_identifier
        - name: regulator_symbol
          dtype: string
          description: Standard gene symbol of the tagged transcription factor
          role: regulator_identifier
        - name: variant_type
          dtype: string
          description: Type of transcription factor variant tested in the experiment
  - config_name: GSE222268_metadata
    description: General experiment metadata for genomic studies
    dataset_type: metadata
    data_files:
      - split: train
        path: GSE222268_metadata.parquet
    dataset_info:
      features:
        - name: sample_id
          dtype: string
          description: Unique identifier for the experimental sample
        - name: series
          dtype: string
          description: Series or batch identifier grouping related samples
        - name: accession
          dtype: string
          description: Accession number from public database (e.g., SRA, GEO)
        - name: regulator_locus_tag
          dtype: string
          description: Systematic gene identifier for the transcription factor regulator
          role: regulator_identifier
        - name: regulator_symbol
          dtype: string
          description: Standard gene symbol for the transcription factor regulator
          role: regulator_identifier
        - name: experiment_details
          dtype: string
          description: >-
            Detailed description of experimental methods, parameters, or
            conditions
          role: experimental_condition
        - name: description
          dtype:
            class_label:
              names:
                - MNase
                - ChEC-seq
          description: Experiment type, either MNase or ChEC-seq

Barkai Compendium

This collects the ChEC-seq data from the following GEO series:

The metadata for each is parsed out from the SraRunTable, or in the case of GSE222268, the NCBI series matrix file (the genotype isn't in the SraRunTable)

The Barkai lab refers to this set as their binding compendium.

The genotypes for GSE222268 are not clear enough to me currently to parse well.

This repo provides 4 datasets:

  • GSE178430_metadata: Metadata for GSE178430.
  • GSE209631_metadata: ChEC-seq experiment metadata for transcription factor variant studies.
  • GSE222268_metadata: General experiment metadata for genomic studies.
  • genome_map: Genomic coverage data with pileup counts at specific positions.

Usage

The python package tfbpapi provides an interface to this data which eases examining the datasets, field definitions and other operations. You may also download the parquet datasets directly from hugging face by clicking on "Files and Versions", or by using the huggingface_cli and duckdb directly. In both cases, this provides a method of retrieving dataset and field definitions.

tfbpapi

After installing tfbpapi, you can adapt this tutorial in order to explore the contents of this repository.

huggingface_cli/duckdb

You can retrieves and displays the file paths for each configuration of the "BrentLab/barkai_compendium" dataset from Hugging Face Hub.

from huggingface_hub import ModelCard
from pprint import pprint

card = ModelCard.load("BrentLab/barkai_compendium", repo_type="dataset")

# cast to dict
card_dict = card.data.to_dict()

# Get partition information
dataset_paths_dict = {d.get("config_name"): d.get("data_files")[0].get("path") for d in card_dict.get("configs")}

pprint(dataset_paths_dict)

The entire repository is large. It may be preferrable to only retrieve specific files or partitions. You canuse the metadata files to choose which files to pull.

from huggingface_hub import snapshot_download
import duckdb
import os

# Download only the partitioned dataset directory
repo_path = snapshot_download(
    repo_id="BrentLab/barkai_compendium",
    repo_type="dataset",
    allow_patterns="*metadata.parquet"
)

dataset_path = os.path.join(repo_path, "GSE178430_metadata.parquet")
conn = duckdb.connect()
meta_res = conn.execute("SELECT * FROM read_parquet(?) LIMIT 10", [dataset_path]).df()

print(meta_res)

We might choose to take a look at the file with accession GSM5417602

# Download only the partitioned dataset directory
repo_path = snapshot_download(
    repo_id="BrentLab/barkai_compendium",
    repo_type="dataset",
    allow_patterns="genome_map/series=GSE179430/accession=GSM5417602/*parquet"  # Only the parquet data
)

# Query the specific partition
dataset_path = os.path.join(repo_path, "genome_map")
result = conn.execute("SELECT * FROM read_parquet(?) LIMIT 10", 
                     [f"{dataset_path}/**/*.parquet"]).df()

print(result)

If you wish to pull the entire repo, due to its size you may need to use an authentication token. If you do not have one, try omitting the token related code below and see if it works. Else, create a token and provide it like so:

repo_id = "BrentLab/barkai_compendium"

hf_token = os.getenv("HF_TOKEN")

# Download entire repo to local directory
repo_path = snapshot_download(
    repo_id=repo_id,
    repo_type="dataset",
    token=hf_token
)

print(f"\n✓ Repository downloaded to: {repo_path}")

# Construct path to the genome_map parquet file
parquet_path = os.path.join(repo_path, "genome_map.parquet")
print(f"✓ Parquet file at: {parquet_path}")