--- license: mit language: - en tags: - genomics - transcription-factors - yeast - saccharomyces-cerevisiae pretty_name: "Yeast Dual Threshold Optimization Analysis" features: - applies_to: - dto fields: - name: pr_ranking_column dtype: class_label: ["log2fc", "pvalue"] description: >- Describes which column, effect (log2fc) or pvalue was used in ranking the perturbation response data. see scripts/dto_preparation.R for more info on each dataset - name: binding_rank_threshold dtype: float64 description: >- Rank threshold used for the binding dataset in the DTO analysis. This represents the rank cutoff that maximizes overlap significance between binding and perturbation datasets. role: quantitative_measure - name: perturbation_rank_threshold dtype: float64 description: >- Rank threshold used for the perturbation dataset in the DTO analysis. This represents the rank cutoff that maximizes overlap significance between binding and perturbation datasets. role: quantitative_measure - name: binding_set_size dtype: float64 description: >- Number of targets in the binding dataset at the optimal rank threshold. This is the size of the set used to calculate overlap with the perturbation dataset. role: quantitative_measure - name: perturbation_set_size dtype: float64 description: >- Number of targets in the perturbation dataset at the optimal rank threshold. This is the size of the set used to calculate overlap with the binding dataset. role: quantitative_measure - name: dto_fdr dtype: float64 description: >- False discovery rate (FDR) for the dual threshold optimization test. Lower values indicate more significant overlap between binding and perturbation target sets. Missing values (NA) indicate insufficient data for DTO analysis. role: quantitative_measure - name: dto_empirical_pvalue dtype: float64 description: >- Empirical p-value from permutation testing for the dual threshold optimization. This represents the probability of observing the observed overlap by chance. Missing values (NA) indicate insufficient data for DTO analysis. role: quantitative_measure configs: - config_name: dto description: >- Dual threshold optimization analysis results comparing transcription factor binding experiments with gene expression perturbation experiments. The dataset is partitioned by binding dataset and perturbation dataset, allowing efficient queries for specific binding-perturbation comparisons. dataset_type: comparative data_files: - split: train path: dto/*/*/*.parquet dataset_info: features: - name: binding_id dtype: string description: >- Composite sample identifier for the binding experiment in format 'repo_id;config_name;sample_id' (e.g., 'BrentLab/callingcards;annotated_feature_reprocess_intergenic_analysis;127') role: source_sample - name: perturbation_id dtype: string description: >- Composite sample identifier for the perturbation experiment in format 'repo_id;config_name;sample_id' (e.g., 'BrentLab/hackett_2020;hackett_2020_analysis_set;1504') role: source_sample - name: binding_repo_dataset dtype: string description: >- Partition key for the binding dataset: the repository name and config name joined by a hyphen (e.g., 'rossi_2021-macs_kang'). - name: perturbation_repo_dataset dtype: string description: >- Partition key for the perturbation dataset: the repository name and config name joined by a hyphen (e.g., 'hackett_2020-hackett_2020_analysis_set'). partitioning: enabled: true partition_by: ["binding_repo_dataset", "perturbation_repo_dataset"] path_template: "dto/binding_repo_dataset={binding_repo_dataset}/perturbation_repo_dataset={perturbation_repo_dataset}/*.parquet" --- # Yeast Comparative Analysis Analyses that relate samples from different datasets in the BrentLab yeast collection. Each row relates two or more samples, which are referenced by composite identifiers of the form `repo_id;config_name;sample_id`, rather than describing the samples of a single dataset. Every config here has `dataset_type: comparative`. The repository currently holds one analysis, `dto`, and can hold others as additional configs. ## dto: dual threshold optimization [Dual threshold optimization](https://github.com/BrentLab/dual_threshold_optimization) (DTO) compares a binding dataset with a perturbation response dataset for the same regulator. For each pair of a binding sample and a perturbation sample it finds the rank thresholds on the two target lists that maximize the significance of their overlap, and reports the empirical p-value and false discovery rate of that overlap (`dto_empirical_pvalue`, `dto_fdr`). `pr_ranking_column` records whether the perturbation targets were ranked by effect (`log2fc`) or `pvalue`. See `scripts/` for how the inputs are prepared and the results parsed. The data is partitioned by binding dataset and perturbation dataset, one file per pair: ``` dto/binding_repo_dataset=-/perturbation_repo_dataset=-/part-0.parquet ``` ## Accessing Data The examples below require [labretriever](https://github.com/cmatKhan/labretriever#installation) (`pip install labretriever`) and/or the [HuggingFace Hub client](https://huggingface.co/docs/huggingface_hub/installation) (`pip install huggingface_hub`). ### Accessing Data with labretriever This repository is part of a collection configured as a unified database using [labretriever.VirtualDB](https://cmatkhan.github.io/labretriever/virtual_db_configuration/). Download the [collection config](https://github.com/BrentLab/tfbpshiny/blob/main/tfbpshiny/brentlab_yeast_collection.yaml) and use it to query the data directly in Python, or with an AI assistant using the [labretriever plugin](https://cmatkhan.github.io/labretriever/mcp_server/#quick-install-claude-code-plugin). The collection config's `links` block maps each composite identifier field to the primary datasets it references. labretriever uses it to expose a `dto_expanded` view that splits `binding_id` into the primary dataset (`binding_id_source`) and the sample id (`binding_id_id`), and does the same for `perturbation_id`. ```python from labretriever.virtual_db import VirtualDB from labretriever.datacard import DataCard # Metadata card = DataCard("BrentLab/yeast_comparative_analysis") print([c.config_name for c in card.configs]) # list available datasets # path to the downloaded brentlab_yeast_collection.yaml vdb = VirtualDB("/path/to/brentlab_yeast_collection.yaml") print(vdb.get_dataset_description("dto")) vdb.query("SELECT * FROM dto_expanded LIMIT 5") ``` ### Direct parquet access Use `DataCard.info()` to inspect available files, then download and query with DuckDB. The `dto` data is partitioned, so download a single binding and perturbation pair, or the whole directory. ```python from huggingface_hub import snapshot_download import duckdb repo_path = snapshot_download( repo_id="BrentLab/yeast_comparative_analysis", repo_type="dataset", allow_patterns="dto/**", ) conn = duckdb.connect() # returns a pandas DataFrame with the first 5 rows; the partition keys are # available as columns because of hive_partitioning conn.execute( "SELECT * FROM read_parquet(?, hive_partitioning = true) LIMIT 5", [f"{repo_path}/dto/*/*/*.parquet"], ).df() ``` ### Accessing using R Clone the repository and read the partitioned dataset with [arrow](https://arrow.apache.org/docs/r/): ```r # install.packages("arrow") arrow::open_dataset("dto") |> dplyr::collect() ```