gabrielaltay commited on
Commit
12d1fbe
·
verified ·
1 Parent(s): 0523eb7

row groups + page index for HF Data Studio; gdc_portal_url; strict pydantic models; deduplicated dataset card

Browse files
README.md CHANGED
@@ -25,25 +25,23 @@ configs:
25
 
26
  # TCGA Patients (Open Access)
27
 
28
- **Open-access** TCGA patient data from the NCI Genomic Data Commons (GDC).
29
- One HuggingFace subset per TCGA project; one row per patient.
 
30
 
31
  - **Projects included:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`
32
- - **Generated:** 2026-05-04 05:19:32 UTC
33
- - **Source:** NCI GDC `/cases` endpoint, open-access tier only.
34
  - **Schema:** derived from the [GDC Data Dictionary][gdc-dict]; the live
35
- dictionary snapshot the GDC was serving when the data was fetched is
36
- hashed into each project's `gdc_status.json` (and stored alongside the raw
37
- data on the producer side, not shipped with the parquet).
38
  - **GDC data release:** Data Release 45.0 - December 04, 2025
39
 
40
- ## GDC data model primer
41
 
42
- A short orientation for downstream users. The GDC organizes everything around a
43
- **case** (a single patient) with a hierarchy of physical biospecimens beneath
44
- it, plus assay-derived data files attached to those biospecimens.
45
-
46
- **Biospecimen hierarchy** (per GDC's [data dictionary][gdc-dict]):
47
 
48
  ```
49
  case one patient (TCGA-XX-1234)
@@ -54,36 +52,39 @@ case one patient (TCGA-XX-1234)
54
  └── aliquot a vial of that analyte handed off for sequencing
55
  ```
56
 
57
- We preserve this hierarchy verbatim each `samples[i]` carries
58
- `portions[j].analytes[k].aliquots[m]` exactly as the GDC returns it. No
59
- flattening, no field hoisting; portion- and analyte-level fields like
60
- `is_ffpe`, `a260_a280_ratio`, and `normal_tumor_genotype_snp_match` are
61
- preserved. The `TcgaHfPatient` reference implementation (below) provides
62
- flat-aliquot convenience views over this tree.
63
-
64
- **Top-level molecular columns** are named `samples_<gdc_data_type_snake_case>`
65
- (e.g. `samples_masked_somatic_mutation`, `samples_gene_expression_quantification`).
66
- Each entry carries FK fields back to the patient's `samples[].portions[].analytes[].aliquots[]`
67
- so cross-modality joins are local to the row.
68
-
69
- **Timeline anchor is uniform per the GDC dictionary.** Every `days_to_*` field
70
- is documented as days from the case's `index_date` (a top-level field on each
71
- row; for TCGA usually `"Diagnosis"`). `TcgaHfPatient.timeline()` returns every
72
- dated event for the patient on this single anchor — clinical (consent →
73
- diagnosis treatments follow-ups lost-to-follow-up death) plus
74
- biospecimen (`sample_procurement` from `days_to_sample_procurement`,
75
- `bcr_receipt` from `days_to_collection`).
76
-
77
- For some TCGA cases `days_to_collection` exceeds `days_to_death`. We don't
78
- attempt to reinterpret these we surface the count via
79
- `TcgaHfPatient.consistency_check()` as `bcr_receipts_after_death` and leave
80
- interpretation to the consumer.
81
-
82
- **Reference Python implementation:** the `tcga2hf` package on GitHub ships a
83
- fully-typed pydantic `TcgaHfPatient` model that mirrors this schema and adds
84
- convenience joins (tumor/normal pairs, mutations-by-gene, expression-by-gene,
85
- longitudinal timeline). Useful both as a loader and as documentation for what
86
- the data means.
 
 
 
87
 
88
  ```python
89
  import pyarrow.parquet as pq
@@ -93,7 +94,8 @@ t = pq.read_table("TCGA-CHOL/train.parquet")
93
  patients = [TcgaHfPatient.model_validate(r) for r in t.to_pylist()]
