File size: 9,438 Bytes
899ec5d
 
 
 
 
 
 
 
3fd7af2
 
899ec5d
 
 
 
dcf5294
899ec5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e659cf
dcf5294
899ec5d
 
 
 
 
 
 
 
 
 
8e659cf
899ec5d
 
8e659cf
715c306
3fd7af2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2601644
824bf51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
899ec5d
 
 
628113d
 
899ec5d
 
 
628113d
899ec5d
8a805dc
628113d
8a805dc
 
628113d
8a805dc
628113d
899ec5d
628113d
899ec5d
628113d
 
 
 
 
899ec5d
628113d
899ec5d
628113d
 
 
899ec5d
628113d
899ec5d
5dd2b69
628113d
 
 
 
 
 
 
899ec5d
628113d
 
 
 
 
 
 
 
 
 
 
 
899ec5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2601644
628113d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
---
license: mit
tags:
- transcription-factor
- binding
- chipexo
- genomics
- biology
language:
- en
pretty_name: Rossi ChIP-exo 2021
configs:
- config_name: metadata
  description: Metadata describing the tagged regulator in each experiment
  dataset_type: metadata
  data_files:
  - split: train
    path: rossi_2021_metadata.parquet
  dataset_info:
    features:
    - name: regulator_locus_tag
      dtype: string
      description: Systematic gene name (ORF identifier) of the transcription factor
    - name: regulator_symbol
      dtype: string
      description: Standard gene symbol of the transcription factor
    - name: run_accession
      dtype: string
      description: GEO run accession identifier for the sample
    - name: yeastepigenome_id
      dtype: string
      description: Sample identifier used by yeastepigenome.org
