diff --git a/src/db_utils/interactions/features_interactions.py b/src/db_utils/interactions/features_interactions.py index 92253d8be30ee66ed26948b8eb2828daa4c5d35f..fe99989a2a60f2884e9dd7c4b4aa9f709c944f7f 100644 --- a/src/db_utils/interactions/features_interactions.py +++ b/src/db_utils/interactions/features_interactions.py @@ -282,8 +282,8 @@ def add_info_distance_between_features(df: pd.DataFrame) -> pd.DataFrame: studied in interaction and to add this information in the result dataframe. If the result is NULL it is because we study two exons or genes located in the same chromosome. - If the result is (null), so NaN, it is because we study two exons or genes - which have different identifiers, but strictly identical coordinates. + If the result is 0, it is because we study two exons or genes which have + different identifiers, but strictly identical coordinates. :param df: Result of the "filtering_2" function :return df: df with distances added or NULL or (null) see before for more @@ -310,6 +310,8 @@ def add_info_distance_between_features(df: pd.DataFrame) -> pd.DataFrame: (df["start1"] - df["stop2"] + 1) df.loc[df["stop1"] > df["stop2"], "distance"] = \ (df["start1"] - df["stop2"] + 1) + df.loc[(df["start1"] == df["start2"]) & (df["stop1"] == df["stop2"]), + "distance"] = 0 df.loc[df["chr1"] != df["chr2"], "distance"] = "NULL" df.drop(["start1", "ID1", "chr1", "stop1", "ID2", "chr2", "start2", "stop2"], axis='columns', inplace=True) @@ -331,6 +333,8 @@ def add_info_distance_between_features(df: pd.DataFrame) -> pd.DataFrame: (df["start1"] - df["stop2"] + 1) df.loc[df["stop1"] > df["stop2"], "distance"] = \ (df["start1"] - df["stop2"] + 1) + df.loc[(df["start1"] == df["start2"]) & (df["stop1"] == df["stop2"]), + "distance"] = 0 df.loc[df["chr1"] != df["chr2"], "distance"] = "NULL" df.drop(["start1", "ID1", "chr1", "stop1", "ID2", "chr2", "start2", "stop2"], axis='columns', inplace=True)