Skip to content

Commit

Permalink
Update 07-forest_plot.ipynb
Browse files Browse the repository at this point in the history
Many spelling and wording/layout changes. Still WIP
  • Loading branch information
JAnns98 authored Mar 20, 2024
1 parent 2999845 commit bb63dec
Showing 1 changed file with 23 additions and 50 deletions.
73 changes: 23 additions & 50 deletions nbs/tutorials/07-forest_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"id": "cfdb7e31",
"metadata": {},
"source": [
"Version 2023.02.14, DABEST also supports the comparison and analysis of different delta-delta analysis through a function called \"forest_plot\". \n",
"Version 2023.02.14, DABEST now supports the comparison of different delta-delta or mini-meta analyses through a function called \"forest_plot\". \n",
"\n",
"Many experimental designs investigate the effects of two interacting independent variables on a dependent variable. The delta-delta effect size enables us distill the net effect of the two variables. \n",
"Many experimental designs investigate the effects of two interacting independent variables on a dependent variable. The delta-delta effect size enables us to distill the net effect of the two variables. \n",
"\n",
"\n",
"Consider 3 experiments where in each of the experiment we test the efficacy of 3 drugs named ``Drug1``, ``Drug2`` , and ``Drug3`` on a disease-causing mutation M based on disease metric Y. The greater the value Y has, the more severe the disease phenotype is. Phenotype Y has been shown to be caused by a gain-of-function mutation M, so we expect a difference between wild type (W) subjects and mutant subjects (M). Now, we want to know whether this effect is ameliorated by the administration of Drug treatment. We also administer a placebo as a control. In theory, we only expect Drug to have an effect on the M group, although in practice, many drugs have non-specific effects on healthy populations too."
Expand Down Expand Up @@ -349,40 +349,37 @@
"id": "982afbdb",
"metadata": {},
"source": [
"Important Inputs:\n",
"Key Parameters:\n",
"\n",
"1. A list of contrast objects \n",
"- ``contrasts``: A list of contrast objects \n",
"\n",
"2. contrast_labels e.g. ``['Drug1', 'Drug2', 'Drug3']``\n",
"- ``contrast_type``: Select between ``\"delta2\"`` (for delta-delta) or ``\"mini_meta\"`` for mini-meta \n",
"\n",
"3. title: default is ``\"ΔΔ Forest\"``\n",
"- ``contrast_labels``: A list of labels for the contrast objects. E.g., ``['Drug1', 'Drug2', 'Drug3']``\n",
"\n",
"4. y_label: default as ``\"value\"``, please change it according to your measurement units/ types\n",
"- ``effect_size``: Select the effect size metric from ``\"mean_diff\", \"median_diff\", \"cliffs_delta\", \"cohens_d\", \
\"hedges_g\", or \"delta_g\"``. The default is ``\"mean_diff\"``\n",
"\n",
"5. contrast_type ``delta-delta`` and ``mini-meta`` are supported\n",
"- ``ylabel``: The axis label of dependent variable (Y-axis for vertical layout, X-axis for horizontal layout). The default is ``\"value\"``\n",
"\n",
"6. Which effect size to plot (default is ``delta-delta mean-diff``, but you can specify which effect size you want to use)\\n\n",
"- ``title``: The plot title. The default is ``\"ΔΔ Forest\"``\n",
"\n",
"7. Axes to put the plot into existing figures \\n\n",
"- ``ax``: Specify a matplotlib axes to put the plot into existing figures \n",
"\n",
"8. The argument ``horizontal`` is a boolean input (``True``/ ``False``) \\n\n",
"- ``horizontal``: A boolean input (``True``/ ``False``) to adjust the plot orientation. The default is vertical orientation (``False``) \n",
"\n",
" default is ``vertical``, (``False``) that changes the default orientation, \\n\n",
" \n",
" if ``True`` the delta-delta values will be reflected on the x axis and the delta plots will be plotted horizontally. \\n\n",
"9. Plot kwargs are supported such as violin plot kwargs, fontsize, marker_size, ci_line_width\n",
"- ``custom_palette`: A list of colors, one for each contrast object. E.g., ``[\'gray\', \'blue\', \'green\']``\n",
"\n",
"output:\n",
"- Additional kwargs are supported such as ``violin_kwargs``, ``fontsize``, ``marker_size``, ``ci_line_width``, ``rotation_for_xlabels``, ``alpha_violin_plot``, ``remove_spines``, and ``additional_plotting_kwargs``\n",
"\n",
"- A plot with horizontally/vertically laid out half violin plots of each of the prescribed delta bootstraps. \n"
]
},
{
"cell_type": "markdown",
"id": "06b93055",
"metadata": {},
"source": [
"#### Vertical (default) Layout"
"#### Vertical Layout (default)"
]
},
{
Expand Down Expand Up @@ -438,20 +435,6 @@
" horizontal=True);\n"
]
},
{
"cell_type": "markdown",
"id": "dc49a603",
"metadata": {},
"source": [
"Additiionall, for aesthetics and labels, you can use:\n",
"\n",
"1. The ``custom_palette`` argument to specify the colors you would like to indicate each experiment in a list \\n\n",
" e.g [\"gray\", \"blue\", \"green\" ].\n",
" \n",
"2. Additionally. the argument ``ylabel`` should be specified to specify the unit or \n",
" the exact name of the measurement of experiments, for example \"delta_deltas\", the default is \"value\""
]
},
{
"cell_type": "markdown",
"id": "4100ba2c",
Expand Down Expand Up @@ -480,7 +463,7 @@
"source": [
"forest2_vertical = forest_plot(paired_contrasts, \n",
" contrast_labels =['Drug1', 'Drug2', 'Drug3'], \n",
" custom_palette= ['gray', 'blue', 'green' ], \n",
" custom_palette= ['gray', 'blue', 'green'], \n",
" effect_size='delta_g');"
]
},
Expand All @@ -505,7 +488,7 @@
"\n",
"forest2_horizontal = forest_plot(paired_contrasts, \n",
" contrast_labels =['Drug1', 'Drug2', 'Drug3'], \n",
" custom_palette= ['gray', 'blue', 'green' ],\n",
" custom_palette= ['gray', 'blue', 'green'],\n",
" horizontal=True, effect_size='delta_g');\n",
"\n",
"\n"
Expand All @@ -516,23 +499,15 @@
"id": "6787aa97",
"metadata": {},
"source": [
"### Using existing axis \"ax\" as the optional input to plot forest_plot \\n\n",
"\n",
"\n",
"\n",
"With other kinds of dabest plots side by side or in other possible orientations, \\n\n",
"\n",
"We will specify the x_labels that we want to indicate in a list of strings and parse it as the argument contrast_labels, \\n\n",
"\n",
"for example ['Drug1', 'Drug2', 'Drug3']."
"## Embedding forest plots into existing axes with the ``ax`` parameter\n",
]
},
{
"cell_type": "markdown",
"id": "180cae3a",
"metadata": {},
"source": [
"### Two forest plots plotted together in one axis"
"### Two forest plots plotted together in one figure"
]
},
{
Expand Down Expand Up @@ -577,7 +552,7 @@
"id": "829f0d03",
"metadata": {},
"source": [
"### Four different plots, 3 ``delta-delta`` and 1 ``forest plot``"
"### A forest plot added as a subfigure with a figure with a variety of DABEST plots"
]
},
{
Expand Down Expand Up @@ -652,9 +627,7 @@
"id": "964471ab",
"metadata": {},
"source": [
"## Forest plot also supports:\n",
"\n",
"### ``mini-meta`` comparisons and with the contrast type changed to ``\"mini_meta_delta\"``"
"## Forest plot of mini-meta:\n",
]
},
{
Expand Down Expand Up @@ -742,15 +715,15 @@
"id": "e04e1ac4",
"metadata": {},
"source": [
"## Use the contrast list and forest_plot() function to generate figures"
"## Generate the Figure"
]
},
{
"cell_type": "markdown",
"id": "c760a179",
"metadata": {},
"source": [
"### Verticle (default) Layout"
"### Vertical Layout (default)"
]
},
{
Expand Down

0 comments on commit bb63dec

Please sign in to comment.