Perturbation effect adjustment function with tf relationships boolean logic
Adjust the mean of the perturbation effect based on the enrichment score and the provided binary / boolean or unary relationships between TFs. For each gene, the mean of the TF-gene pair’s perturbation effect will be adjusted if the TF is bound to the gene and all of the Relations associated with the TF are satisfied (ie they evaluate to True). These relations could be unary conditions or Ands or Ors between TFs. A TF being bound corresponds to a true value, which means And(4, 5) would be satisfied is both TF 4 and TF 5 are bound to the gene in question. The adjustment will be a random value not exceeding the maximum adjustment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
binding_enrichment_data |
Tensor
|
A tensor of enrichment scores for each gene with dimensions [n_genes, n_tfs, 3] where the entries in the third dimension are a matrix with columns [label, enrichment, pvalue]. |
required |
bound_mean |
float
|
The mean for bound genes. |
required |
unbound_mean |
float
|
The mean for unbound genes. |
required |
max_adjustment |
float
|
The maximum adjustment to the base mean based on enrichment. |
required |
tf_relationships |
dict[int, list[Relation]]
|
A dictionary where the keys are TF indices and the values are lists of Relation objects that represent the conditions that must be met for the mean of the perturbation effect associated with the TF-gene pair to be adjusted. |
required |
Returns:
Type | Description |
---|---|
torch.Tensor
|
Adjusted mean as a tensor. |
Raises:
Type | Description |
---|---|
ValueError
|
If tf_relationships is not a dictionary between ints and lists of Relations |
ValueError
|
If the tf_relationships dict does not have the same number of TFs as the binding_data tensor passed into the function |
ValueError
|
If the tf_relationships dict has any TFs in the values that are not also in the keys or any key or value TFs that are out of bounds for the binding_data tensor |
Source code in yeastdnnexplorer/probability_models/generate_data.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|