Perturbation effect adjustment function with tf relationships
Adjust the mean of the perturbation effect based on the enrichment score and the provided 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 related TFs are also bound to the gene. 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[int]]
|
A dictionary where the keys are the indices of the TFs and the values are lists of indices of other TFs that are related to the key TF. |
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 ints |
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
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
|