Skip to content

Commit

Permalink
Standardize consider_strand implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed Oct 10, 2024
1 parent 4cb2b17 commit 30daac4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/local/combinebeds/filter/templates/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def format_yaml_like(data: dict, indent: int = 0) -> str:
df = df.sort("end" ).with_columns(end_group =pl.col("end" ).diff().fill_null(0).gt(max_shift).cum_sum())
df = df.sort("start").with_columns(start_group=pl.col("start").diff().fill_null(0).gt(max_shift).cum_sum())

df = df.join(df, on=["chr", "start_group", "end_group"] + (["strand"] if consider_strand else []), how="inner")
group_cols = ["chr", "start_group", "end_group"] + (["strand"] if consider_strand else [])
df = df.join(df, on=group_cols, how="inner")
df = df.filter((pl.col("start") - pl.col("start_right")).abs() <= max_shift)
df = df.filter((pl.col("end") - pl.col("end_right")).abs() <= max_shift)

Expand Down

0 comments on commit 30daac4

Please sign in to comment.