diff --git a/README.md b/README.md index 530577d4..269d406f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ brings new visualizations, refined plots, and improved accuracy. You can generate a Whorlmap directly from multi-dimensional DABEST objects using the `.whorlmap()` method. See the [Whorlmap - tutorial](10-whorlmap.html) for more details. + tutorial](https://acclab.github.io/DABEST-python/tutorials/10-whorlmap.html) + for more details. 2. **Slopegraphs 📈: Enhanced summaries for paired data** @@ -52,7 +53,8 @@ brings new visualizations, refined plots, and improved accuracy. - Customize appearance with `group_summaries_kwargs`. See the Group Summaries section in the [Plot Aesthetics - tutorial](08-plot_aesthetics.html) for more details. + tutorial](https://acclab.github.io/DABEST-python/tutorials/08-plot_aesthetics.html) + for more details. 3. **Mini-meta Weighted Delta Fix 🧮** @@ -69,7 +71,8 @@ brings new visualizations, refined plots, and improved accuracy. now color contrast bars and effect-size curves. See the Custom Palette section in the [Plot Aesthetics -tutorial](08-plot_aesthetics.html) for examples. +tutorial](https://acclab.github.io/DABEST-python/tutorials/08-plot_aesthetics.html) +for examples. Thank you for your continued support! diff --git a/dabest/_dabest_object.py b/dabest/_dabest_object.py index a055cdd1..01c96d5f 100644 --- a/dabest/_dabest_object.py +++ b/dabest/_dabest_object.py @@ -559,14 +559,12 @@ def _check_errors(self, x, y, idx, experiment, experiment_label, x1_level): self.__x1_level = x1_level if self.__is_paired and self.__output_data.isnull().values.any(): - warn1 = f"NaN values detected under paired setting and removed," + warn1 = f"NaN values detected under paired setting," warn2 = f" please check your data." warnings.warn(warn1 + warn2) if x is not None and y is not None: rmname = self.__output_data[self.__output_data[y].isnull()][self.__id_col].tolist() self.__output_data = self.__output_data[~self.__output_data[self.__id_col].isin(rmname)] - elif x is None and y is None: - self.__output_data.dropna(inplace=True) # Check if there is a typo on paired if self.__is_paired and self.__is_paired not in ("baseline", "sequential"): diff --git a/nbs/API/dabest_object.ipynb b/nbs/API/dabest_object.ipynb index 4054d6a6..f082c62b 100644 --- a/nbs/API/dabest_object.ipynb +++ b/nbs/API/dabest_object.ipynb @@ -664,14 +664,12 @@ " self.__x1_level = x1_level\n", "\n", " if self.__is_paired and self.__output_data.isnull().values.any():\n", - " warn1 = f\"NaN values detected under paired setting and removed,\"\n", + " warn1 = f\"NaN values detected under paired setting,\"\n", " warn2 = f\" please check your data.\"\n", " warnings.warn(warn1 + warn2)\n", " if x is not None and y is not None:\n", " rmname = self.__output_data[self.__output_data[y].isnull()][self.__id_col].tolist()\n", " self.__output_data = self.__output_data[~self.__output_data[self.__id_col].isin(rmname)]\n", - " elif x is None and y is None:\n", - " self.__output_data.dropna(inplace=True)\n", "\n", " # Check if there is a typo on paired\n", " if self.__is_paired and self.__is_paired not in (\"baseline\", \"sequential\"):\n", diff --git a/nbs/read_me.ipynb b/nbs/read_me.ipynb index 702dc10d..bfe49362 100644 --- a/nbs/read_me.ipynb +++ b/nbs/read_me.ipynb @@ -43,7 +43,7 @@ "\n", " They are especially useful for large-scale or multi-condition experiments, serving as a **space-efficient alternative to stacked forest plots**.\n", "\n", - " You can generate a Whorlmap directly from multi-dimensional DABEST objects using the `.whorlmap()` method. See the [Whorlmap tutorial](10-whorlmap.html) for more details.\n", + " You can generate a Whorlmap directly from multi-dimensional DABEST objects using the `.whorlmap()` method. See the [Whorlmap tutorial](https://acclab.github.io/DABEST-python/tutorials/10-whorlmap.html) for more details.\n", "\n", "2. **Slopegraphs 📈: Enhanced summaries for paired data**\n", " \n", @@ -55,7 +55,7 @@ " \n", " - Customize appearance with `group_summaries_kwargs`.\n", "\n", - " See the Group Summaries section in the [Plot Aesthetics tutorial](08-plot_aesthetics.html) for more details.\n", + " See the Group Summaries section in the [Plot Aesthetics tutorial](https://acclab.github.io/DABEST-python/tutorials/08-plot_aesthetics.html) for more details.\n", "\n", "3. **Mini-meta Weighted Delta Fix 🧮**\n", " \n", @@ -69,7 +69,7 @@ " - **Slopegraphs (paired, non-proportional):**\n", " `custom_palette` can now color contrast bars and effect-size curves.\n", "\n", - " See the Custom Palette section in the [Plot Aesthetics tutorial](08-plot_aesthetics.html) for examples.\n", + " See the Custom Palette section in the [Plot Aesthetics tutorial](https://acclab.github.io/DABEST-python/tutorials/08-plot_aesthetics.html) for examples.\n", "\n", "Thank you for your continued support! \n", "\n", diff --git a/nbs/tests/mpl_image_tests/baseline_images/test_266_multigroups_prop_paired_meandiff_gridkey_userdefinedrows.png b/nbs/tests/mpl_image_tests/baseline_images/test_266_multigroups_prop_paired_meandiff_gridkey_userdefinedrows.png index 712ebaf7..4d3faf47 100644 Binary files a/nbs/tests/mpl_image_tests/baseline_images/test_266_multigroups_prop_paired_meandiff_gridkey_userdefinedrows.png and b/nbs/tests/mpl_image_tests/baseline_images/test_266_multigroups_prop_paired_meandiff_gridkey_userdefinedrows.png differ diff --git a/nbs/tests/mpl_image_tests/baseline_images/test_267_multigroups_prop_paired_meandiff_gridkey_autoparser.png b/nbs/tests/mpl_image_tests/baseline_images/test_267_multigroups_prop_paired_meandiff_gridkey_autoparser.png index de973894..ac0c22c5 100644 Binary files a/nbs/tests/mpl_image_tests/baseline_images/test_267_multigroups_prop_paired_meandiff_gridkey_autoparser.png and b/nbs/tests/mpl_image_tests/baseline_images/test_267_multigroups_prop_paired_meandiff_gridkey_autoparser.png differ diff --git a/nbs/tests/mpl_image_tests/baseline_images/test_33_multi_paired_different_sizes.png b/nbs/tests/mpl_image_tests/baseline_images/test_33_multi_paired_different_sizes.png new file mode 100644 index 00000000..94778eba Binary files /dev/null and b/nbs/tests/mpl_image_tests/baseline_images/test_33_multi_paired_different_sizes.png differ diff --git a/nbs/tests/mpl_image_tests/test_03_plotting.py b/nbs/tests/mpl_image_tests/test_03_plotting.py index 8d82e432..f8c588db 100644 --- a/nbs/tests/mpl_image_tests/test_03_plotting.py +++ b/nbs/tests/mpl_image_tests/test_03_plotting.py @@ -451,6 +451,34 @@ def test_32_multigroups_baseline_change_palette(): plt.rcdefaults() return multi_groups_baseline.mean_diff.plot(custom_palette="Dark2", delta_text=True) +@pytest.mark.mpl_image_compare(tolerance=8) +def test_33_multi_paired_different_sizes(): + # Test for GitHub issue #216: multi-group paired data with different sample sizes + plt.rcdefaults() + np.random.seed(9999) + + # Create three test pairs with different sample sizes (20, 10, 40) + c1DF = pd.DataFrame({'Test 1_pre': norm.rvs(loc=3, scale=0.4, size=20)}) + t1DF = pd.DataFrame({'Test 1_post': norm.rvs(loc=3.5, scale=0.5, size=20)}) + t2DF = pd.DataFrame({'Test 2_pre': norm.rvs(loc=2.5, scale=0.6, size=10)}) + t3DF = pd.DataFrame({'Test 2_post': norm.rvs(loc=3, scale=0.75, size=10)}) + t4DF = pd.DataFrame({'Test 3_pre': norm.rvs(loc=3.5, scale=0.75, size=40)}) + t5DF = pd.DataFrame({'Test 3_post': norm.rvs(loc=3.25, scale=0.4, size=40)}) + + df = pd.concat([c1DF, t1DF, t2DF, t3DF, t4DF, t5DF], axis=1) + df["ID"] = pd.Series(range(1, len(df)+1)) + + multi_paired_diff_sizes = load( + df, + idx=(("Test 1_pre", "Test 1_post"), + ("Test 2_pre", "Test 2_post"), + ("Test 3_pre", "Test 3_post")), + paired="baseline", + id_col="ID" + ) + + return multi_paired_diff_sizes.mean_diff.plot() + @pytest.mark.mpl_image_compare(tolerance=8) def test_99_style_sheets(): # Perform this test last so we don't have to reset the plot style.