94
  ```
95
 
96
- **Authoritative GDC references:**
 
97
  - [Data dictionary][gdc-dict] (every entity + field definition)
98
  - [Biospecimen Encyclopedia](https://docs.gdc.cancer.gov/Encyclopedia/pages/Biospecimen/)
99
  - [MAF format spec](https://docs.gdc.cancer.gov/Data/File_Formats/MAF_Format/)
@@ -101,8 +103,6 @@ patients = [TcgaHfPatient.model_validate(r) for r in t.to_pylist()]
101
  - [Sample Type codes](https://gdc.cancer.gov/resources-tcga-users/tcga-code-tables/sample-type-codes)
102
  - [TCGA Barcode reference](https://docs.gdc.cancer.gov/Encyclopedia/pages/TCGA_Barcode/)
103
 
104
- [gdc-dict]: https://docs.gdc.cancer.gov/Data_Dictionary/
105
-
106
  ## License & redistribution
107
 
108
  Per the [NCI GDC Data Analysis Policy](https://gdc.cancer.gov/analyze-data/data-analysis-policies):
@@ -143,9 +143,9 @@ Suggested citations:
143
  - The Cancer Genome Atlas Research Network. https://www.cancer.gov/tcga
144
  - NCI Genomic Data Commons. https://gdc.cancer.gov
145
 
146
- References:
147
  [GDC Policies](https://gdc.cancer.gov/about-gdc/gdc-policies),
148
- [GDC Encyclopedia — Controlled Access][controlled] (defines what is *not* here),
149
  [NIH Genomic Data Sharing Policy](https://sharing.nih.gov/genomic-data-sharing).
150
 
151
  [controlled]: https://docs.gdc.cancer.gov/Encyclopedia/pages/Controlled_Access/
@@ -154,3 +154,6 @@ References:
154
 
155
  Prototype dataset. Schema, included projects, and column coverage are still
156
  evolving. Re-derive from the GDC for any analysis where freshness matters.
 
 
 
 
25
 
26
  # TCGA Patients (Open Access)
27
 
28
+ Open-access patient data from The Cancer Genome Atlas (TCGA), pulled from the
29
+ 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-04 23:16:21 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
37
+ each project's `gdc_status.json` for provenance.
 
38
  - **GDC data release:** Data Release 45.0 - December 04, 2025
39
 
40
+ ## Data model
41
 
42
+ Closely follows the GDC data model see the [GDC Data Dictionary][gdc-dict]
43
+ for the canonical entity-by-entity definitions. Each row is one `case` (one
44
+ patient) with the full biospecimen subtree:
 
 
45
 
46
  ```
47
  case one patient (TCGA-XX-1234)
 
52
  └── aliquot a vial of that analyte handed off for sequencing
53
  ```
54
 
55
+ Every `days_to_*` field anchors to the case's `index_date` (TCGA: almost
56
+ always `"Diagnosis"`), per the dictionary, so clinical and biospecimen events
57
+ share a single timeline.
58
+
59
+ ### Where this dataset deviates from the GDC
60
+
61
+ The few places this row layout differs from a direct mapping of the GDC `case`
62
+ tree:
63
+
64
+ - **Top-level convenience columns.** Each row carries `gdc_portal_url`
65
+ (templated link to the patient's GDC Data Portal page) and
66
+ `samples_<gdc_data_type_snake_case>` molecular vectors (e.g.
67
+ `samples_masked_somatic_mutation`,
68
+ `samples_gene_expression_quantification`). These let consumers
69
+ column-project just the modalities they need; each entry carries foreign
70
+ keys (FKs) back to `samples[].portions[].analytes[].aliquots[]`.
71
+ - **Resolved sample FKs on Mutation Annotation Format (MAF) rows.** The GDC
72
+ ships MAF variants with aliquot UUIDs in `Tumor_Sample_UUID` /
73
+ `Matched_Norm_Sample_UUID`; we additionally resolve those to
74
+ `tumor_sample_id` / `matched_normal_sample_id` so consumers can join
75
+ straight to `samples[]`.
76
+ - **Lifted expression QC counts.** Each Gene Expression Quantification
77
+ record has the STAR per-feature quality-control counts `N_unmapped`,
78
+ `N_multimapping`, `N_noFeature`, `N_ambiguous` lifted from the source
79
+ Tab-Separated Values (TSV) file onto the row as scalar fields. The
80
+ `stranded_first` / `stranded_second` columns are dropped TCGA used
81
+ unstranded library prep, so they're zero or unused.
82
+
83
+ ## Loading
84
+
85
+ The [`tcga2hf` package][repo] ships a typed `TcgaHfPatient` pydantic model
86
+ that mirrors this schema and adds convenience joins (tumor/normal pairs,
87
+ mutations-by-gene, expression-by-gene, longitudinal timeline).
88
 
89
  ```python
