gabrielaltay commited on
Commit
839287e
·
verified ·
1 Parent(s): ee532e3

Card: simplify How this dataset is built section; link to source for full payloads

Browse files
Files changed (1) hide show
  1. README.md +49 -137
README.md CHANGED
@@ -30,7 +30,7 @@ National Cancer Institute (NCI) Genomic Data Commons (GDC). One HuggingFace
30
  (HF) subset per TCGA project; one row per patient.
31
 
32
  - **Projects included:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`
33
- - **Generated:** 2026-05-05 06:12:43 UTC
34
  - **Source:** GDC `/cases` endpoint, open-access tier only.
35
  - **Schema:** derived from the [GDC Data Dictionary][gdc-dict]; the live
36
  dictionary the GDC was serving when the data was fetched is hashed into
@@ -84,147 +84,59 @@ tree:
84
 
85
  ## How this dataset is built
86
 
87
- Three GDC REST endpoints feed every row in this dataset. Both endpoints
88
- and payloads below are reproduced verbatim from the build code; the
89
- on-disk `gdc_status.json` for each project additionally pins the GDC
90
- data release and dictionary SHA-256 the data was fetched against.
91
-
92
- ### `POST /cases` — clinical entities
93
-
94
- One paginated POST per build, returning the nested case JSON for every
95
- patient in the requested projects.
96
-
97
- ```json
98
- {
99
- "filters": {
100
- "op": "in",
101
- "content": {
102
- "field": "project.project_id",
103
- "value": [
104
- "TCGA-CHOL",
105
- "TCGA-DLBC",
106
- "TCGA-LUAD"
107
- ]
108
- }
109
- },
110
- "fields": "case_id,submitter_id,primary_site,disease_type,index_date,consent_type,days_to_consent,days_to_lost_to_followup,lost_to_followup",
111
- "expand": "demographic,diagnoses,diagnoses.treatments,follow_ups,exposures,family_histories,project,samples,samples.portions,samples.portions.analytes,samples.portions.analytes.aliquots",
112
- "format": "JSON",
113
- "size": 200,
114
- "from": 0
115
- }
116
- ```
117
 
118
- The full nested response (top-level scalars + `demographic` + `diagnoses[]`
119
- with `treatments[]` inside + `follow_ups[]` + `exposures[]` +
120
- `family_histories[]` + `samples[]` with `portions[].analytes[].aliquots[]`
121
- inside) is written to `<data-dir>/raw/<project>/cases.json` and feeds the
122
- `cases` config (and the consolidated patient row).
123
-
124
- ### `POST /files` — molecular file discovery
125
-
126
- One POST per (project, modality) pair, listing every open-access file of
127
- that modality. Each modality is identified by a `data_type` plus a small
128
- set of clauses that lock the format / experimental strategy / workflow
129
- type so future GDC additions can't silently ship under the same
130
- `data_type`:
131
-
132
- - `data_type='Masked Somatic Mutation'` AND `data_format='MAF'` AND `data_category='Simple Nucleotide Variation'` AND `experimental_strategy='WXS'` AND `analysis.workflow_type='Aliquot Ensemble Somatic Variant Merging and Masking'`
133
- - `data_type='Gene Expression Quantification'` AND `data_format='TSV'` AND `data_category='Transcriptome Profiling'` AND `experimental_strategy='RNA-Seq'` AND `analysis.workflow_type='STAR - Counts'`
134
-
135
- Below is the full request shape for `Masked Somatic Mutation` against
136
- `TCGA-LUAD`; the build runs the same shape with the
137
- `Gene Expression Quantification` clauses too. Responses are written to
138
- `<data-dir>/raw/<project>/<modality>/manifest.json` and feed the `files`
139
- config.
140
-
141
- ```json
142
- {
143
- "filters": {
144
- "op": "and",
145
- "content": [
146
- {
147
- "op": "=",
148
- "content": {
149
- "field": "cases.project.project_id",
150
- "value": "TCGA-LUAD"
151
- }
152
- },
153
- {
154
- "op": "=",
155
- "content": {
156
- "field": "access",
157
- "value": "open"
158
- }
159
- },
160
- {
161
- "op": "=",
162
- "content": {
163
- "field": "data_type",
164
- "value": "Masked Somatic Mutation"
165
- }
166
- },
167
- {
168
- "op": "=",
169
- "content": {
170
- "field": "data_format",
171
- "value": "MAF"
172
- }
173
- },
174
- {
175
- "op": "=",
176
- "content": {
177
- "field": "data_category",
178
- "value": "Simple Nucleotide Variation"
179
- }
180
- },
181
- {
182
- "op": "=",
183
- "content": {
184
- "field": "experimental_strategy",
185
- "value": "WXS"
186
- }
187
- },
188
- {
189
- "op": "=",
190
- "content": {
191
- "field": "analysis.workflow_type",
192
- "value": "Aliquot Ensemble Somatic Variant Merging and Masking"
193
- }
194
- }
195
- ]
196
- },
197
- "fields": "file_id,file_name,file_size,md5sum,access,data_category,data_type,data_format,experimental_strategy,analysis.workflow_type,cases.case_id,cases.submitter_id,cases.samples.portions.analytes.aliquots.aliquot_id",
198
- "format": "JSON",
199
- "size": 500,
200
- "from": 0
201
- }
202
- ```
203
 
204
- ### `POST /data` file bytes
205
 
206
- For every file UUID returned by `/files`, the build batches up to 50
207
- UUIDs per request:
 
 
 
 
 
208
 
209
- ```json
210
- {"ids": ["<file_uuid_1>", "<file_uuid_2>", "..."]}
211
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
- The response is a tar.gz of the files. Mutations files are parsed
214
- row-by-row into the `masked_somatic_mutation` config; expression files
215
- are parsed gene-row-by-gene-row into the
216
- `gene_expression_quantification` config. (See `tcga2hf.gdc.bulk_download`
217
- for the batching + retry logic.)
218
-
219
- ### Other GDC calls captured for provenance
220
-
221
- - `GET /status` — once at the top of every build; `data_release` /
222
- `tag` / `commit` are saved in each project's `gdc_status.json`.
223
- - `GET /v0/submission/_dictionary/_all` — once at the top of every build;
224
- written to `<data-dir>/raw/gdc_dictionary.<major>.<minor>.json` and its
225
- SHA-256 is recorded in `gdc_status.json`. The static schema in
226
- `tcga2hf.schema` is regenerated from this dictionary; see the package
227
- `scripts/regenerate_clinical_fields.py`.
228
 
