From 600bdafa79532a164dae2cfd9fe15ea9159da8fc Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Fri, 26 Apr 2024 06:09:36 -0400 Subject: [PATCH] Remove intidxs and describe differences in indexes in output --- docs/guide-bedtools.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/guide-bedtools.md b/docs/guide-bedtools.md index 9b2eab17..658b8fde 100644 --- a/docs/guide-bedtools.md +++ b/docs/guide-bedtools.md @@ -66,9 +66,9 @@ bedtools intersect -wa -a A.bed -b B.bed > out.bed overlap = bf.overlap(A, B, how='inner', suffixes=('_1','_2'), return_index=True) out = A.loc[overlap['index_1']] # Alternatively -out = A.loc[bioframe.ops._overlap_intidxs(A, B, how='inner')[:,0]] +out = bf.overlap(A, B, how='inner')[A.columns] ``` - +**Note:** The output dataframe of the former method will use the same pandas index as the input dataframe `A`, while the latter result (the join output) will have an integer range index. ### Original entries from the second bed `-wb` ```sh @@ -78,6 +78,9 @@ bedtools intersect -wb -a A.bed -b B.bed > out.bed ```py overlap = bf.overlap(A, B, how='inner', suffixes=('_1','_2'), return_index=True) out = B.loc[overlap['index_2']] + +# Alternatively +out = bf.overlap(A, B, how='inner', suffixes=("_", ""))[B.columns] ``` ### Intersect with multiple beds