Fragments
chromatinhd.loaders.fragments.Fragments
Basic loader for fragments. This requires either regionxcell_indptr
(for a Fragments) or regionxcell_fragmentixs_indptr
(for a FragmentsView) to be present.
Example
loader = Fragments(fragments, cellxregion_batch_size=1000)
minibatch = Minibatch(cells_oi=np.arange(100), regions_oi=np.arange(100))
data = loader.load(minibatch)
data.coordinates
Source code in src/chromatinhd/loaders/fragments.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 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 |
|
__init__(fragments, cellxregion_batch_size, n_fragment_per_cellxregion=None, buffer_size_multiplier=10, provide_libsize=False, provide_multiplets=True)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fragments
|
Union[Fragments, FragmentsView]
|
Fragments object |
required |
cellxregion_batch_size
|
int
|
maximum number of cell x region combinations that will be loaded |
required |
n_fragment_per_cellxregion
|
int
|
estimated number of the number of fragments per cell x region combination, used for preallocation |
None
|
Source code in src/chromatinhd/loaders/fragments.py
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 |
|
load(minibatch)
Load a minibatch of fragments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minibatch
|
Minibatch
|
Minibatch object |
required |
Returns:
Type | Description |
---|---|
FragmentsResult
|
The loaded fragments |
Source code in src/chromatinhd/loaders/fragments.py
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 |
|
chromatinhd.loaders.fragments.Cuts
Bases: Fragments
Source code in src/chromatinhd/loaders/fragments.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
load(minibatch)
Load a minibatch of cuts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minibatch
|
Minibatch
|
Minibatch object |
required |
Returns:
Type | Description |
---|---|
CutsResult
|
The loaded cut sites |
Source code in src/chromatinhd/loaders/fragments.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
chromatinhd.loaders.fragments.FragmentsResult
dataclass
Source code in src/chromatinhd/loaders/fragments.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 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 |
|
cells_oi: np.ndarray = None
class-attribute
instance-attribute
Cells of interest
coordinates: torch.Tensor
instance-attribute
Coordinates of the left and right cut site for each fragment
doublet_idx: torch.Tensor = None
class-attribute
instance-attribute
Indices of doublets
libsize: torch.Tensor = None
class-attribute
instance-attribute
Library size for each cell
local_cellxregion_ix: torch.Tensor
instance-attribute
Local cell x region index
localcellxregion_ix: torch.Tensor = None
class-attribute
instance-attribute
Local cell x region index, in the same order as cells_oi and regions_oi
n_fragments: int
instance-attribute
Number of fragments
n_total_regions: int = None
class-attribute
instance-attribute
Total number of regions
regionmapping: torch.Tensor = None
class-attribute
instance-attribute
Mapping from local cell x region index to region index
regions_oi: np.ndarray = None
class-attribute
instance-attribute
Regions of interest
window: np.ndarray = None
class-attribute
instance-attribute
Window of the region
chromatinhd.loaders.fragments.CutsResult
dataclass
Source code in src/chromatinhd/loaders/fragments.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|