90
  import pyarrow.parquet as pq
 
94
  patients = [TcgaHfPatient.model_validate(r) for r in t.to_pylist()]
95
  ```
96
 
97
+ ## GDC references
98
+
99
  - [Data dictionary][gdc-dict] (every entity + field definition)
100
  - [Biospecimen Encyclopedia](https://docs.gdc.cancer.gov/Encyclopedia/pages/Biospecimen/)
101
  - [MAF format spec](https://docs.gdc.cancer.gov/Data/File_Formats/MAF_Format/)
 
103
  - [Sample Type codes](https://gdc.cancer.gov/resources-tcga-users/tcga-code-tables/sample-type-codes)
104
  - [TCGA Barcode reference](https://docs.gdc.cancer.gov/Encyclopedia/pages/TCGA_Barcode/)
105
 
 
 
106
  ## License & redistribution
107
 
108
  Per the [NCI GDC Data Analysis Policy](https://gdc.cancer.gov/analyze-data/data-analysis-policies):
 
143
  - The Cancer Genome Atlas Research Network. https://www.cancer.gov/tcga
144
  - NCI Genomic Data Commons. https://gdc.cancer.gov
145
 
146
+ Policy references:
147
  [GDC Policies](https://gdc.cancer.gov/about-gdc/gdc-policies),
148
+ [GDC Encyclopedia — Controlled Access][controlled] (defines what is *not* in this dataset),
149
  [NIH Genomic Data Sharing Policy](https://sharing.nih.gov/genomic-data-sharing).
150
 
151
  [controlled]: https://docs.gdc.cancer.gov/Encyclopedia/pages/Controlled_Access/
 
154
 
155
  Prototype dataset. Schema, included projects, and column coverage are still
156
  evolving. Re-derive from the GDC for any analysis where freshness matters.
157
+
158
+ [gdc-dict]: https://docs.gdc.cancer.gov/Data_Dictionary/
159
+ [repo]: https://github.com/galtay/tcga2hf
TCGA-CHOL/train.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7aabe3f746dfc5d79f895443e98ad06bad6955119ed8ea3c6608f5ffd749f7a1
3
- size 51390111
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:945427a826b73a37d4d5cd86ad7ed07ad545e46405c46bd977859a15a93949a9
3
+ size 52136189
TCGA-DLBC/train.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:99dc3160cd608ebfb06b266d95be670301e9fd13cc461a7c5fc75d22b777e67d
3
- size 57869184
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36f5ab3ef2757b7c1d1144734ce403b58b7d98d8e9460bf16ba9df18818aea73
3
+ size 58096996
TCGA-LUAD/train.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:84c5a93057d09405d95a11a442b4ba00ba444a6c1b22e68db1bdb65fe2fd6e46
3
- size 788972385
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11426e73015d68d3eb0f2b4245308470edc35c0aeb4f4974d5c70ccabbf30714
3
+ size 784683064