Skip to content

Commit

Permalink
Fix problem with overlap indexes data types (where returned as float)
Browse files Browse the repository at this point in the history
  • Loading branch information
agalitsyna committed Feb 6, 2024
1 parent bfac0e1 commit e7d4c1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions bioframe/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,7 @@ def pair_by_distance(
idxs["intervening"] = (
np.abs(idxs[f"index{suffixes[0]}"] - idxs[f"index{suffixes[1]}"]) - 1
)
idxs = idxs.query(
f"intervening<={max_intervening} and intervening>={min_intervening}"
)
idxs = idxs[(idxs['intervening']<=max_intervening) & (idxs['intervening']>=min_intervening)]

left_ivals = (
df.iloc[idxs[f"index{suffixes[0]}"].values]
Expand Down
4 changes: 2 additions & 2 deletions bioframe/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ def overlap(
index_col = return_index if isinstance(return_index, str) else "index"
index_col_1 = index_col + suffixes[0]
index_col_2 = index_col + suffixes[1]
df_index_1 = pd.DataFrame({index_col_1: df1.index[events1]})
df_index_2 = pd.DataFrame({index_col_2: df2.index[events2]})
df_index_1 = pd.DataFrame({index_col_1: df1.index[events1]}, dtype=pd.Int64Dtype())
df_index_2 = pd.DataFrame({index_col_2: df2.index[events2]}, dtype=pd.Int64Dtype())

df_overlap = None
if return_overlap:
Expand Down

0 comments on commit e7d4c1c

Please sign in to comment.