229
  ## Loading
230
 
 
30
  (HF) subset per TCGA project; one row per patient.
31
 
32
  - **Projects included:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`
33
+ - **Generated:** 2026-05-05 15:19:38 UTC
34
  - **Source:** GDC `/cases` endpoint, open-access tier only.
35
  - **Schema:** derived from the [GDC Data Dictionary][gdc-dict]; the live
36
  dictionary the GDC was serving when the data was fetched is hashed into
 
84
 
85
  ## How this dataset is built
86
 
87
+ Three GDC REST endpoints feed every row, with filters and field lists
88
+ constructed in [`src/tcga2hf/clinical.py`][src-clinical] (the `cases`
89
+ table) and [`src/tcga2hf/genomic.py`][src-genomic] (molecular and
90
+ provenance tables) of the [`tcga2hf` repo][repo].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
+ **Projects fetched in this build:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ ### `POST /cases` `cases` table
95
 
96
+ Filter: `project.project_id IN [<projects above>]`. The request `expand`s
97
+ the full nested `case` structure (demographic + diagnoses → treatments +
98
+ follow_ups + exposures + family_histories + samples → portions →
99
+ analytes → aliquots), and the response is captured verbatim into
100
+ `<data-dir>/raw/<project>/cases.json` per project. See
101
+ `tcga2hf.clinical.TOP_LEVEL_FIELDS` and `tcga2hf.clinical.EXPANSIONS`
102
+ for the exact field/expand lists.
103
 
104
+ ### `POST /files``masked_somatic_mutation`, `gene_expression_quantification`, `files` tables
105
+
106
+ One POST per (project, modality). All requests share
107
+ `cases.project.project_id = <project>` AND `access = open`. The
108
+ remaining clauses lock the format / experimental strategy / workflow
109
+ type so future GDC additions can't silently ship a different pipeline
110
+ under the same `data_type`:
111
+
112
+ | Table | data_type | data_format | data_category | experimental_strategy | analysis.workflow_type |
113
+ |---|---|---|---|---|---|
114
+ | `masked_somatic_mutation` | `Masked Somatic Mutation` | `MAF` | `Simple Nucleotide Variation` | `WXS` | `Aliquot Ensemble Somatic Variant Merging and Masking` |
115
+ | `gene_expression_quantification` | `Gene Expression Quantification` | `TSV` | `Transcriptome Profiling` | `RNA-Seq` | `STAR - Counts` |
116
+
117
+ The combined `/files` responses (one per modality per project) feed the
118
+ `files` table. See `tcga2hf.genomic.MODALITY_FILTERS` and
119
+ `tcga2hf.genomic.FILE_FIELDS` for the full request payload.
120
+
121
+ ### `POST /data` → file bytes
122
+
123
+ UUIDs returned by `/files` are batched (≤50 per request) into `POST
124
+ /data`; the response is a tar.gz of those files. Mutations files are
125
+ parsed row-by-row into the `masked_somatic_mutation` config; expression
126
+ files are parsed gene-row-by-gene-row into the
127
+ `gene_expression_quantification` config. See
128
+ `tcga2hf.gdc.bulk_download` for the batching and retry logic.
129
+
130
+ ### Provenance pinned per build
131
+
132
+ - `GET /status` → `data_release` / `tag` / `commit` saved in each
133
+ project's `gdc_status.json`.
134
+ - `GET /v0/submission/_dictionary/_all` → schema dictionary snapshot
135
+ saved alongside the raw data; its SHA-256 is recorded in
136
+ `gdc_status.json`.
137
 
138
+ [src-clinical]: https://github.com/galtay/tcga2hf/blob/main/src/tcga2hf/clinical.py
139
+ [src-genomic]: https://github.com/galtay/tcga2hf/blob/main/src/tcga2hf/genomic.py
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  ## Loading
142