Fine-Mapping API¶
Pipeline and Fine-Mapping¶
Main module.
fine_map(locus_set, tool='susie', max_causal=5, adaptive_max_causal=False, set_L_by_cojo=True, p_cutoff=5e-08, collinear_cutoff=0.9, window_size=10000000, maf_cutoff=0.01, diff_freq_cutoff=0.2, combine_cred='union', combine_pip='max', jaccard_threshold=0.1, timeout_minutes=None, strategy=None, significant_threshold=5e-08, **kwargs)
¶
Perform fine-mapping on a locus set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locus_set
|
LocusSet
|
Locus set to fine-mapping. |
required |
tool
|
str
|
Fine-mapping tool. Choose from ["abf", "abf_cojo", "finemap", "rsparsepro", "susie", "multisusie", "susiex", "mesusie"] - Single-input tools (abf, abf_cojo, finemap, rsparsepro, susie): Process each locus individually - Multi-input tools (multisusie, susiex, mesusie): Process all loci together When using single-input tools with multiple loci, results are automatically combined |
'susie'
|
combine_cred
|
str
|
Method to combine credible sets, by default "union". Options: "union", "intersection", "cluster". "union": Union of all credible sets to form a merged credible set. "intersection": Frist merge the credible sets from the same tool, then take the intersection of all merged credible sets. no credible set will be returned if no common SNPs found. "cluster": Merge credible sets with Jaccard index > 0.1. |
'union'
|
combine_pip
|
str
|
Method to combine PIPs, by default "max". Options: "max", "min", "mean", "meta". "meta": PIP_meta = 1 - prod(1 - PIP_i), where i is the index of tools, PIP_i = 0 when the SNP is not in the credible set of the tool. "max": Maximum PIP value for each SNP across all tools. "min": Minimum PIP value for each SNP across all tools. "mean": Mean PIP value for each SNP across all tools. |
'max'
|
jaccard_threshold
|
float
|
Jaccard index threshold for the "cluster" method, by default 0.1. |
0.1
|
timeout_minutes
|
Optional[float]
|
Maximum runtime per locus in minutes when running the FINEMAP tool. Defaults to 30 minutes for FINEMAP. Ignored for other tools. |
None
|
max_causal
|
int
|
Maximum number of causal variants, by default 5. |
5
|
adaptive_max_causal
|
bool
|
Enable adaptive max_causal parameter tuning, by default False. When True, automatically adjusts max_causal based on results: - If credible sets >= max_causal, increase by 5 (up to 20) - If convergence fails, decrease by 1 (down to 1) Applies to: finemap, susie, rsparsepro (per-locus), multisusie, susiex (LocusSet-level). |
False
|
strategy
|
str
|
DEPRECATED. This parameter is no longer used and will be removed in a future version. The strategy is now automatically determined based on the tool and data structure. |
None
|
significant_threshold
|
float
|
Minimum p-value required for variants to be considered significant. If no variants pass this threshold, single-input tools return empty credible sets with zero posterior probabilities. Defaults to 5e-8. |
5e-08
|
Source code in credtools/credtools.py
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 394 395 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 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 533 534 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 | |
pipeline(loci_df, meta_method='meta_all', skip_qc=False, tool='susie', outdir='.', calculate_lambda_s=False, strategy=None, **kwargs)
¶
Run whole fine-mapping pipeline on a list of loci.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loci_df
|
DataFrame
|
Dataframe containing the locus information. |
required |
meta_method
|
str
|
Meta-analysis method, by default "meta_all" Options: "meta_all", "meta_by_population", "no_meta". |
'meta_all'
|
skip_qc
|
bool
|
Skip QC, by default False. |
False
|
tool
|
str
|
Fine-mapping tool, by default "susie". |
'susie'
|
calculate_lambda_s
|
bool
|
Whether to calculate lambda_s parameter using estimate_s_rss function, by default False. |
False
|
strategy
|
str
|
DEPRECATED. This parameter is no longer used and will be removed in a future version. |
None
|
Source code in credtools/credtools.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | |
Credible Sets¶
Credible Set functions.
CredibleSet(tool, parameters, coverage, n_cs, cs_sizes, lead_snps, snps, pips, per_locus_results=None, purity=None, converged=None, n_iter=None)
¶
Class representing credible sets from one fine-mapping tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
str
|
The name of the fine-mapping tool. |
required |
parameters
|
Dict[str, Any]
|
Additional parameters used by the fine-mapping tool. |
required |
coverage
|
float
|
The coverage of the credible sets. |
required |
n_cs
|
int
|
The number of credible sets. |
required |
cs_sizes
|
List[int]
|
Sizes of each credible set. |
required |
lead_snps
|
List[str]
|
List of lead SNPs. |
required |
snps
|
List[List[str]]
|
List of SNPs for each credible set. |
required |
pips
|
Series
|
Posterior inclusion probabilities. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
tool |
str
|
The name of the fine-mapping tool. |
n_cs |
int
|
The number of credible sets. |
coverage |
float
|
The coverage of the credible sets. |
lead_snps |
List[str]
|
List of lead SNPs. |
snps |
List[List[str]]
|
List of SNPs for each credible set. |
cs_sizes |
List[int]
|
Sizes of each credible set. |
pips |
Series
|
Posterior inclusion probabilities. |
parameters |
Dict[str, Any]
|
Additional parameters used by the fine-mapping tool. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
str
|
The name of the fine-mapping tool. |
required |
parameters
|
Dict[str, Any]
|
Additional parameters used by the fine-mapping tool. |
required |
coverage
|
float
|
The coverage of the credible sets. |
required |
n_cs
|
int
|
The number of credible sets. |
required |
cs_sizes
|
List[int]
|
Sizes of each credible set. |
required |
lead_snps
|
List[str]
|
List of lead SNPs. |
required |
snps
|
List[List[str]]
|
List of SNPs for each credible set. |
required |
pips
|
Series
|
Posterior inclusion probabilities. |
required |
per_locus_results
|
Optional[Dict[str, CredibleSet]]
|
Mapping of locus identifiers to their individual credible set results. |
None
|
purity
|
Optional[List[Optional[float]]]
|
List of purity values for each credible set. Purity is the minimum absolute LD R value between all SNP pairs in a credible set. None if LD matrix is not available. |
None
|
converged
|
Optional[bool]
|
Whether the underlying iterative algorithm converged. None when the producing tool is non-iterative or convergence is not tracked (e.g., ABF, FINEMAP). |
None
|
n_iter
|
Optional[int]
|
Number of iterations performed by the underlying algorithm. None when not tracked. |
None
|
Source code in credtools/credibleset.py
converged
property
¶
Get convergence status of the underlying iterative algorithm.
coverage
property
¶
Get the coverage.
cs_sizes
property
¶
Get the sizes of each credible set.
lead_snps
property
¶
Get the lead SNPs.
n_cs
property
¶
Get the number of credible sets.
n_iter
property
¶
Get the number of iterations performed by the underlying algorithm.
parameters
property
¶
Get the parameters.
per_locus_results
property
¶
Get per-locus credible set results.
pips
property
¶
Get the PIPs.
purity
property
¶
Get the purity values for each credible set.
snps
property
¶
Get the SNPs.
tool
property
¶
Get the tool name.
__repr__()
¶
Return a string representation of the CredibleSet object.
Returns:
| Type | Description |
|---|---|
str
|
String representation of the CredibleSet object. |
Source code in credtools/credibleset.py
copy()
¶
Copy the CredibleSet object.
Returns:
| Type | Description |
|---|---|
CredibleSet
|
A copy of the CredibleSet object. |
Source code in credtools/credibleset.py
create_enhanced_pips_df(locus_set)
¶
Create DataFrame with PIPs and full sumstats information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locus_set
|
LocusSet
|
The locus set containing locus data. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing full sumstats, PIPs, R2, and credible set assignments. |
Source code in credtools/credibleset.py
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 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 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
from_dict(data, pips)
classmethod
¶
Create CredibleSet from dictionary and pips.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Dict[str, Any]
|
A dictionary containing the data to initialize the CredibleSet. |
required |
pips
|
Series
|
Posterior inclusion probabilities. |
required |
Returns:
| Type | Description |
|---|---|
CredibleSet
|
An instance of CredibleSet initialized with the provided data and pips. |
Source code in credtools/credibleset.py
set_per_locus_results(per_locus_results)
¶
to_dict()
¶
Convert to dictionary for TOML storage (excluding pips).
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
A dictionary representation of the CredibleSet excluding pips. |
Source code in credtools/credibleset.py
calculate_cs_purity(ld, cs_snp_ids)
¶
Calculate purity for a single credible set.
Purity is defined as the minimum absolute LD R value between all pairs of SNPs in the credible set.
For multiple LD matrices (multi-ancestry case), purity is calculated as: 1. Extract CS submatrix from each LD matrix 2. Take element-wise maximum of absolute values across all matrices 3. Return the minimum value from the resulting meta-LD matrix
This approach (similar to MultiSuSiE) ensures the credible set has high purity across all populations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ld
|
LDMatrix or List[LDMatrix]
|
LDMatrix object(s) containing both r matrix and map with SNPIDs. If a list is provided, meta-purity across all matrices is calculated. |
required |
cs_snp_ids
|
List[str]
|
List of SNPID strings in the credible set. |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
|
Examples:
>>> # Single LD matrix: CS with 3 SNPs having LD R values: 0.8, 0.9, 0.7
>>> # Purity = min(|0.8|, |0.9|, |0.7|) = 0.7
>>>
>>> # Multiple LD matrices: same CS in EUR and AFR
>>> # EUR: |R| values = [0.8, 0.9, 0.7]
>>> # AFR: |R| values = [0.6, 0.85, 0.75]
>>> # Meta |R| = max([0.8, 0.9, 0.7], [0.6, 0.85, 0.75]) = [0.8, 0.9, 0.75]
>>> # Purity = min([0.8, 0.9, 0.75]) = 0.75
Source code in credtools/credibleset.py
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | |
cluster_cs(dict_sets, threshold=0.9)
¶
Cluster dictionaries from different sets based on continuous Jaccard similarity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_sets
|
List[List[Dict[str, float]]]
|
List of m sets, where each set contains dictionaries with PIP values. |
required |
threshold
|
float
|
Clustering threshold, by default 0.9. |
0.9
|
Returns:
| Type | Description |
|---|---|
List[List[str]]
|
List of merged clusters, where each cluster contains a list of unique SNP IDs from the dictionaries in that cluster. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than two sets of dictionaries are provided or if any set is empty. |
Examples:
>>> sets = [
... [{'a': 0.8, 'b': 0.5}],
... [{'b': 0.6, 'c': 0.3}]
... ]
>>> clusters = cluster_cs(sets)
Source code in credtools/credibleset.py
combine_creds(creds, combine_cred='union', combine_pip='max', jaccard_threshold=0.1, ld_matrices=None, min_purity=0.0)
¶
Combine credible sets from multiple tools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
creds
|
List[CredibleSet]
|
List of credible sets from multiple tools. |
required |
combine_cred
|
str
|
Method to combine credible sets, by default "union". Options: "union", "intersection", "cluster".
|
'union'
|
combine_pip
|
str
|
Method to combine PIPs, by default "max". Options: "max", "min", "mean", "meta".
|
'max'
|
jaccard_threshold
|
float
|
Jaccard index threshold for the "cluster" method, by default 0.1. |
0.1
|
ld_matrices
|
Optional[List[LDMatrix]]
|
List of LD matrices for purity calculation, by default None. If provided, purity will be calculated for merged credible sets using multi-ancestry approach (element-wise max across populations). If None, purity will not be calculated for the merged credible sets. |
None
|
min_purity
|
float
|
Minimum purity threshold for filtering credible sets, by default 0.0. After combining credible sets, only those with purity >= min_purity will be kept. Purity is the minimum absolute LD R value between all SNP pairs in a credible set. Set to 0.0 (default) for no filtering. |
0.0
|
Returns:
| Type | Description |
|---|---|
CredibleSet
|
Combined credible set. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the method is not supported. |
Notes
'union' and 'intersection' methods will merge all credible sets into one.
Source code in credtools/credibleset.py
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 533 534 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 | |
combine_pips(pips, method='max')
¶
Combine PIPs from multiple tools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pips
|
List[Series]
|
List of PIPs from multiple tools. |
required |
method
|
str
|
Method to combine PIPs, by default "max". Options: "max", "min", "mean", "meta". When "meta" is selected, the method will use the formula: PIP_meta = 1 - prod(1 - PIP_i), where i is the index of tools, PIP_i = 0 when the SNP is not in the credible set of the tool. When "max", "min", "mean" is selected, the SNP not in the credible set will be excluded from the calculation. |
'max'
|
Returns:
| Type | Description |
|---|---|
Series
|
Combined PIPs. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the method is not supported. |
Source code in credtools/credibleset.py
continuous_jaccard(dict1, dict2)
¶
Calculate modified Jaccard similarity for continuous values (PIP values).
Formula: ∑min(xi,yi)/∑max(xi,yi) where xi, yi are PIP values or 0 if missing
Citation: Yuan, K. et al. (2024) Nature Genetics https://doi.org/10.1038/s41588-024-01870-z.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict1
|
Dict[str, float]
|
First dictionary with keys and PIP values (0-1). |
required |
dict2
|
Dict[str, float]
|
Second dictionary with keys and PIP values (0-1). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Modified Jaccard similarity index between 0 and 1. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any values are not between 0 and 1. |
Examples:
Source code in credtools/credibleset.py
create_similarity_matrix(dict_sets)
¶
Create a similarity matrix for all pairs of dictionaries across different sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_sets
|
List[List[Dict[str, float]]]
|
List of m sets, where each set contains dictionaries with PIP values. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, List[Dict[str, float]]]
|
A tuple containing: - Similarity matrix (n_dicts x n_dicts) - Flattened list of dictionaries |
Examples:
>>> sets = [[{'a': 0.8, 'b': 0.5}], [{'b': 0.6, 'c': 0.3}]]
>>> matrix, dicts = create_similarity_matrix(sets)
Source code in credtools/credibleset.py
filter_credset_by_purity(credset, min_purity=0.0)
¶
Filter credible sets by purity threshold.
Removes credible sets that do not meet the minimum purity requirement. Purity is defined as the minimum absolute LD R value between all pairs of SNPs in the credible set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credset
|
CredibleSet
|
CredibleSet object containing credible sets and their purity values. |
required |
min_purity
|
float
|
Minimum purity threshold for filtering, by default 0.0. Credible sets with purity < min_purity will be removed. Set to 0.0 (default) for no filtering. |
0.0
|
Returns:
| Type | Description |
|---|---|
CredibleSet
|
New CredibleSet object with only credible sets meeting purity threshold. If no credible sets pass filtering, returns empty CredibleSet (n_cs=0). |
Notes
- If credset.purity is None or empty, no filtering is applied (returns original credset)
- If min_purity <= 0, no filtering is applied (returns original credset)
- Filtered credible sets maintain their original ordering
- PIPs are preserved for all variants (not filtered)
Examples:
>>> # Filter credible sets to keep only high-purity sets (purity >= 0.5)
>>> filtered_cs = filter_credset_by_purity(credset, min_purity=0.5)
>>> print(f"Original: {credset.n_cs} CS, Filtered: {filtered_cs.n_cs} CS")
Original: 5 CS, Filtered: 3 CS
>>> # No filtering (default)
>>> same_cs = filter_credset_by_purity(credset, min_purity=0.0)
>>> assert same_cs.n_cs == credset.n_cs
Source code in credtools/credibleset.py
961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | |
generate_cs_summary(causal_variants, locus_id, locus_set)
¶
Generate credible set summary from causal variants.
Creates one summary row per credible set, including lead SNP, size, PIP thresholds, and purity metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
causal_variants
|
DataFrame
|
DataFrame of causal variants (rows where CRED != 0), must have columns: CRED, PIP, SNPID. |
required |
locus_id
|
str
|
Locus identifier string. |
required |
locus_set
|
LocusSet
|
LocusSet object for LD-based purity calculation. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List of summary dictionaries, one per credible set. |
Source code in credtools/credibleset.py
COJO Helpers¶
Wrapper for COJO.
conditional_selection(locus, p_cutoff=5e-08, collinear_cutoff=0.9, window_size=10000000, maf_cutoff=0.01, diff_freq_cutoff=0.2)
¶
Perform conditional selection on the locus using COJO method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locus
|
Locus
|
The locus to perform conditional selection on. Must contain summary statistics and LD matrix data. |
required |
p_cutoff
|
float
|
The p-value cutoff for the conditional selection, by default 5e-8. If no SNPs pass this threshold, it will be relaxed to 1e-5. |
5e-08
|
collinear_cutoff
|
float
|
The collinearity cutoff for the conditional selection, by default 0.9. SNPs with LD correlation above this threshold are considered collinear. |
0.9
|
window_size
|
int
|
The window size in base pairs for the conditional selection, by default 10000000. SNPs within this window are considered for conditional analysis. |
10000000
|
maf_cutoff
|
float
|
The minor allele frequency cutoff for the conditional selection, by default 0.01. SNPs with MAF below this threshold are excluded. |
0.01
|
diff_freq_cutoff
|
float
|
The difference in frequency cutoff between summary statistics and reference panel, by default 0.2. SNPs with frequency differences above this threshold are excluded. |
0.2
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The conditional selection results containing independently associated variants with columns including SNP identifiers, effect sizes, and conditional p-values. |
Warnings
If no SNPs pass the initial p-value cutoff, the threshold is automatically relaxed to 1e-5 and a warning is logged.
If AF2 (reference allele frequency) is not available in the LD matrix, a warning is logged and frequency checking is disabled.
Notes
COJO (Conditional and Joint analysis) performs stepwise conditional analysis to identify independently associated variants at a locus. The method:
- Identifies the most significant SNP
- Performs conditional analysis on remaining SNPs
- Iteratively adds independently associated SNPs
- Continues until no more SNPs meet significance criteria
The algorithm accounts for linkage disequilibrium patterns and helps distinguish truly independent signals from those in LD with lead variants.
Reference: Yang, J. et al. Conditional and joint multiple-SNP analysis of GWAS summary statistics identifies additional variants influencing complex traits. Nat Genet 44, 369-375 (2012).
Examples:
>>> # Basic conditional selection
>>> results = conditional_selection(locus)
>>> print(f"Found {len(results)} independent signals")
Found 3 independent signals
>>> # With custom thresholds
>>> results = conditional_selection(
... locus,
... p_cutoff=1e-6,
... maf_cutoff=0.05
... )
>>> print(results[['SNP', 'b', 'se', 'p']])
SNP b se p
0 rs123456 0.15 0.025 1.2e-08
1 rs789012 -0.08 0.020 4.5e-07
Source code in credtools/cojo.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |