Skip to content

Commit

Permalink
Merge pull request #169 from opentargets/ds_3117_refactor_clumping
Browse files Browse the repository at this point in the history
Ds 3117 refactor clumping
  • Loading branch information
DSuveges authored Oct 13, 2023
2 parents f8ed420 + 86279b6 commit cc1f636
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/otg/dataset/summary_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def window_based_clumping(
self: SummaryStatistics,
distance: int,
gwas_significance: float = 5e-8,
with_locus: bool = False,
baseline_significance: float = 0.05,
locus_collect_distance: int | None = None,
) -> StudyLocus:
Expand All @@ -70,10 +69,8 @@ def window_based_clumping(
Returns:
StudyLocus: Clumped study-locus containing variants based on window.
"""
if locus_collect_distance is None:
locus_collect_distance = distance
# Based on if we want to get the locus different clumping function is called:
if with_locus:
# If locus collect distance is present, collect locus with the provided distance:
if locus_collect_distance:
clumped_df = WindowBasedClumping.clump_with_locus(
self,
window_length=distance,
Expand Down
4 changes: 3 additions & 1 deletion tests/method/test_window_based_clumping.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def test_window_based_clump_with_locus__correctness(
sample_summary_satistics: SummaryStatistics,
) -> None:
"""Test window-based clumping."""
clumped = sample_summary_satistics.window_based_clumping(250_000, with_locus=True)
clumped = sample_summary_satistics.window_based_clumping(
distance=250_000, locus_collect_distance=250_000
)

# Asserting the presence of locus key:
assert "locus" in clumped.df.columns
Expand Down

0 comments on commit cc1f636

Please sign in to comment.