Datasets:
ark_example.py docs
Browse files- ark_example.py +23 -33
ark_example.py
CHANGED
@@ -14,7 +14,23 @@
|
|
14 |
|
15 |
"""
|
16 |
This dataset contains example data for running through the multiplexed imaging data pipeline in
|
17 |
-
Ark Analysis: https://github.com/angelolab/ark-analysis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
"""
|
19 |
|
20 |
import datasets
|
@@ -74,22 +90,6 @@ _URL_DATASET_CONFIGS = {
|
|
74 |
}
|
75 |
|
76 |
|
77 |
-
"""
|
78 |
-
Dataset Fov renaming:
|
79 |
-
|
80 |
-
TMA2_R8C3 -> fov0
|
81 |
-
TMA6_R4C5 -> fov1
|
82 |
-
TMA7_R5C4 -> fov2
|
83 |
-
TMA10_R7C3 -> fov3
|
84 |
-
TMA11_R9C6 -> fov4
|
85 |
-
TMA13_R8C5 -> fov5
|
86 |
-
TMA17_R9C2 -> fov6
|
87 |
-
TMA18_R9C2 -> fov7
|
88 |
-
TMA21_R2C5 -> fov8
|
89 |
-
TMA21_R12C6 -> fov9
|
90 |
-
TMA24_R9C1 -> fov10
|
91 |
-
"""
|
92 |
-
|
93 |
# Note: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
94 |
class ArkExample(datasets.GeneratorBasedBuilder):
|
95 |
"""The Dataset consists of 11 FOVs"""
|
@@ -109,17 +109,17 @@ class ArkExample(datasets.GeneratorBasedBuilder):
|
|
109 |
datasets.BuilderConfig(
|
110 |
name="segment_image_data",
|
111 |
version=VERSION,
|
112 |
-
description="This configuration contains data used by notebook 1
|
113 |
),
|
114 |
datasets.BuilderConfig(
|
115 |
name="cluster_pixels",
|
116 |
version=VERSION,
|
117 |
-
description="This configuration contains data used by notebook 2
|
118 |
),
|
119 |
datasets.BuilderConfig(
|
120 |
name="cluster_cells",
|
121 |
version=VERSION,
|
122 |
-
description="This configuration contains data used by notebook 3
|
123 |
),
|
124 |
datasets.BuilderConfig(
|
125 |
name="post_clustering",
|
@@ -137,15 +137,10 @@ class ArkExample(datasets.GeneratorBasedBuilder):
|
|
137 |
"post_clustering",
|
138 |
]:
|
139 |
features = datasets.Features(
|
140 |
-
{
|
141 |
-
f: datasets.Value("string")
|
142 |
-
for f in _URL_DATASET_CONFIGS[self.config.name].keys()
|
143 |
-
}
|
144 |
)
|
145 |
else:
|
146 |
-
ValueError(
|
147 |
-
f"Dataset name is incorrect, options include {list(_URL_DATASET_CONFIGS.keys())}"
|
148 |
-
)
|
149 |
return datasets.DatasetInfo(
|
150 |
# This is the description that will appear on the datasets page.
|
151 |
description=_DESCRIPTION,
|
@@ -163,12 +158,7 @@ class ArkExample(datasets.GeneratorBasedBuilder):
|
|
163 |
)
|
164 |
|
165 |
def _split_generators(self, dl_manager):
|
166 |
-
#
|
167 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
168 |
-
|
169 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
170 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
171 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
172 |
urls = _URL_DATASET_CONFIGS[self.config.name]
|
173 |
data_dirs = {}
|
174 |
for data_name, url in urls.items():
|
|
|
14 |
|
15 |
"""
|
16 |
This dataset contains example data for running through the multiplexed imaging data pipeline in
|
17 |
+
Ark Analysis: https://github.com/angelolab/ark-analysis.
|
18 |
+
|
19 |
+
|
20 |
+
Dataset Fov renaming:
|
21 |
+
|
22 |
+
TMA2_R8C3 -> fov0
|
23 |
+
TMA6_R4C5 -> fov1
|
24 |
+
TMA7_R5C4 -> fov2
|
25 |
+
TMA10_R7C3 -> fov3
|
26 |
+
TMA11_R9C6 -> fov4
|
27 |
+
TMA13_R8C5 -> fov5
|
28 |
+
TMA17_R9C2 -> fov6
|
29 |
+
TMA18_R9C2 -> fov7
|
30 |
+
TMA21_R2C5 -> fov8
|
31 |
+
TMA21_R12C6 -> fov9
|
32 |
+
TMA24_R9C1 -> fov10
|
33 |
+
|
34 |
"""
|
35 |
|
36 |
import datasets
|
|
|
90 |
}
|
91 |
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# Note: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
94 |
class ArkExample(datasets.GeneratorBasedBuilder):
|
95 |
"""The Dataset consists of 11 FOVs"""
|
|
|
109 |
datasets.BuilderConfig(
|
110 |
name="segment_image_data",
|
111 |
version=VERSION,
|
112 |
+
description="This configuration contains data used by notebook 1 - Segment Image Data.",
|
113 |
),
|
114 |
datasets.BuilderConfig(
|
115 |
name="cluster_pixels",
|
116 |
version=VERSION,
|
117 |
+
description="This configuration contains data used by notebook 2 - Pixel Clustering (Pixie Pipeline #1).",
|
118 |
),
|
119 |
datasets.BuilderConfig(
|
120 |
name="cluster_cells",
|
121 |
version=VERSION,
|
122 |
+
description="This configuration contains data used by notebook 3 - Cell Clustering (Pixie Pipeline #2).",
|
123 |
),
|
124 |
datasets.BuilderConfig(
|
125 |
name="post_clustering",
|
|
|
137 |
"post_clustering",
|
138 |
]:
|
139 |
features = datasets.Features(
|
140 |
+
{f: datasets.Value("string") for f in _URL_DATASET_CONFIGS[self.config.name].keys()}
|
|
|
|
|
|
|
141 |
)
|
142 |
else:
|
143 |
+
ValueError(f"Dataset name is incorrect, options include {list(_URL_DATASET_CONFIGS.keys())}")
|
|
|
|
|
144 |
return datasets.DatasetInfo(
|
145 |
# This is the description that will appear on the datasets page.
|
146 |
description=_DESCRIPTION,
|
|
|
158 |
)
|
159 |
|
160 |
def _split_generators(self, dl_manager):
|
161 |
+
# This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
|
|
|
|
|
|
|
|
|
|
162 |
urls = _URL_DATASET_CONFIGS[self.config.name]
|
163 |
data_dirs = {}
|
164 |
for data_name, url in urls.items():
|