Documentation for Dataset
scdataloader.data.Dataset
dataclass
Bases: Dataset
Dataset class to load a bunch of anndata from a lamin dataset (Collection) in a memory efficient way.
This serves as a wrapper around lamin's mappedCollection to provide more features, mostly, the management of hierarchical labels, the encoding of labels, the management of multiple species
For an example of mappedDataset, see :meth:~lamindb.Dataset.mapped
.
.. note::
A related data loader exists `here
<https://github.com/Genentech/scimilarity>`__.
lamin_dataset (lamindb.Dataset): lamin dataset to load
genedf (pd.Dataframe): dataframe containing the genes to load
organisms (list[str]): list of organisms to load
(for now only validates the the genes map to this organism)
obs (list[str]): list of observations to load from the Collection
clss_to_predict (list[str]): list of observations to encode
join_vars (flag): join variables @see :meth:`~lamindb.Dataset.mapped`.
hierarchical_clss: list of observations to map to a hierarchy using lamin's bionty
Methods:
Name | Description |
---|---|
define_hierarchies |
define_hierarchies is a method to define the hierarchies for the classes to predict |
get_label_weights |
Get all weights for the given label keys. |
get_unseen_mapped_dataset_elements |
get_unseen_mapped_dataset_elements is a wrapper around mappedDataset.get_unseen_mapped_dataset_elements |
define_hierarchies
define_hierarchies is a method to define the hierarchies for the classes to predict
Parameters: |
|
---|
Raises: |
|
---|
Source code in scdataloader/data.py
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 269 270 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 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
get_label_weights
Get all weights for the given label keys.
Source code in scdataloader/data.py
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 |
|
get_unseen_mapped_dataset_elements
get_unseen_mapped_dataset_elements is a wrapper around mappedDataset.get_unseen_mapped_dataset_elements
Parameters: |
|
---|
Returns: |
|
---|
Source code in scdataloader/data.py
182 183 184 185 186 187 188 189 190 191 192 |
|
scdataloader.data.SimpleAnnDataset
Bases: Dataset
SimpleAnnDataset is a simple dataloader for an AnnData dataset. this is to interface nicely with the rest of scDataloader and with your model during inference.
adata (anndata.AnnData): anndata object to use
obs_to_output (list[str]): list of observations to output from anndata.obs
layer (str): layer of the anndata to use
Source code in scdataloader/data.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|