mecfs_bio.build_system.task.susie_stacked_plot_task
A Task and associated helper methods to plot the results and context of SUSIE fine mapping using stacked panels.
Classes:
-
BinOptions– -
HeatmapOptions– -
RegionSelectDefault– -
RegionSelectOverride– -
SusieStackPlotTask–Create a plot to illustrate the results of a SUSIE run on a given locus.
Functions:
-
draw_manhattan_track–Generated with Gemini and then modified.
-
get_array_and_edges_for_ld_heatmap–Use xarray to bin LD data to facilitate creation of an LD heatmap
-
get_region–Determine the plotting region based on RegionSelect options
-
plot_gene_tracks–Generated With Gemini
-
plot_ld_heatmap– -
plot_locus_tracks_matplotlib–Helper function to create the matplotlib plot consisting of stacked panels
-
plot_susie_track–Plot SUSIE pip using a bar graph colored by credible set
Attributes:
-
GENE_INFO_CHROM_COL– -
GENE_INFO_END_COL– -
GENE_INFO_NAME_COL– -
GENE_INFO_START_COL– -
GENE_INFO_STRAND_COL– -
HeatMapPlotMode– -
RegionSelect– -
logger– -
seaborn_rocket_cmap–
HeatmapOptions
Attributes:
-
cmap(str | ListedColormap) – -
heatmap_bin_options(BinOptions | None) – -
mode(HeatMapPlotMode) –
RegionSelectDefault
RegionSelectOverride
SusieStackPlotTask
Bases: Task
Create a plot to illustrate the results of a SUSIE run on a given locus. The resulting plot is a stack of panels showing - LD structure - marginal associations (i.e. Manhattan plot) - SUSIE PIPs - Genes
Methods:
Attributes:
-
deps(list[Task]) – -
gene_info_pipe(DataProcessingPipe) – -
gene_info_task(Task) – -
heatmap_options(HeatmapOptions) – -
meta(Meta) – -
region_mode(RegionSelect) – -
susie_task(Task) –
create
classmethod
create(
asset_id: str,
susie_task: Task,
gene_info_task: Task,
gene_info_pipe: DataProcessingPipe,
region_mode: RegionSelect,
heatmap_options: HeatmapOptions,
)
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
execute
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
draw_manhattan_track
draw_manhattan_track(
fig,
target_gridspec_cell,
colorbar_axis,
gwas_df: DataFrame,
ld2_colors: ndarray,
gwas_pos_col: str,
lead: int,
gwas_mlog10p_col: str,
min_y: int = 2,
break_at: float = 20.0,
max_break_proportion: float = 0.5,
saturation_point: float = 100.0,
significance_threshold: float = 7.8239087,
)
Generated with Gemini and then modified.
Draws a Manhattan plot into the provided GridSpec cell. Automatically handles axis breaking if values exceed 'break_at'.
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
get_array_and_edges_for_ld_heatmap
get_array_and_edges_for_ld_heatmap(
ld_abs: ndarray,
pos: ndarray,
bin_options: BinOptions | None = None,
) -> tuple[np.ndarray, np.ndarray]
Use xarray to bin LD data to facilitate creation of an LD heatmap
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
get_region
Determine the plotting region based on RegionSelect options
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
plot_gene_tracks
plot_gene_tracks(
ax,
gene_df: DataFrame,
start_bp: int,
end_bp: int,
gene_start_col: str,
gene_end_col: str,
gene_name_col: str,
gene_strand_col: str,
font_size: int = 9,
min_dist_between_genes: float = 0.03,
)
Generated With Gemini Plots gene tracks with smart label centering and collision avoidance.
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
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 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
plot_ld_heatmap
plot_ld_heatmap(
ld_np: ndarray,
gwas_df: DataFrame,
options: HeatmapOptions,
ax_ld,
fig,
ld_cax,
gwas_pos_col: str = GWASLAB_POS_COL,
)
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
plot_locus_tracks_matplotlib
plot_locus_tracks_matplotlib(
gwas_df: DataFrame,
susie_cs_df: DataFrame | None,
ld_np: ndarray,
gene_df: DataFrame,
start_bp: int,
end_bp: int,
chrom: int,
heatmap_options: HeatmapOptions,
*,
gwas_pos_col: str = GWASLAB_POS_COL,
gwas_mlog10p_col: str = GWASLAB_MLOG10P_COL,
susie_pos_col: str = GWASLAB_POS_COL,
susie_pip_col: str = PIP_COLUMN,
susie_cs_col: str = CS_COLUMN,
gene_start_col: str = GENE_INFO_START_COL,
gene_end_col: str = GENE_INFO_END_COL,
gene_name_col: str = GENE_INFO_NAME_COL,
gene_strand_col: str = GENE_INFO_STRAND_COL,
max_mlog10p: float = 200,
) -> Figure
Helper function to create the matplotlib plot consisting of stacked panels
Source code in mecfs_bio/build_system/task/susie_stacked_plot_task.py
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 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 | |
plot_susie_track
plot_susie_track(
susie_cs_df: DataFrame | None,
ax_pip,
pip_legend_ax,
susie_cs_col: str = CS_COLUMN,
susie_pip_col: str = PIP_COLUMN,
susie_pos_col: str = GWASLAB_POS_COL,
)
Plot SUSIE pip using a bar graph colored by credible set