v1
Functions and classes related to table specifications V1 (see https://fractal-analytics-platform.github.io/fractal-tasks-core/tables).
_write_elem_with_overwrite(group, key, elem, *, overwrite, logger=None)
¶
Wrap anndata.experimental.write_elem
, to include overwrite
parameter.
See docs for the original function here.
This function writes elem
to the sub-group key
of group
. The
overwrite
-related expected behavior is:
- if the sub-group does not exist, create it (independently on
overwrite
); - if the sub-group already exists and
overwrite=True
, overwrite the sub-group; - if the sub-group already exists and
overwrite=False
, fail.
Note that this version of the wrapper does not include the original
dataset_kwargs
parameter.
PARAMETER | DESCRIPTION |
---|---|
group |
The group to write to.
TYPE:
|
key |
The key to write to in the group. Note that absolute paths will be written from the root.
TYPE:
|
elem |
The element to write. Typically an in-memory object, e.g. an AnnData, pandas dataframe, scipy sparse matrix, etc.
TYPE:
|
overwrite |
If
TYPE:
|
logger |
The logger to use (if unset, use |
RAISES | DESCRIPTION |
---|---|
OverwriteNotAllowedError
|
If |
Source code in fractal_tasks_core/tables/v1.py
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 |
|
_write_table_v1(image_group, table_name, table, overwrite=False, table_type=None, table_attrs=None)
¶
Handle multiple options for writing an AnnData table to a zarr group.
- Create the
tables
group, if needed. - If
overwrite=False
, check that the new table does not exist (either in zarr attributes or as a zarr sub-group). - Call the
_write_elem_with_overwrite
wrapper with the appropriateoverwrite
parameter. - Update the
tables
attribute of the image group. - Validate
table_type
andtable_attrs
according to Fractal table specifications, and raise errors/warnings if needed; then set the appropriate attributes in the new-table Zarr group.
PARAMETER | DESCRIPTION |
---|---|
image_group |
The group to write to.
TYPE:
|
table_name |
The name of the new table.
TYPE:
|
table |
The AnnData table to write.
TYPE:
|
overwrite |
If
TYPE:
|
table_type |
|
table_attrs |
If set, overwrite table_group attributes with table_attrs key/value
pairs. If |
RETURNS | DESCRIPTION |
---|---|
group
|
Zarr group of the new table. |
Source code in fractal_tasks_core/tables/v1.py
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 |
|
get_tables_list_v1(zarr_url, table_type=None, strict=False)
¶
Find the list of tables in the Zarr file
Optionally match a table type and only return the names of those tables.
PARAMETER | DESCRIPTION |
---|---|
zarr_url |
Path to the OME-Zarr image
TYPE:
|
table_type |
The type of table to look for. Special handling for "ROIs" => matches both "roi_table" & "masking_roi_table".
TYPE:
|
strict |
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
List of the names of available tables |
Source code in fractal_tasks_core/tables/v1.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|