Skip to content

Commit 84ea888

Browse files
authored
Merge pull request #134 from VirtualFlyBrain/kurmangaliyev-2019-samples
Kurmangaliyev 2019: samples and clusters
2 parents 6338b9d + b49c9f3 commit 84ea888

9 files changed

Lines changed: 642 additions & 9 deletions

File tree

‎id_registry/registry.json‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"counter": 3683,
2+
"counter": 3690,
33
"entries": {
44
"Assay::E-MTAB-10519:FCA10_Male_head_adult_5dWT_Luo_sample4_S1": {
55
"accession": null,
@@ -1765,6 +1765,20 @@
17651765
"label": "w1118_30d_r1",
17661766
"natural_key": "GSE107451:GSM2867577"
17671767
},
1768+
"Assay::GSE126139:GSM3592259": {
1769+
"accession": "GSM3592259",
1770+
"entity_type": "Assay",
1771+
"id": "VFBseq_00003686",
1772+
"label": "T4/T5 24h APF",
1773+
"natural_key": "GSE126139:GSM3592259"
1774+
},
1775+
"Assay::GSE126139:GSM3592260": {
1776+
"accession": "GSM3592260",
1777+
"entity_type": "Assay",
1778+
"id": "VFBseq_00003688",
1779+
"label": "T4/T5 48h APF",
1780+
"natural_key": "GSE126139:GSM3592260"
1781+
},
17681782
"Assay::GSE134722:GSM3964166": {
17691783
"accession": "GSM3964166",
17701784
"entity_type": "Assay",
@@ -19223,6 +19237,20 @@
1922319237
"label": "Davie 2018 sub-clustering of res-2.0 cluster 64 (octopaminergic-tyraminergic neurons)",
1922419238
"natural_key": "GSE107451:sub64"
1922519239
},
19240+
"Clustering::GSE126139:24h": {
19241+
"accession": null,
19242+
"entity_type": "Clustering",
19243+
"id": "VFBseq_00003689",
19244+
"label": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
19245+
"natural_key": "GSE126139:24h"
19246+
},
19247+
"Clustering::GSE126139:48h": {
19248+
"accession": null,
19249+
"entity_type": "Clustering",
19250+
"id": "VFBseq_00003690",
19251+
"label": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
19252+
"natural_key": "GSE126139:48h"
19253+
},
1922619254
"Clustering::GSE134722:fed": {
1922719255
"accession": null,
1922819256
"entity_type": "Clustering",
@@ -19559,6 +19587,13 @@
1955919587
"label": "TAPIN-seq data from Davis (2020)",
1956019588
"natural_key": "GSE116969"
1956119589
},
19590+
"Dataset::GSE126139": {
19591+
"accession": "GSE126139",
19592+
"entity_type": "Dataset",
19593+
"id": "VFBseq_00003684",
19594+
"label": "Modular transcriptional programs separately define axon and dendrite connectivity",
19595+
"natural_key": "GSE126139"
19596+
},
1956219597
"Dataset::GSE134722": {
1956319598
"accession": "GSE134722",
1956419599
"entity_type": "Dataset",
@@ -22849,6 +22884,20 @@
2284922884
"label": "lLNv_d1_rep2",
2285022885
"natural_key": "GSE116969:lLNv_d1_rep2"
2285122886
},
22887+
"Sample::GSE126139:24h": {
22888+
"accession": null,
22889+
"entity_type": "Sample",
22890+
"id": "VFBseq_00003685",
22891+
"label": "24h",
22892+
"natural_key": "GSE126139:24h"
22893+
},
22894+
"Sample::GSE126139:48h": {
22895+
"accession": null,
22896+
"entity_type": "Sample",
22897+
"id": "VFBseq_00003687",
22898+
"label": "48h",
22899+
"natural_key": "GSE126139:48h"
22900+
},
2285222901
"Sample::GSE134722:Normal_sample_1": {
2285322902
"accession": null,
2285422903
"entity_type": "Sample",
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env python
2+
"""Kurmangaliyev 2019: cell_type_annotations.json from the authors' per-stage clusters.
3+
4+
The authors analysed the 24 h and 48 h APF libraries separately and assigned each
5+
stage's eight clusters to the subtypes T4a-d / T5a-d. GEO (GSE126139) has one per-cell
6+
file per library, GSM*_clust24.txt / GSM*_clust48.txt (barcode<TAB>cluster: the subtype,
7+
or "filtered" for cells removed by the authors' quality control). A cell's stage (its
8+
library) and subtype give its author cluster: one entry per stage x subtype.
9+
10+
label <stage>_<subtype> (e.g. 24h_T4a)
11+
type "<subtype> neuron" (the type name in Hörmann 2020's type mappings)
12+
clustering the stage (24h, 48h)
13+
source_cluster_id the subtype label (the authors give the per-stage clusters no numbers)
14+
cells_by_library cells per GEO library (GSM title)
15+
16+
Also writes .cache/kurmangaliyev_2019/memberships.tsv.gz (cell<TAB>cluster, cells named
17+
<stage>_<10x barcode>, as in the combined matrix of combine_matrices.py) for the
18+
expression build.
19+
20+
Usage:
21+
uv run python projects/kurmangaliyev_2019/build_clusters.py
22+
"""
23+
24+
from __future__ import annotations
25+
26+
import gzip
27+
import json
28+
import re
29+
from pathlib import Path
30+
31+
import yaml
32+
33+
PROJ = Path(__file__).resolve().parent
34+
REPO_ROOT = PROJ.parents[1]
35+
CACHE = REPO_ROOT / ".cache" / "kurmangaliyev_2019"
36+
GEO = CACHE / "geo"
37+
GEO_URL = "https://ftp.ncbi.nlm.nih.gov/geo/samples/GSM3592nnn/{gsm}/suppl/{file}"
38+
# stage -> (GSM, GEO library title, per-cell cluster file)
39+
LIBRARIES = {
40+
"24h": ("GSM3592259", "T4/T5 24h APF", "GSM3592259_clust24.txt.gz"),
41+
"48h": ("GSM3592260", "T4/T5 48h APF", "GSM3592260_clust48.txt.gz"),
42+
}
43+
44+
45+
def main() -> None:
46+
cfg = yaml.safe_load((PROJ / "config.yaml").read_text())
47+
names = {c["id"]: c["name"] for c in cfg["sample_build"]["clusterings"]}
48+
anns, members = [], []
49+
for stage, (gsm, title, fname) in LIBRARIES.items():
50+
path = GEO / fname
51+
if not path.exists():
52+
raise SystemExit(f"missing {path}: download {GEO_URL.format(gsm=gsm, file=fname)}")
53+
cells: dict[str, list[str]] = {}
54+
with gzip.open(path, "rt") as fh:
55+
assert fh.readline().split() == ["barcode", "cluster"]
56+
for line in fh:
57+
barcode, cluster = line.split()
58+
if cluster == "filtered":
59+
continue
60+
assert re.fullmatch(r"T[45][a-d]", cluster), cluster
61+
cells.setdefault(cluster, []).append(f"{stage}_{barcode}-1")
62+
assert len(cells) == 8, (stage, sorted(cells))
63+
for subtype in sorted(cells):
64+
label = f"{stage}_{subtype}"
65+
anns.append({
66+
"label": label,
67+
"type": f"{subtype} neuron",
68+
"clustering": stage,
69+
"clustering_name": names[stage],
70+
"source_cluster_id": subtype,
71+
"cell_number": len(cells[subtype]),
72+
"cells_by_library": {title: len(cells[subtype])},
73+
})
74+
members += [(c, label) for c in cells[subtype]]
75+
with gzip.open(CACHE / "memberships.tsv.gz", "wt") as fh:
76+
fh.write("barcode\tcluster\n")
77+
for c, label in members:
78+
fh.write(f"{c}\t{label}\n")
79+
out = {
80+
"source": {"doi": cfg["source"]["doi"], "title": cfg["source"]["title"]},
81+
"dataset": {
82+
"accession": cfg["dataset"]["accession"],
83+
"label_source": "the authors' per-cell cluster files on GEO (GSM3592259_clust24.txt, "
84+
"GSM3592260_clust48.txt: each cell's subtype, per stage)",
85+
"label_level": "author cluster (one per stage x subtype)",
86+
"validate_against": "paper (per-stage clusters assigned to the eight subtypes)",
87+
},
88+
"annotations": anns,
89+
}
90+
(PROJ / "cell_type_annotations.json").write_text(json.dumps(out, indent=2, ensure_ascii=False) + "\n")
91+
print(f"wrote {len(anns)} clusters, {len(members)} cells")
92+
93+
94+
if __name__ == "__main__":
95+
main()
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
{
2+
"source": {
3+
"doi": "10.7554/eLife.50822",
4+
"title": "Modular transcriptional programs separately define axon and dendrite connectivity"
5+
},
6+
"dataset": {
7+
"accession": "GSE126139",
8+
"label_source": "the authors' per-cell cluster files on GEO (GSM3592259_clust24.txt, GSM3592260_clust48.txt: each cell's subtype, per stage)",
9+
"label_level": "author cluster (one per stage x subtype)",
10+
"validate_against": "paper (per-stage clusters assigned to the eight subtypes)"
11+
},
12+
"annotations": [
13+
{
14+
"label": "24h_T4a",
15+
"type": "T4a neuron",
16+
"clustering": "24h",
17+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
18+
"source_cluster_id": "T4a",
19+
"cell_number": 502,
20+
"cells_by_library": {
21+
"T4/T5 24h APF": 502
22+
}
23+
},
24+
{
25+
"label": "24h_T4b",
26+
"type": "T4b neuron",
27+
"clustering": "24h",
28+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
29+
"source_cluster_id": "T4b",
30+
"cell_number": 425,
31+
"cells_by_library": {
32+
"T4/T5 24h APF": 425
33+
}
34+
},
35+
{
36+
"label": "24h_T4c",
37+
"type": "T4c neuron",
38+
"clustering": "24h",
39+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
40+
"source_cluster_id": "T4c",
41+
"cell_number": 318,
42+
"cells_by_library": {
43+
"T4/T5 24h APF": 318
44+
}
45+
},
46+
{
47+
"label": "24h_T4d",
48+
"type": "T4d neuron",
49+
"clustering": "24h",
50+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
51+
"source_cluster_id": "T4d",
52+
"cell_number": 409,
53+
"cells_by_library": {
54+
"T4/T5 24h APF": 409
55+
}
56+
},
57+
{
58+
"label": "24h_T5a",
59+
"type": "T5a neuron",
60+
"clustering": "24h",
61+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
62+
"source_cluster_id": "T5a",
63+
"cell_number": 382,
64+
"cells_by_library": {
65+
"T4/T5 24h APF": 382
66+
}
67+
},
68+
{
69+
"label": "24h_T5b",
70+
"type": "T5b neuron",
71+
"clustering": "24h",
72+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
73+
"source_cluster_id": "T5b",
74+
"cell_number": 383,
75+
"cells_by_library": {
76+
"T4/T5 24h APF": 383
77+
}
78+
},
79+
{
80+
"label": "24h_T5c",
81+
"type": "T5c neuron",
82+
"clustering": "24h",
83+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
84+
"source_cluster_id": "T5c",
85+
"cell_number": 318,
86+
"cells_by_library": {
87+
"T4/T5 24h APF": 318
88+
}
89+
},
90+
{
91+
"label": "24h_T5d",
92+
"type": "T5d neuron",
93+
"clustering": "24h",
94+
"clustering_name": "Kurmangaliyev 2019 24 h APF T4/T5 clusters",
95+
"source_cluster_id": "T5d",
96+
"cell_number": 334,
97+
"cells_by_library": {
98+
"T4/T5 24h APF": 334
99+
}
100+
},
101+
{
102+
"label": "48h_T4a",
103+
"type": "T4a neuron",
104+
"clustering": "48h",
105+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
106+
"source_cluster_id": "T4a",
107+
"cell_number": 474,
108+
"cells_by_library": {
109+
"T4/T5 48h APF": 474
110+
}
111+
},
112+
{
113+
"label": "48h_T4b",
114+
"type": "T4b neuron",
115+
"clustering": "48h",
116+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
117+
"source_cluster_id": "T4b",
118+
"cell_number": 521,
119+
"cells_by_library": {
120+
"T4/T5 48h APF": 521
121+
}
122+
},
123+
{
124+
"label": "48h_T4c",
125+
"type": "T4c neuron",
126+
"clustering": "48h",
127+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
128+
"source_cluster_id": "T4c",
129+
"cell_number": 398,
130+
"cells_by_library": {
131+
"T4/T5 48h APF": 398
132+
}
133+
},
134+
{
135+
"label": "48h_T4d",
136+
"type": "T4d neuron",
137+
"clustering": "48h",
138+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
139+
"source_cluster_id": "T4d",
140+
"cell_number": 454,
141+
"cells_by_library": {
142+
"T4/T5 48h APF": 454
143+
}
144+
},
145+
{
146+
"label": "48h_T5a",
147+
"type": "T5a neuron",
148+
"clustering": "48h",
149+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
150+
"source_cluster_id": "T5a",
151+
"cell_number": 432,
152+
"cells_by_library": {
153+
"T4/T5 48h APF": 432
154+
}
155+
},
156+
{
157+
"label": "48h_T5b",
158+
"type": "T5b neuron",
159+
"clustering": "48h",
160+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
161+
"source_cluster_id": "T5b",
162+
"cell_number": 435,
163+
"cells_by_library": {
164+
"T4/T5 48h APF": 435
165+
}
166+
},
167+
{
168+
"label": "48h_T5c",
169+
"type": "T5c neuron",
170+
"clustering": "48h",
171+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
172+
"source_cluster_id": "T5c",
173+
"cell_number": 407,
174+
"cells_by_library": {
175+
"T4/T5 48h APF": 407
176+
}
177+
},
178+
{
179+
"label": "48h_T5d",
180+
"type": "T5d neuron",
181+
"clustering": "48h",
182+
"clustering_name": "Kurmangaliyev 2019 48 h APF T4/T5 clusters",
183+
"source_cluster_id": "T5d",
184+
"cell_number": 439,
185+
"cells_by_library": {
186+
"T4/T5 48h APF": 439
187+
}
188+
}
189+
]
190+
}

0 commit comments

Comments
 (0)