- config_name: genome_map
  description: "ChIP-exo 5' tag coverage data partitioned by sample accession"
  dataset_type: genome_map
  data_files:
  - split: train
    path: genome_map/*/*.parquet
  dataset_info:
    features:
    - name: chr
      dtype: string
      description: Chromosome name (e.g., chrI, chrII, etc.)
    - name: pos
      dtype: int32
      description: "Genomic position of the 5' tag"
    - name: pileup
      dtype: int32
      description: "Depth of coverage (number of 5' tags) at this genomic position"
- config_name: rossi_annotated_features
  description: ChIP-exo regulator-target binding features with peak statistics
  dataset_type: annotated_features
  default: true
  metadata_fields:
    - regulator_locus_tag
    - regulator_symbol
    - target_locus_tag
    - target_symbol
  data_files:
    - split: train
      path: yeastepigenome_annotatedfeatures.parquet
  dataset_info:
    features:
      - name: sample_id
        dtype: int32
        description: >-
          Unique identifier for each ChIP-exo experimental sample.
      - name: pss_id
        dtype: float64
        description: >-
          Current brentlab promotersetsig table id. This will eventually be removed.
      - name: binding_id
        dtype: float64
        description: >-
          Current brentlab binding table id. This will eventually be removed.
      - name: yeastepigenome_id
        dtype: float64
        description: >-
          Unique identifier in the yeastepigenome database.
      - name: regulator_locus_tag
        dtype: string
        description: >-
          Systematic ORF name of the regulator.
        role: regulator_identifier
      - name: regulator_symbol
        dtype: string
        description: >-
          Common gene name of the regulator.
        role: regulator_identifier
      - name: target_locus_tag
        dtype: string
        description: >-
          The systematic ID of the feature to which the effect/pvalue is
          assigned. See hf/BrentLab/yeast_genome_resources
        role: target_identifier
      - name: target_symbol
        dtype: string
        description: >-
          The common name of the feature to which the effect/pvalue is
          assigned. If there is no common name, the `target_locus_tag` is
          used.
        role: target_identifier
      - name: n_sig_peaks
        dtype: float64
        description: >-
          Number of peaks in the promoter region of the the target gene
        role: quantitative_measure
      - name: max_fc
        dtype: float64
        description: >-
          If there are multiple peaks in the promoter region, then the maximum is
          reported. Otherwise, it is the fold change of the single peak in the
          promoter.
        role: quantitative_measure
      - name: min_pval
        dtype: float64
        description: >-
          The most significant p-value among peaks for this interaction. 
        role: quantitative_measure
- config_name: reprocess_annotatedfeatures
  description: >-
    Annotated features reprocessed with updated peak
    calling methodology
  dataset_type: annotated_features
  data_files:
    - split: train
      path: reprocess_annotatedfeatures.parquet
  dataset_info:
    features:
      - name: regulator_locus_tag
        dtype: string
        description: Systematic gene name (ORF identifier) of the transcription factor
      - name: regulator_symbol
        dtype: string
        description: Standard gene symbol of the transcription factor
      - name: target_locus_tag
        dtype: string
        description: Systematic gene name (ORF identifier) of the target gene
      - name: target_symbol
        dtype: string
        description: Standard gene symbol of the target gene
      - name: baseMean
        dtype: float64
        description: Average of normalized count values, dividing by size factors, taken over all samples
      - name: log2FoldChange
        dtype: float64
        description: Log2 fold change between comparison and control groups
      - name: lfcSE
        dtype: float64
        description: Standard error estimate for the log2 fold change estimate
      - name: stat
        dtype: float64
        description: Value of the test statistic for the gene
      - name: pvalue
        dtype: float64
        description: P-value of the test for the gene
      - name: padj
        dtype: float64
        description: Adjusted p-value for multiple testing for the gene
---
# Rossi 2021

This data is gathered from [yeastepigenome.org](https://yeastepigenome.org/).
This work was published in

[Rossi MJ, Kuntala PK, Lai WKM, Yamada N, Badjatia N, Mittal C, Kuzu G, Bocklund K, Farrell NP, Blanda TR, Mairose JD, Basting AV, Mistretta KS, Rocco DJ, Perkinson ES, Kellogg GD, Mahony S, Pugh BF. A high-resolution protein architecture of the budding yeast genome. Nature. 2021 Apr;592(7853):309-314. doi: 10.1038/s41586-021-03314-8. Epub 2021 Mar 10. PMID: 33692541; PMCID: PMC8035251.](https://doi.org/10.1038/s41586-021-03314-8)

This repo provides 4 datasets:

- **rossi_2021_metadata**: Metadata describing the tagged regulator in each
  experiment.
- **genome_map**: ChIP-exo 5' tag coverage data partitioned by sample accession.
- **reprocess_annotatedfeatures**: This data was reprocessed from the fastq files
  on GEO. See scripts/reprocessing_details.txt for more information.
- **yeastepigenome_annotatedfeatures**: ChIP-exo regulator-target binding features
  with peak statistics.

## 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](https://github.com/BrentLab/tfbpapi/?tab=readme-ov-file#installation),
you can adapt this [tutorial](https://brentlab.github.io/tfbpapi/tutorials/hfqueryapi_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/rossi_2021" dataset from Hugging Face Hub.

```python
from huggingface_hub import ModelCard
from pprint import pprint

card = ModelCard.load("BrentLab/rossi_2021", 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 preferable to only retrieve
specific files or partitions. You can use the metadata files to choose
which files to pull.

```python
from huggingface_hub import snapshot_download
import duckdb
import os
# Download only the metadata first
repo_path = snapshot_download(
    repo_id="BrentLab/rossi_2021",
    repo_type="dataset",
    allow_patterns="rossi_2021_metadata.parquet"
)

dataset_path = os.path.join(repo_path, "rossi_2021_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 SRR11466106:

```python
# Download only a specific sample's genome coverage data
repo_path = snapshot_download(
    repo_id="BrentLab/rossi_2021",
    repo_type="dataset",
    allow_patterns="genome_map/accession=SRR11466106/*.parquet"
)

# 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](https://huggingface.co/docs/hub/en/security-tokens).
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:

```python

repo_id = "BrentLab/rossi_2021"

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 rossi_annotated_features parquet file
parquet_path = os.path.join(repo_path, "yeastepigenome_annotatedfeatures.parquet")
print(f"✓ Parquet file at: {parquet_path}")
```