From e4f498c70d9daacf9f7ff73a91259d60decc8f59 Mon Sep 17 00:00:00 2001 From: Sergey Venev Date: Thu, 23 Nov 2023 17:11:36 -0500 Subject: [PATCH] add requested test for custom column names in coverage --- tests/test_ops.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_ops.py b/tests/test_ops.py index 0a753baf..af62cd6b 100644 --- a/tests/test_ops.py +++ b/tests/test_ops.py @@ -1073,6 +1073,16 @@ def test_coverage(): df = pd.read_csv(StringIO(d), sep=r"\s+") pd.testing.assert_frame_equal(df, bioframe.coverage(df1, df2)) + ### with custom column names + cols1 = ["chromosome", "begin", "stop"] + cols2 = ["chr", "cluster_start", "cluster_end"] + df1 = pd.DataFrame([["chr1", 3, 8]], columns=cols1) + df2 = pd.DataFrame([["chr1", 3, 8]], columns=cols2) + d = """chromosome begin stop coverage + 0 chr1 3 8 5""" + df = pd.read_csv(StringIO(d), sep=r"\s+") + pd.testing.assert_frame_equal(df, bioframe.coverage(df1, df2, cols1=cols1, cols2=cols2)) + ### coverage of NA interval returns zero for coverage df1 = pd.DataFrame( [