diff --git a/src/MetaWinAnalysis.py b/src/MetaWinAnalysis.py index cbb4295..f6ab1d7 100644 --- a/src/MetaWinAnalysis.py +++ b/src/MetaWinAnalysis.py @@ -1798,62 +1798,56 @@ def do_meta_analysis(data, options, decimal_places: int = 4, alpha: float = 0.05 output, all_citations = options.report_choices() output_blocks.extend(output) if options.structure == SIMPLE_MA: - (output, figure, fig_caption, chart_data, analysis_values, + (output, figure, chart_data, analysis_values, citations) = MetaWinAnalysisFunctions.simple_meta_analysis(data, options, decimal_places, alpha, norm_ci) elif options.structure == GROUPED_MA: - (output, figure, fig_caption, chart_data, analysis_values, + (output, figure, chart_data, analysis_values, citations) = MetaWinAnalysisFunctions.grouped_meta_analysis(data, options, decimal_places, alpha, norm_ci) elif options.structure == CUMULATIVE_MA: - output, figure, fig_caption, chart_data = MetaWinAnalysisFunctions.cumulative_meta_analysis(data, options, - decimal_places, - alpha, norm_ci) + output, figure, chart_data = MetaWinAnalysisFunctions.cumulative_meta_analysis(data, options, + decimal_places, alpha, norm_ci) analysis_values = None citations = [] elif options.structure == REGRESSION_MA: - (output, figure, fig_caption, chart_data, analysis_values, + (output, figure, chart_data, analysis_values, citations) = MetaWinAnalysisFunctions.regression_meta_analysis(data, options, decimal_places, alpha, norm_ci) elif options.structure == COMPLEX_MA: output, analysis_values, citations = MetaWinAnalysisFunctions.complex_meta_analysis(data, options, decimal_places, alpha, norm_ci) figure = None - fig_caption = None chart_data = None elif options.structure == NESTED_MA: - (output, figure, fig_caption, chart_data, analysis_values, + (output, figure, chart_data, analysis_values, citations) = MetaWinAnalysisFunctions.nested_meta_analysis(data, options, decimal_places, alpha, norm_ci) elif options.structure == TRIM_FILL: - (output, figure, fig_caption, chart_data, analysis_values, + (output, figure, chart_data, analysis_values, citations) = MetaWinAnalysisFunctions.trim_and_fill_analysis(data, options, decimal_places, alpha, norm_ci) elif options.structure == JACKKNIFE: - (output, figure, fig_caption, - chart_data, citations) = MetaWinAnalysisFunctions.jackknife_meta_analysis(data, options, decimal_places, - alpha, norm_ci) + (output, figure, chart_data, + citations) = MetaWinAnalysisFunctions.jackknife_meta_analysis(data, options, decimal_places, alpha, norm_ci) analysis_values = None elif options.structure == PHYLOGENETIC_MA: output, citations = MetaWinAnalysisFunctions.phylogenetic_meta_analysis(data, options, tree, decimal_places, alpha, norm_ci) analysis_values = None figure = None - fig_caption = None chart_data = None elif options.structure == RANKCOR: output, citations = MetaWinAnalysisFunctions.rank_correlation_analysis(data, options, decimal_places) figure = None - fig_caption = None chart_data = None analysis_values = None else: output = [] analysis_values = None figure = None - fig_caption = None chart_data = None citations = [] all_citations.extend(citations) output_blocks.extend(output) output_blocks.extend(create_reference_list(all_citations)) - return output_blocks, figure, fig_caption, chart_data, analysis_values + return output_blocks, figure, chart_data, analysis_values def meta_analysis(sender, data, last_effect, last_var, decimal_places: int = 4, alpha: float = 0.05, @@ -1909,12 +1903,9 @@ def meta_analysis(sender, data, last_effect, last_var, decimal_places: int = 4, meta_analysis_options.structure = None if meta_analysis_options.structure is not None: - output, figure, fig_caption, chart_data, _ = do_meta_analysis(data, meta_analysis_options, decimal_places, - alpha, tree, norm_ci) + output, figure, chart_data, _ = do_meta_analysis(data, meta_analysis_options, decimal_places, alpha, tree, + norm_ci) sender.last_effect = meta_analysis_options.effect_data sender.last_var = meta_analysis_options.effect_vars - return output, figure, fig_caption, chart_data - else: - return None, None, None, None - else: - return None, None, None, None + return output, figure, chart_data + return None, None, None diff --git a/src/MetaWinAnalysisFunctions.py b/src/MetaWinAnalysisFunctions.py index 741c4d7..5982f53 100644 --- a/src/MetaWinAnalysisFunctions.py +++ b/src/MetaWinAnalysisFunctions.py @@ -13,8 +13,8 @@ import MetaWinConstants from MetaWinConstants import mean_data_tuple -from MetaWinUtils import create_output_table, inline_float, interval_to_str, create_reference_list, get_citation, \ - exponential_label, prob_z_score +from MetaWinUtils import create_output_table, inline_float, interval_to_str, get_citation, exponential_label, \ + prob_z_score import MetaWinCharts from MetaWinLanguage import get_text @@ -525,12 +525,12 @@ def output_filtered_bad(filtered: list, bad_data: list) -> list: return output_blocks -def caption_bootstrap_text(bs_n: int): - """ - extra figure caption info for forest plots with bootstrap confidence intervals - """ - citation = "Adams_et_1997" - return get_text("bootstrap_caption").format(bs_n, get_citation(citation)), [citation] +# def caption_bootstrap_text(bs_n: int): +# """ +# extra figure caption info for forest plots with bootstrap confidence intervals +# """ +# citation = "Adams_et_1997" +# return get_text("bootstrap_caption").format(bs_n, get_citation(citation)), [citation] # ---- I'm not convinced this is correct, which is why I'm removing it for now --- # def calc_aic(q: float, n: int, p: int) -> float: @@ -577,7 +577,7 @@ def simple_meta_analysis(data, options, decimal_places: int = 4, alpha: float = output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None n = len(e_data) citations = [] @@ -639,21 +639,22 @@ def simple_meta_analysis(data, options, decimal_places: int = 4, alpha: float = citations.extend(new_cites) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_forest_plot(effect_sizes.label, forest_data, alpha, - options.bootstrap_mean) - fig_caption = get_text("Forest plot of individual effect sizes for each study, as well as the overall " - "mean.") + MetaWinCharts.caption_forest_plot_text(effect_sizes.label, alpha) - if options.bootstrap_mean is not None: - new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) - fig_caption += new_text + create_reference_list(new_cites, True) + figure, chart_data = MetaWinCharts.chart_forest_plot("basic analysis", effect_sizes.label, forest_data, + alpha, options.bootstrap_mean) + # fig_caption = get_text("Forest plot of individual effect sizes for each study, as well as the overall " + # "mean.") + MetaWinCharts.common_forest_plot_caption(effect_sizes.label, alpha) + # if options.bootstrap_mean is not None: + # new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) + # # fig_caption += new_text + create_reference_list(new_cites, True) else: output_blocks.append([get_text("Fewer than two studies were valid for analysis")]) qt, df, p, pooled_var, i2 = None, None, None, None, None mean_data = None - return (output_blocks, figure, fig_caption, chart_data, simple_ma_values(mean_data, pooled_var, qt, df, p, i2), - citations) + # return (output_blocks, figure, fig_caption, chart_data, simple_ma_values(mean_data, pooled_var, qt, df, p, i2), + # citations) + return output_blocks, figure, chart_data, simple_ma_values(mean_data, pooled_var, qt, df, p, i2), citations # ---------- grouped meta-analysis ---------- @@ -716,7 +717,7 @@ def grouped_meta_analysis(data, options, decimal_places: int = 4, alpha: float = output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None n = len(e_data) g_cnt = len(group_names) @@ -863,13 +864,13 @@ def grouped_meta_analysis(data, options, decimal_places: int = 4, alpha: float = citations.extend(new_cites) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_forest_plot(effect_sizes.label, forest_data, alpha, - options.bootstrap_mean) - fig_caption = get_text("group_forest_plot").format(groups.label) + \ - MetaWinCharts.caption_forest_plot_text(effect_sizes.label, alpha) - if options.bootstrap_mean is not None: - new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) - fig_caption += new_text + create_reference_list(new_cites, True) + figure, chart_data = MetaWinCharts.chart_forest_plot("grouped analysis", effect_sizes.label, forest_data, + alpha, options.bootstrap_mean, groups.label) + # fig_caption = get_text("group_forest_plot").format(groups.label) + \ + # MetaWinCharts.common_forest_plot_caption(effect_sizes.label, alpha) + # if options.bootstrap_mean is not None: + # new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) + # fig_caption += new_text + create_reference_list(new_cites, True) global_values = simple_ma_values(global_mean_data, pooled_var, qt, df, pqt, i2) else: @@ -879,8 +880,10 @@ def grouped_meta_analysis(data, options, decimal_places: int = 4, alpha: float = model_het = None error_het = None - return (output_blocks, figure, fig_caption, chart_data, + return (output_blocks, figure, chart_data, group_ma_values(global_values, group_mean_values, group_het_values, model_het, error_het), citations) + # return (output_blocks, figure, fig_caption, chart_data, + # group_ma_values(global_values, group_mean_values, group_het_values, model_het, error_het), citations) # ---------- cumulative meta-analysis ---------- @@ -907,7 +910,7 @@ def cumulative_meta_analysis(data, options, decimal_places: int = 4, alpha: floa output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None n = len(tmp_data) if n > 1: @@ -970,17 +973,19 @@ def cumulative_meta_analysis(data, options, decimal_places: int = 4, alpha: floa decimal_places, alpha, options.log_transformed)) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_forest_plot(effect_sizes.label, cumulative_means, alpha, - options.bootstrap_mean) - fig_caption = get_text("cumulative_forest_plot").format(order.label) + \ - MetaWinCharts.caption_forest_plot_text(effect_sizes.label, alpha) - if options.bootstrap_mean is not None: - new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) - fig_caption += new_text + create_reference_list(new_cites, True) + figure, chart_data = MetaWinCharts.chart_forest_plot("cumulative analysis", effect_sizes.label, + cumulative_means, alpha, options.bootstrap_mean, + order.label) + # fig_caption = get_text("cumulative_forest_plot").format(order.label) + \ + # MetaWinCharts.common_forest_plot_caption(effect_sizes.label, alpha) + # if options.bootstrap_mean is not None: + # new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) + # fig_caption += new_text + create_reference_list(new_cites, True) else: output_blocks.append([get_text("Fewer than two studies were valid for analysis")]) - return output_blocks, figure, fig_caption, chart_data + return output_blocks, figure, chart_data + # return output_blocks, figure, fig_caption, chart_data # ---------- simple regression meta-analysis ---------- @@ -1033,7 +1038,7 @@ def regression_meta_analysis(data, options, decimal_places: int = 4, alpha: floa output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None model_het = None error_het = None @@ -1132,8 +1137,6 @@ def regression_meta_analysis(data, options, decimal_places: int = 4, alpha: floa citations.extend(new_cites) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_regression(options.independent_variable.label, effect_sizes.label, - x_data, e_data, b1_slope, b0_intercept) if options.random_effects: ref_list = "{}, {}, and {}".format(get_citation("Hedges_Olkin_1985"), get_citation("Greenland_1987"), @@ -1146,16 +1149,19 @@ def regression_meta_analysis(data, options, decimal_places: int = 4, alpha: floa get_citation("Greenland_1987")) model = get_text("fixed effects") fig_citations = ["Hedges_Olkin_1985", "Greenland_1987"] - - fig_caption = get_text("regression_caption").format(effect_sizes.label, options.independent_variable.label, - model, ref_list) + \ - create_reference_list(fig_citations, True) + figure, chart_data = MetaWinCharts.chart_regression(options.independent_variable.label, effect_sizes.label, + x_data, e_data, b1_slope, b0_intercept, model, + ref_list, fig_citations) + # fig_caption = get_text("regression_caption").format(effect_sizes.label, options.independent_variable.label, + # model, ref_list) + \ + # create_reference_list(fig_citations, True) else: output_blocks.append([get_text("Fewer than two studies were valid for analysis")]) - return (output_blocks, figure, fig_caption, chart_data, - reg_ma_values(global_values, model_het, error_het, predictors), citations) + return output_blocks, figure, chart_data, reg_ma_values(global_values, model_het, error_het, predictors), citations + # return (output_blocks, figure, fig_caption, chart_data, + # reg_ma_values(global_values, model_het, error_het, predictors), citations) # ---------- complex (glm) meta-analysis ---------- @@ -1580,7 +1586,7 @@ def nested_meta_analysis(data, options, decimal_places: int = 4, alpha: float = n = len(e_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None group_het_values = None group_mean_values = None @@ -1702,16 +1708,18 @@ def nested_meta_analysis(data, options, decimal_places: int = 4, alpha: float = citations.extend(new_cites) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_forest_plot(effect_sizes.label, forest_data, alpha, - options.bootstrap_mean) - fig_caption = get_text("nest_caption") + MetaWinCharts.caption_forest_plot_text(effect_sizes.label, alpha) - if options.bootstrap_mean is not None: - new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) - fig_caption += new_text + create_reference_list(new_cites, True) + figure, chart_data = MetaWinCharts.chart_forest_plot("nested analysis", effect_sizes.label, forest_data, + alpha, options.bootstrap_mean) + # fig_caption = get_text("nest_caption") + MetaWinCharts.common_forest_plot_caption(effect_sizes.label, alpha) + # if options.bootstrap_mean is not None: + # new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) + # fig_caption += new_text + create_reference_list(new_cites, True) - return (output_blocks, figure, fig_caption, chart_data, - group_ma_values(global_values, group_mean_values, group_het_values, model_het_values, error_het_values), - citations) + return (output_blocks, figure, chart_data, group_ma_values(global_values, group_mean_values, group_het_values, + model_het_values, error_het_values), citations) + # return (output_blocks, figure, fig_caption, chart_data, + # group_ma_values(global_values, group_mean_values, group_het_values, model_het_values, error_het_values), + # citations) # ---------- trim-and-fill analysis ---------- @@ -1745,7 +1753,7 @@ def trim_and_fill_analysis(data, options, decimal_places: int = 4, alpha: float output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None n = len(e_data) citations = [] @@ -1867,16 +1875,16 @@ def trim_and_fill_analysis(data, options, decimal_places: int = 4, alpha: float decimal_places, alpha, options.log_transformed)) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_trim_fill_plot(effect_sizes.label, tmp_data, n, original_mean, + figure, chart_data = MetaWinCharts.chart_trim_fill_plot(effect_sizes.label, tmp_data, n, original_mean, mean_e) - fig_caption = get_text("trim_fill_caption").format(effect_sizes.label, "Duval and Tweedie 2000a, b") - new_cites = ["Duval_Tweedie_2000a", "Duval_Tweedie_2000b"] - fig_caption += create_reference_list(new_cites, True) + # fig_caption = get_text("trim_fill_caption").format(effect_sizes.label, "Duval and Tweedie 2000a, b") + # new_cites = ["Duval_Tweedie_2000a", "Duval_Tweedie_2000b"] + # fig_caption += create_reference_list(new_cites, True) else: output_blocks.append([get_text("Fewer than two studies were valid for analysis")]) - return output_blocks, figure, fig_caption, chart_data, None, citations + return output_blocks, figure, chart_data, None, citations # ---------- phylogenetic meta-analysis ---------- @@ -2191,7 +2199,7 @@ def jackknife_meta_analysis(data, options, decimal_places: int = 4, alpha: float output_blocks = output_filtered_bad(filtered, bad_data) figure = None - fig_caption = None + # fig_caption = None chart_data = None n = len(e_data) citations = [] @@ -2286,17 +2294,17 @@ def jackknife_meta_analysis(data, options, decimal_places: int = 4, alpha: float citations.extend(new_cites) if options.create_graph: - figure, chart_data = MetaWinCharts.chart_forest_plot(effect_sizes.label, forest_data, alpha, - options.bootstrap_mean) - fig_caption = get_text("jackknife_forest_plot") + \ - MetaWinCharts.caption_forest_plot_text(effect_sizes.label, alpha) - if options.bootstrap_mean is not None: - new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) - fig_caption += new_text + create_reference_list(new_cites, True) + figure, chart_data = MetaWinCharts.chart_forest_plot("jackknife analysis", effect_sizes.label, forest_data, + alpha, options.bootstrap_mean) + # fig_caption = get_text("jackknife_forest_plot") + \ + # MetaWinCharts.common_forest_plot_caption(effect_sizes.label, alpha) + # if options.bootstrap_mean is not None: + # new_text, new_cites = caption_bootstrap_text(options.bootstrap_mean) + # fig_caption += new_text + create_reference_list(new_cites, True) else: output_blocks.append([get_text("Fewer than two studies were valid for analysis")]) - return output_blocks, figure, fig_caption, chart_data, citations + return output_blocks, figure, chart_data, citations # ---------- rank correlation analysis ---------- diff --git a/src/MetaWinCharts.py b/src/MetaWinCharts.py index 10c51ad..d95c02a 100644 --- a/src/MetaWinCharts.py +++ b/src/MetaWinCharts.py @@ -11,11 +11,16 @@ import numpy import scipy.stats -from MetaWinUtils import exponential_label +from MetaWinUtils import exponential_label, get_citation, create_reference_list from MetaWinLanguage import get_text import MetaWinWidgets +# weighting options for the histograms +WEIGHT_NONE = 0 +WEIGHT_INVVAR = 1 +WEIGHT_N = 2 + LINE_STYLES = ("solid", "dashed", "dotted", "dashdot") # MARKER_STYLES = {"point": ".", "circle": "o", "downward triangle": "v", "upward triangle": "^", # "left triangle": "<", "right triangle": ">", "downard tri": "1", "upward tri": "2", "left tri": "3", @@ -35,6 +40,7 @@ "centered right caret": 9} +# ---------- Chart Data Classes ---------- # class BaseChartData: def __init__(self): self.name = "" @@ -383,19 +389,200 @@ def create_edit_panel(self): return self.edit_panel +# ---------- Chart Caption Classes ---------- # +class NormalQuantileCaption: + def __init__(self): + self.upper_limit = None + self.lower_limit = None + self.horizontal_mean = None + self.vertical_mean = None + self.regression = None + self.regression_scatter = None + + def __str__(self): + "Normal Quantile plot following {}. The " + "standardized effect size is the effect size divided by the " + "square-root of its variance. The solid line represents the " + "regression and the dashed lines the 95% prediction envelope." + + return get_text("normal_quantile_caption").format(get_citation("Wang_and_Bushman_1998")) + \ + create_reference_list(["Wang_and_Bushman_1998"], True) + + +class ScatterCaption: + def __init__(self): + self.x_label = "" + self.y_label = "" + + def __str__(self): + return get_text("Scatter plot of {} vs. {}.").format(self.y_label, self.x_label) + + +class HistogramCaption: + def __init__(self): + self.e_label = "" + self.weight_type = WEIGHT_NONE + + def __str__(self): + caption = get_text("Histogram of {} from individual studies.").format(self.e_label) + if self.weight_type == WEIGHT_INVVAR: + caption += get_text(" Counts were weighted by the inverse of the variance of each effect size.") + elif self.weight_type == WEIGHT_N: + caption += get_text(" Counts were weighted by a sample size associated with each effect size.") + return caption + + +class RadialCaption: + def __init__(self): + self.e_label = "" + + def __str__(self): + return get_text("Radial_chart_caption").format(self.e_label) + + +class ForestPlotBaseCaption: + def __init__(self): + self.e_label = "" + self.alpha = 0.05 + self.bootstrap_n = None + + +class ForestPlotCaption(ForestPlotBaseCaption): + def __str__(self): + return get_text("Forest plot of individual effect sizes for each study.") + \ + common_forest_plot_caption(self.e_label, self.alpha, inc_median=False) + + +class RegressionCaption: + def __init__(self): + self.e_label = "" + self.i_label = "" + self.model = "" + self.ref_list = "" + self.citations = [] + + def __str__(self): + return get_text("regression_caption").format(self.e_label, self.i_label, self.model, self.ref_list) + \ + create_reference_list(self.citations, True) + + +class TrimAndFillCaption: + def __init__(self): + self.e_label = "" + self.original_scatter = None + self.inferred_scatter = None + self.original_mean = None + self.inferred_mean = None + + def __str__(self): + "Funnel plot of {} vs. precision, showing the results of a Trim and " + "Fill Analysis ({}). Solid black circles represent the original data; " + "open red circles represent inferred \"missing\" data. The dashed line " + "represents the mean effect size of the original data, the dotted line " + "the mean effect size including the inferred data." + new_cites = ["Duval_Tweedie_2000a", "Duval_Tweedie_2000b"] + return get_text("trim_fill_caption").format(self.e_label, "Duval and Tweedie 2000a, b") + \ + create_reference_list(new_cites, True) + + +class BasicAnalysisCaption(ForestPlotBaseCaption): + def __str__(self): + return get_text("Forest plot of individual effect sizes for each study, as well as the overall mean.") + \ + common_forest_plot_caption(self.e_label, self.alpha, self.bootstrap_n) + + +class GroupedAnalysisCaption(ForestPlotBaseCaption): + def __init__(self): + super().__init__() + self.group_label = "" + + def __str__(self): + return get_text("group_forest_plot").format(self.group_label) + \ + common_forest_plot_caption(self.e_label, self.alpha, self.bootstrap_n) + + +class NestedAnalysisCaption(ForestPlotBaseCaption): + def __str__(self): + return get_text("nest_caption") + common_forest_plot_caption(self.e_label, self.alpha, self.bootstrap_n) + + +class CumulativeAnalysisCaption(ForestPlotBaseCaption): + def __init__(self): + super().__init__() + self.order_label = "" + + def __str__(self): + return get_text("cumulative_forest_plot").format(self.order_label) + \ + common_forest_plot_caption(self.e_label, self.alpha, self.bootstrap_n) + + +class JackknifeAnalysisCaption(ForestPlotBaseCaption): + def __str__(self): + return get_text("jackknife_forest_plot") + common_forest_plot_caption(self.e_label, self.alpha, + self.bootstrap_n) + + +def common_forest_plot_caption(effect_name: str, alpha: float = 0.05, bootstrap_n: Optional[int] = None, + inc_median: bool = True) -> str: + # " Effect size measured as {}. The dotted vertical line " + # "represents no effect, or a mean of zero. Circles represent " + # "mean effect size, with the corresponding line " + # "the {:0.0%} confidence interval." + # + text = get_text("forest_plot_common_caption").format(effect_name, 1 - alpha) + if inc_median: + text += get_text("forest_plot_median_caption") + if bootstrap_n is not None: + citation = "Adams_et_1997" + text += get_text("bootstrap_caption").format(bootstrap_n, get_citation(citation)) + \ + create_reference_list([citation], True) + return text + + +# ---------- Main Chart Data Class ---------- # class ChartData: """ an object to contain all data that appears on charts this will allow chart data exporting, as well as open up the possibility of figure editing """ - def __init__(self): + def __init__(self, caption_type): self.x_label = "" self.y_label = "" self.data = [] # special adjustments self.suppress_y = False self.rescale_x = None + # caption + if caption_type == "normal quantile": + self.caption = NormalQuantileCaption() + elif caption_type == "scatter plot": + self.caption = ScatterCaption() + elif caption_type == "histogram": + self.caption = HistogramCaption() + elif caption_type == "radial": + self.caption = RadialCaption() + elif caption_type == "regression": + self.caption = RegressionCaption() + elif caption_type == "trim and fill": + self.caption = TrimAndFillCaption() + elif caption_type == "basic analysis": + self.caption = BasicAnalysisCaption() + elif caption_type == "grouped analysis": + self.caption = GroupedAnalysisCaption() + elif caption_type == "nested analysis": + self.caption = NestedAnalysisCaption() + elif caption_type == "cumulative analysis": + self.caption = CumulativeAnalysisCaption() + elif caption_type == "jackknife analysis": + self.caption = JackknifeAnalysisCaption() + elif caption_type == "forest plot": + self.caption = ForestPlotCaption() + else: + self.caption = "" + + def caption_text(self): + return str(self.caption) def add_scatter(self, name: str, x_data, y_data, marker: Union[str, int] = "o", label="", zorder=0, color="#1f77b4", edgecolors="#1f77b4", size=36, linewidths=1.5, linestyle="solid"): @@ -412,6 +599,7 @@ def add_scatter(self, name: str, x_data, y_data, marker: Union[str, int] = "o", new_scatter.linewidths = linewidths new_scatter.linestyle = linestyle self.data.append(new_scatter) + return new_scatter def add_line(self, name: str, x_min, y_min, x_max, y_max, linestyle="solid", color="silver", zorder=0, linewidth=1.5): @@ -424,6 +612,7 @@ def add_line(self, name: str, x_min, y_min, x_max, y_max, linestyle="solid", col new_line.zorder = zorder new_line.linewidth = linewidth self.data.append(new_line) + return new_line def add_histogram(self, name, cnts, bins, linewidth=1, edgecolor="black", color="#1f77b4", linestyle="solid"): new_hist = HistogramData() @@ -435,6 +624,7 @@ def add_histogram(self, name, cnts, bins, linewidth=1, edgecolor="black", color= new_hist.edgecolor = edgecolor new_hist.color = color self.data.append(new_hist) + return new_hist def add_arc(self, name, xc, yc, height, width, start_angle, end_angle, zorder=0, edgecolor="silver", linestyle="solid", linewidth=1.5): @@ -451,6 +641,7 @@ def add_arc(self, name, xc, yc, height, width, start_angle, end_angle, zorder=0, new_arc.linestyle = linestyle new_arc.linewidth = linewidth self.data.append(new_arc) + return new_arc def add_multi_line(self, name, x_values, y_values, linestyle="solid", color="silver", zorder=0, linewidth=1.5): new_ml = LineData() @@ -462,6 +653,7 @@ def add_multi_line(self, name, x_values, y_values, linestyle="solid", color="sil new_ml.zorder = zorder new_ml.linewidth = linewidth self.data.append(new_ml) + return new_ml def add_ci(self, name, min_x, max_x, y, zorder=0, color="#1f77b4", linestyle="solid", linewidth=1.5): new_ci = ForestCIData() @@ -474,6 +666,7 @@ def add_ci(self, name, min_x, max_x, y, zorder=0, color="#1f77b4", linestyle="so new_ci.linestyle = linestyle new_ci.linewidth = linewidth self.data.append(new_ci) + return new_ci def add_labels(self, name, labels, y_data): new_labels = LabelData() @@ -481,6 +674,7 @@ def add_labels(self, name, labels, y_data): new_labels.labels = labels new_labels.y_pos = y_data self.data.append(new_labels) + return new_labels def add_annotations(self, name, annotations, x_data, y_data): new_annotation = AnnotationData() @@ -489,6 +683,7 @@ def add_annotations(self, name, annotations, x_data, y_data): new_annotation.y = y_data new_annotation.annotations = annotations self.data.append(new_annotation) + return new_annotation def export_to_list(self): outlist = ["X-axis label\t{}\n".format(self.x_label), @@ -557,9 +752,18 @@ def create_figure(chart_data): return figure_canvas -def chart_forest_plot(effect_name, forest_data, alpha: float = 0.05, - bootstrap_n: Optional[int] = None) -> Tuple[FigureCanvasQTAgg, ChartData]: - chart_data = ChartData() +def chart_forest_plot(analysis_type: str, effect_name, forest_data, alpha: float = 0.05, + bootstrap_n: Optional[int] = None, + extra_name: Optional[str] = None) -> Tuple[FigureCanvasQTAgg, ChartData]: + chart_data = ChartData(analysis_type) + chart_data.caption.e_label = effect_name + chart_data.caption.alpha = alpha + chart_data.caption.bootstrap_n = bootstrap_n + if analysis_type == "grouped analysis": + chart_data.caption.group_label = extra_name + elif analysis_type == "cumulative analysis": + chart_data.caption.order_label = extra_name + chart_data.x_label = effect_name chart_data.suppress_y = True @@ -619,13 +823,6 @@ def chart_forest_plot(effect_name, forest_data, alpha: float = 0.05, return figure_canvas, chart_data -def caption_forest_plot_text(effect_name: str, alpha: float = 0.05, inc_median: bool = True) -> str: - text = get_text("forest_plot_common_caption").format(effect_name, 1 - alpha) - if inc_median: - text += get_text("forest_plot_median_caption") - return text - - def add_regression_to_chart(x_name: str, y_name: str, x_data, y_data, slope: float, intercept: float, x_min: float, x_max: float, chart_data) -> None: y_at_min = slope*x_min + intercept @@ -633,14 +830,22 @@ def add_regression_to_chart(x_name: str, y_name: str, x_data, y_data, slope: flo chart_data.x_label = x_name chart_data.y_label = y_name - chart_data.add_scatter(get_text("Point Data"), x_data, y_data, zorder=10) - chart_data.add_line(get_text("Regression Line"), x_min, y_at_min, x_max, y_at_max, zorder=8, color="silver") + chart_data.caption.regression_scatter = chart_data.add_scatter(get_text("Point Data"), x_data, y_data, zorder=10) + chart_data.caption.regression = chart_data.add_line(get_text("Regression Line"), x_min, y_at_min, x_max, y_at_max, + zorder=8, color="silver") -def chart_regression(x_name, y_name, x_data, y_data, slope, intercept) -> Tuple[FigureCanvasQTAgg, ChartData]: +def chart_regression(x_name, y_name, x_data, y_data, slope, intercept, model, ref_list, + citations) -> Tuple[FigureCanvasQTAgg, ChartData]: x_min = numpy.min(x_data) x_max = numpy.max(x_data) - chart_data = ChartData() + chart_data = ChartData("regression") + chart_data.caption.e_label = y_name + chart_data.caption.i_label = x_name + chart_data.caption.model = model + chart_data.caption.ref_list = ref_list + chart_data.caption.citations = citations + add_regression_to_chart(x_name, y_name, x_data, y_data, slope, intercept, x_min, x_max, chart_data) figure_canvas = create_figure(chart_data) @@ -668,21 +873,22 @@ def add_quantile_axes_to_chart(x_data, y_data, slope: float, intercept: float, c y_lower = [y_pos[i] - t_score*math.sqrt(mse*(1 + 1/n + ((x_pos[i] - x_mean)**2)/ss_x)) for i in range(nsteps)] y_upper = [y_pos[i] + t_score*math.sqrt(mse*(1 + 1/n + ((x_pos[i] - x_mean)**2)/ss_x)) for i in range(nsteps)] - chart_data.add_multi_line(get_text("Lower Prediction Limit"), x_pos, y_lower, linestyle="dashed", color="silver", - zorder=3) - chart_data.add_multi_line(get_text("Upper Prediction Limit"), x_pos, y_upper, linestyle="dashed", color="silver", - zorder=3) + chart_data.caption.lower_limit = chart_data.add_multi_line(get_text("Lower Prediction Limit"), x_pos, y_lower, + linestyle="dashed", color="silver", zorder=3) + chart_data.caption.upper_limit = chart_data.add_multi_line(get_text("Upper Prediction Limit"), x_pos, y_upper, + linestyle="dashed", color="silver", zorder=3) # draw center lines - chart_data.add_line(get_text("Horizontal Axis Mean Line"), 0, min(y_min, min(y_lower)), 0, max(y_max, max(y_upper)), - linestyle="dotted", color="silver") - chart_data.add_line(get_text("Vertical Axis Mean Line"), x_min, y_mean, x_max, y_mean, linestyle="dotted", - color="silver") + chart_data.caption.horizontal_mean = chart_data.add_line(get_text("Horizontal Axis Mean Line"), 0, + min(y_min, min(y_lower)), 0, max(y_max, max(y_upper)), + linestyle="dotted", color="silver") + chart_data.caption.vertical_mean = chart_data.add_line(get_text("Vertical Axis Mean Line"), x_min, y_mean, x_max, + y_mean, linestyle="dotted", color="silver") def chart_normal_quantile(x_name, y_name, x_data, y_data, slope, intercept, alpha: float = 0.05) -> Tuple[FigureCanvasQTAgg, ChartData]: - chart_data = ChartData() + chart_data = ChartData("normal quantile") add_quantile_axes_to_chart(x_data, y_data, slope, intercept, chart_data, alpha) x_min = numpy.min(x_data) x_max = numpy.max(x_data) @@ -769,7 +975,8 @@ def add_radial_curve_to_chart(effect_label: str, r: float, min_e: float, max_e: def chart_radial(e_name, x_data, y_data, slope, min_e, max_e, is_log: bool = False) -> Tuple[FigureCanvasQTAgg, ChartData]: - chart_data = ChartData() + chart_data = ChartData("radial") + chart_data.caption.e_label = e_name max_d = numpy.max(numpy.sqrt(numpy.square(x_data) + numpy.square(y_data)))+1 x_min = 0 x_max = (max_d + 1)*math.cos(math.atan(slope)) @@ -782,15 +989,25 @@ def chart_radial(e_name, x_data, y_data, slope, min_e, max_e, is_log: bool = Fal return figure_canvas, chart_data -def chart_histogram(e_data, w_data, n_bins, e_label, weighted: bool = False) -> Tuple[FigureCanvasQTAgg, ChartData]: - if weighted: - cnts, bins = numpy.histogram(e_data, n_bins, weights=w_data) - y_label = get_text("Weighted Count") - else: +def chart_histogram(e_data, w_data, n_bins, e_label, + weighted: int = WEIGHT_NONE) -> Tuple[FigureCanvasQTAgg, ChartData]: + if weighted == WEIGHT_NONE: cnts, bins = numpy.histogram(e_data, n_bins) y_label = get_text("Count") + else: + cnts, bins = numpy.histogram(e_data, n_bins, weights=w_data) + y_label = get_text("Weighted Count") + # if weighted: + # cnts, bins = numpy.histogram(e_data, n_bins, weights=w_data) + # y_label = get_text("Weighted Count") + # else: + # cnts, bins = numpy.histogram(e_data, n_bins) + # y_label = get_text("Count") + + chart_data = ChartData("histogram") + chart_data.caption.e_label = e_label + chart_data.caption.weight_type = weighted - chart_data = ChartData() chart_data.x_label = e_label chart_data.y_label = y_label chart_data.add_histogram("Bin Counts", cnts, bins, edgecolor="black", linewidth=1) @@ -893,7 +1110,9 @@ def chart_phylogeny(root) -> FigureCanvasQTAgg: def chart_scatter(x_data, y_data, x_label: str = "x", y_label: str = "y") -> Tuple[FigureCanvasQTAgg, ChartData]: - chart_data = ChartData() + chart_data = ChartData("scatter plot") + chart_data.caption.x_label = x_label + chart_data.caption.y_label = y_label chart_data.x_label = x_label chart_data.y_label = y_label chart_data.add_scatter(get_text("Point Data"), x_data, y_data) @@ -903,27 +1122,31 @@ def chart_scatter(x_data, y_data, x_label: str = "x", y_label: str = "y") -> Tup def chart_trim_fill_plot(effect_label, data, n, original_mean, new_mean) -> Tuple[FigureCanvasQTAgg, ChartData]: - chart_data = ChartData() + chart_data = ChartData("trim and fill") + chart_data.caption.e_label = effect_label chart_data.x_label = effect_label chart_data.y_label = "{} (1/SE)".format(get_text("Precision")) # plot original points x_data = data[:n, 0] y_data = numpy.reciprocal(numpy.sqrt(data[:n, 2])) - chart_data.add_scatter(get_text("Original Data"), x_data, y_data, color="black", edgecolors="black") + chart_data.caption.original_scatter = chart_data.add_scatter(get_text("Original Data"), x_data, y_data, + color="black", edgecolors="black") y_min = numpy.min(y_data) y_max = numpy.max(y_data) # plot inferred points x_data = data[n:, 0] y_data = numpy.reciprocal(numpy.sqrt(data[n:, 2])) - chart_data.add_scatter(get_text("Inferred Data"), x_data, y_data, edgecolors="red", color="none") + chart_data.caption.inferred_scatter = chart_data.add_scatter(get_text("Inferred Data"), x_data, y_data, + edgecolors="red", color="none") # draw original and new mean - chart_data.add_line(get_text("Original Mean"), original_mean, y_min, original_mean, y_max, color="silver", - linestyle="dashed", zorder=1) - chart_data.add_line(get_text("Inferred Mean"), new_mean, y_min, new_mean, y_max, color="red", linestyle="dashed", - zorder=1) + chart_data.caption.original_mean = chart_data.add_line(get_text("Original Mean"), original_mean, y_min, + original_mean, y_max, color="silver", linestyle="dashed", + zorder=1) + chart_data.caption.inferred_mean = chart_data.add_line(get_text("Inferred Mean"), new_mean, y_min, new_mean, y_max, + color="red", linestyle="dashed", zorder=1) figure_canvas = create_figure(chart_data) return figure_canvas, chart_data diff --git a/src/MetaWinDraw.py b/src/MetaWinDraw.py index 8e45445..bc53f10 100644 --- a/src/MetaWinDraw.py +++ b/src/MetaWinDraw.py @@ -22,17 +22,10 @@ import MetaWinConstants from MetaWinConstants import mean_data_tuple from MetaWinWidgets import add_ok_cancel_help_button_layout, add_effect_choice_to_dialog -from MetaWinUtils import create_reference_list, get_citation import MetaWinCharts from MetaWinLanguage import get_text -# weighting options for the histograms -WEIGHT_NONE = 0 -WEIGHT_INVVAR = 1 -WEIGHT_N = 2 - - class MetaAnalysisDrawScatterDialog(QDialog): def __init__(self, data: MetaWinData): super().__init__() @@ -378,9 +371,9 @@ def draw_scatter_plot(data, x_data_col, y_data_col): x_data = numpy.array(x_data) y_data = numpy.array(y_data) figure, chart_data = MetaWinCharts.chart_scatter(x_data, y_data, x_data_col.label, y_data_col.label) - fig_caption = get_text("Scatter plot of {} vs. {}.").format(y_data_col.label, x_data_col.label) - return figure, fig_caption, chart_data - return None, None, None + # fig_caption = get_text("Scatter plot of {} vs. {}.").format(y_data_col.label, x_data_col.label) + return figure, chart_data + return None, None def draw_scatter_dialog(sender, data): @@ -388,12 +381,12 @@ def draw_scatter_dialog(sender, data): if sender.draw_dialog.exec(): x_data_col = sender.draw_dialog.columns[sender.draw_dialog.x_box.currentIndex()] y_data_col = sender.draw_dialog.columns[sender.draw_dialog.y_box.currentIndex()] - figure, fig_caption, chart_data = draw_scatter_plot(data, x_data_col, y_data_col) + figure, chart_data = draw_scatter_plot(data, x_data_col, y_data_col) if figure is not None: - return figure, fig_caption, chart_data + return figure, chart_data else: MetaWinMessages.report_critical(sender, "Error", "No valid data found for given options.") - return None, None, None + return None, None def calculate_regression(x: numpy.array, y: numpy.array) -> Tuple[float, float]: @@ -439,11 +432,11 @@ def draw_normal_quantile_plot(data, e_data_col, v_data_col, alpha: float = 0.05) figure, chart_data = MetaWinCharts.chart_normal_quantile(get_text("Normal Quantile"), get_text("Standardized Effect Size"), x_data, y_data, slope, intercept, alpha) - fig_caption = get_text("normal_quantile_caption").format(get_citation("Wang_and_Bushman_1998")) + \ - create_reference_list(["Wang_and_Bushman_1998"], True) + # fig_caption = get_text("normal_quantile_caption").format(get_citation("Wang_and_Bushman_1998")) + \ + # create_reference_list(["Wang_and_Bushman_1998"], True) - return figure, fig_caption, chart_data - return None, None, None + return figure, chart_data + return None, None def draw_normal_quantile_dialog(sender, data, last_effect, last_var, alpha: float = 0.05): @@ -451,12 +444,12 @@ def draw_normal_quantile_dialog(sender, data, last_effect, last_var, alpha: floa if sender.draw_dialog.exec(): e_data_col = sender.draw_dialog.columns[sender.draw_dialog.effect_size_box.currentIndex()] v_data_col = sender.draw_dialog.columns[sender.draw_dialog.variance_box.currentIndex()] - figure, fig_caption, chart_data = draw_normal_quantile_plot(data, e_data_col, v_data_col, alpha) + figure, chart_data = draw_normal_quantile_plot(data, e_data_col, v_data_col, alpha) if figure is not None: - return figure, fig_caption, chart_data + return figure, chart_data else: MetaWinMessages.report_critical(sender, "Error", "No valid data found for given options.") - return None, None, None + return None, None def draw_radial_plot(data, e_data_col, v_data_col, is_log: bool = False): @@ -489,10 +482,10 @@ def draw_radial_plot(data, e_data_col, v_data_col, is_log: bool = False): figure, chart_data = MetaWinCharts.chart_radial(e_data_col.label, x_data, y_data, slope_through_origin, min_e, max_e, is_log) - fig_caption = get_text("Radial_chart_caption").format(e_data_col.label) - fig_caption += create_reference_list(["Galbraith_1988", "Galbraith_1994"], True) - return figure, fig_caption, chart_data - return None, None, None + # fig_caption = get_text("Radial_chart_caption").format(e_data_col.label) + # fig_caption += create_reference_list(["Galbraith_1988", "Galbraith_1994"], True) + return figure, chart_data + return None, None def draw_radial_dialog(sender, data, last_effect, last_var): @@ -501,12 +494,12 @@ def draw_radial_dialog(sender, data, last_effect, last_var): e_data_col = sender.draw_dialog.columns[sender.draw_dialog.effect_size_box.currentIndex()] v_data_col = sender.draw_dialog.columns[sender.draw_dialog.variance_box.currentIndex()] is_log = sender.draw_dialog.log_transform_box.isChecked() - figure, fig_caption, chart_data = draw_radial_plot(data, e_data_col, v_data_col, is_log) + figure, chart_data = draw_radial_plot(data, e_data_col, v_data_col, is_log) if figure is not None: - return figure, fig_caption, chart_data + return figure, chart_data else: MetaWinMessages.report_critical(sender, "Error", "No valid data found for given options.") - return None, None, None + return None, None def draw_histogram_plot(data, e_data_col, w_data_col, weight_type, n_bins: int): @@ -517,10 +510,10 @@ def draw_histogram_plot(data, e_data_col, w_data_col, weight_type, n_bins: int): for r, row in enumerate(data.rows): if row.not_filtered(): e = data.check_value(r, e_data_col.position(), value_type=MetaWinConstants.VALUE_NUMBER) - if weight_type != WEIGHT_NONE: + if weight_type != MetaWinCharts.WEIGHT_NONE: w = data.check_value(r, w_data_col.position(), value_type=MetaWinConstants.VALUE_NUMBER) if (e is not None) and (w is not None): - if weight_type == WEIGHT_INVVAR: + if weight_type == MetaWinCharts.WEIGHT_INVVAR: if w > 0: w_data.append(1/w) e_data.append(e) @@ -540,20 +533,9 @@ def draw_histogram_plot(data, e_data_col, w_data_col, weight_type, n_bins: int): if len(e_data) > 0: e_data = numpy.array(e_data) w_data = numpy.array(w_data) - if weight_type == WEIGHT_NONE: - weighted = False - else: - weighted = True - - figure, chart_data = MetaWinCharts.chart_histogram(e_data, w_data, n_bins, e_data_col.label, weighted) - fig_caption = get_text("Histogram of {} from individual studies.").format(e_data_col.label) - if weight_type == WEIGHT_INVVAR: - fig_caption += get_text(" Counts were weighted by the inverse of the variance of each effect size.") - elif weight_type == WEIGHT_N: - fig_caption += get_text(" Counts were weighted by a sample size associated with each effect size.") - return figure, fig_caption, chart_data - else: - return None, None, None + figure, chart_data = MetaWinCharts.chart_histogram(e_data, w_data, n_bins, e_data_col.label, weight_type) + return figure, chart_data + return None, None def draw_histogram_dialog(sender, data, last_effect, last_var): @@ -562,18 +544,18 @@ def draw_histogram_dialog(sender, data, last_effect, last_var): e_data_col = sender.draw_dialog.columns[sender.draw_dialog.effect_size_box.currentIndex()] w_data_col = sender.draw_dialog.columns[sender.draw_dialog.weight_box.currentIndex()] if sender.draw_dialog.weight_var.isChecked(): - weight_type = WEIGHT_INVVAR + weight_type = MetaWinCharts.WEIGHT_INVVAR elif sender.draw_dialog.weight_n.isChecked(): - weight_type = WEIGHT_N + weight_type = MetaWinCharts.WEIGHT_N else: - weight_type = WEIGHT_NONE + weight_type = MetaWinCharts.WEIGHT_NONE n_bins = int(sender.draw_dialog.bin_edit.text()) - figure, fig_caption, chart_data = draw_histogram_plot(data, e_data_col, w_data_col, weight_type, n_bins) + figure, chart_data = draw_histogram_plot(data, e_data_col, w_data_col, weight_type, n_bins) if figure is not None: - return figure, fig_caption, chart_data + return figure, chart_data else: MetaWinMessages.report_critical(sender, "Error", "No valid data found for given options.") - return None, None, None + return None, None def draw_forest_plot(data, e_data_col, v_data_col, alpha: float = 0.05): @@ -594,11 +576,11 @@ def draw_forest_plot(data, e_data_col, v_data_col, alpha: float = 0.05): else: filtered.append(row.label) - figure, chart_data = MetaWinCharts.chart_forest_plot(e_data_col.label, data_list, alpha, None) + figure, chart_data = MetaWinCharts.chart_forest_plot("forest plot", e_data_col.label, data_list, alpha, None) - fig_caption = get_text("Forest plot of individual effect sizes for each study.") + \ - MetaWinCharts.caption_forest_plot_text(e_data_col.label, alpha, inc_median=False) - return figure, fig_caption, chart_data + # fig_caption = get_text("Forest plot of individual effect sizes for each study.") + \ + # MetaWinCharts.common_forest_plot_caption(e_data_col.label, alpha, inc_median=False) + return figure, chart_data def draw_forest_dialog(sender, data, last_effect, last_var, alpha: float = 0.05): @@ -606,12 +588,12 @@ def draw_forest_dialog(sender, data, last_effect, last_var, alpha: float = 0.05) if sender.draw_dialog.exec(): e_data_col = sender.draw_dialog.columns[sender.draw_dialog.effect_size_box.currentIndex()] v_data_col = sender.draw_dialog.columns[sender.draw_dialog.variance_box.currentIndex()] - figure, fig_caption, chart_data = draw_forest_plot(data, e_data_col, v_data_col, alpha) + figure, chart_data = draw_forest_plot(data, e_data_col, v_data_col, alpha) if figure is not None: - return figure, fig_caption, chart_data + return figure, chart_data else: MetaWinMessages.report_critical(sender, "Error", "No valid data found for given options.") - return None, None, None + return None, None def edit_figure(sender, chart_data): diff --git a/src/MetaWinMain.py b/src/MetaWinMain.py index 136d774..2fde591 100644 --- a/src/MetaWinMain.py +++ b/src/MetaWinMain.py @@ -77,7 +77,6 @@ def __init__(self, config: dict): self.empty_col_num = 10 self.empty_row_num = 15 self.chart_data = None - self.chart_caption = "" self.init_ui() def init_ui(self): @@ -696,18 +695,18 @@ def meta_analysis(self) -> None: norm_ci = False else: norm_ci = True - output, figure, fig_caption, chart_data = MetaWinAnalysis.meta_analysis(self, self.data, self.last_effect, - self.last_var, self.output_decimals, - self.alpha, self.phylogeny, norm_ci) + output, figure, chart_data = MetaWinAnalysis.meta_analysis(self, self.data, self.last_effect, + self.last_var, self.output_decimals, + self.alpha, self.phylogeny, norm_ci) if output is not None: self.write_multi_output_blocks(output) self.main_area.setCurrentIndex(1) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) else: MetaWinMessages.report_warning(self, get_text("Warning"), get_text("No data has been loaded.")) - def show_figure(self, figure, fig_caption: str, chart_data) -> None: + def show_figure(self, figure, chart_data) -> None: """ Replace the current figure in the graphics tab with a new figure, toolbar, and caption """ @@ -720,8 +719,7 @@ def show_figure(self, figure, fig_caption: str, chart_data) -> None: toolbar = NavigationToolbar2QT(figure, None) self.save_graph_action.triggered.connect(toolbar.save_figure) caption_box = QTextEdit() - caption_box.setText(fig_caption) - self.chart_caption = fig_caption + caption_box.setText(chart_data.caption_text()) self.graph_layout.addWidget(figure, stretch=8) self.graph_layout.addWidget(caption_box, stretch=1) self.chart_data = chart_data @@ -744,41 +742,39 @@ def refresh_tree_panel(self) -> None: def draw_scatter_plot(self) -> None: if self.data is not None: - figure, fig_caption, chart_data = MetaWinDraw.draw_scatter_dialog(self, self.data) + figure, chart_data = MetaWinDraw.draw_scatter_dialog(self, self.data) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) self.main_area.setCurrentIndex(2) def draw_histogram(self) -> None: if self.data is not None: - figure, fig_caption, chart_data = MetaWinDraw.draw_histogram_dialog(self, self.data, self.last_effect, - self.last_var) + figure, chart_data = MetaWinDraw.draw_histogram_dialog(self, self.data, self.last_effect, self.last_var) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) self.main_area.setCurrentIndex(2) def draw_normal_quantile_plot(self) -> None: if self.data is not None: - figure, fig_caption, chart_data = MetaWinDraw.draw_normal_quantile_dialog(self, self.data, self.last_effect, - self.last_var) + figure, chart_data = MetaWinDraw.draw_normal_quantile_dialog(self, self.data, self.last_effect, + self.last_var) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) self.main_area.setCurrentIndex(2) def draw_radial_plot(self) -> None: if self.data is not None: - figure, fig_caption, chart_data = MetaWinDraw.draw_radial_dialog(self, self.data, self.last_effect, - self.last_var) + figure, chart_data = MetaWinDraw.draw_radial_dialog(self, self.data, self.last_effect, self.last_var) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) self.main_area.setCurrentIndex(2) def draw_forest_plot(self) -> None: if self.data is not None: - figure, fig_caption, chart_data = MetaWinDraw.draw_forest_dialog(self, self.data, self.last_effect, - self.last_var, self.alpha) + figure, chart_data = MetaWinDraw.draw_forest_dialog(self, self.data, self.last_effect, self.last_var, + self.alpha) if figure is not None: - self.show_figure(figure, fig_caption, chart_data) + self.show_figure(figure, chart_data) self.main_area.setCurrentIndex(2) def clear_filters(self) -> None: @@ -851,8 +847,7 @@ def edit_graph(self): if self.chart_data is not None: figure = MetaWinDraw.edit_figure(self, self.chart_data) if figure is not None: - caption = self.chart_caption - self.show_figure(figure, caption, self.chart_data) + self.show_figure(figure, self.chart_data) def change_conf_int_distribution(self): if self.confidence_interval_dist == "Normal": diff --git a/tests/test_metawin.py b/tests/test_metawin.py index b47364a..237f6e4 100644 --- a/tests/test_metawin.py +++ b/tests/test_metawin.py @@ -28,7 +28,7 @@ import MetaWinDraw -TEST_FIGURES = False +TEST_FIGURES = True class TestFigureDialog(QDialog): @@ -291,11 +291,11 @@ def test_simple_meta_analysis(): options.rosenberg_failsafe = 0.05 options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() mean_values = analysis_values.mean_data @@ -328,11 +328,11 @@ def test_simple_meta_analysis_lep(): options.effect_vars = data.cols[5] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() mean_values = analysis_values.mean_data @@ -365,11 +365,11 @@ def test_simple_meta_analysis_lep_randeff(): options.effect_vars = data.cols[5] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() mean_values = analysis_values.mean_data @@ -405,7 +405,7 @@ def test_simple_meta_analysis_random_effects(): options.rosenthal_failsafe = 0.05 options.rosenberg_failsafe = 0.05 - output, _, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) mean_values = analysis_values.mean_data @@ -443,10 +443,10 @@ def test_simple_meta_analysis_bootstrap(): options.bootstrap_mean = 9999 options.create_graph = True - output, figure, fig_caption, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -483,11 +483,11 @@ def test_group_meta_analysis_lep_suborders(): options.groups = data.cols[1] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -537,11 +537,11 @@ def test_group_meta_analysis_lep_suborders_rand_eff(): options.random_effects = True options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -618,11 +618,11 @@ def test_group_meta_analysis_lep_families(): options.create_graph = True data.cols[2].group_filter = ["Yponomeutidae", "Lycaenidae", "Hesperiidae"] - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -661,10 +661,10 @@ def test_group_meta_analysis_bootstrap(): options.bootstrap_mean = 9999 options.create_graph = True - output, figure, fig_caption, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -681,10 +681,10 @@ def test_group_meta_analysis_lrr(): options.create_graph = True - output, figure, fig_caption, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -713,10 +713,10 @@ def test_cumulative_meta_analysis(): options.create_graph = True - output, figure, fig_caption, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -732,10 +732,10 @@ def test_cumulative_meta_analysis_bootstrap(): options.create_graph = True - output, figure, fig_caption, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, _ = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -761,11 +761,11 @@ def test_regression_meta_analysis_lep(): options.independent_variable = data.cols[3] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -807,11 +807,11 @@ def test_regression_meta_analysis_lep_randeff(): options.random_effects = True options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -872,7 +872,7 @@ def test_complex_meta_analysis_lep_simple_regression(): options.continuous_vars = [data.cols[3]] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) global_values = analysis_values.global_values @@ -918,7 +918,7 @@ def test_complex_meta_analysis_lep_group(): options.continuous_vars = [] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) global_values = analysis_values.global_values @@ -966,7 +966,7 @@ def test_complex_meta_analysis_lep(): options.continuous_vars = [data.cols[3]] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) global_values = analysis_values.global_values @@ -1025,7 +1025,7 @@ def test_complex_meta_analysis_lep_randomeff(): options.random_effects = True options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, _, _, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) global_values = analysis_values.global_values @@ -1088,11 +1088,11 @@ def test_nested_meta_analysis_lep(): options.create_graph = True data.cols[2].group_filter = ["Yponomeutidae", "Lycaenidae", "Hesperiidae"] - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() global_values = analysis_values.global_values @@ -1200,8 +1200,8 @@ def test_scatter_plot(): x_col = data.cols[11] y_col = data.cols[10] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_scatter_plot(data, x_col, y_col) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_scatter_plot(data, x_col, y_col) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1210,8 +1210,8 @@ def test_normal_quantile_plot(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_normal_quantile_plot(data, e_col, v_col) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_normal_quantile_plot(data, e_col, v_col) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1220,8 +1220,8 @@ def test_radial_plot_d(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_radial_plot(data, e_col, v_col, False) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_radial_plot(data, e_col, v_col, False) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1230,8 +1230,8 @@ def test_radial_plot_lnrr(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_radial_plot(data, e_col, v_col, True) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_radial_plot(data, e_col, v_col, True) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1240,8 +1240,8 @@ def test_histogram_d_unweighted(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 0, 10) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 0, 10) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1250,8 +1250,8 @@ def test_histogram_d_weighted_invvar(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 1, 10) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 1, 10) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1260,8 +1260,8 @@ def test_histogram_d_weighted_sample_size(): e_col = data.cols[10] v_col = data.cols[2] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 2, 15) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_histogram_plot(data, e_col, v_col, 2, 15) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1270,8 +1270,8 @@ def test_forest_plot(): e_col = data.cols[10] v_col = data.cols[11] if TEST_FIGURES: - figure, fig_caption, _ = MetaWinDraw.draw_forest_plot(data, e_col, v_col) - test_win = TestFigureDialog(figure, fig_caption) + figure, chart_data = MetaWinDraw.draw_forest_plot(data, e_col, v_col) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1296,11 +1296,11 @@ def test_trim_and_fill_analysis(): options.create_graph = True options.k_estimator = "L" - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1325,11 +1325,11 @@ def test_trim_and_fill_analysis_negative_mean(): options.create_graph = True options.k_estimator = "R" - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1354,11 +1354,11 @@ def test_jackknife(): options.effect_vars = data.cols[5] options.create_graph = True - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) if TEST_FIGURES: - test_win = TestFigureDialog(figure, fig_caption) + test_win = TestFigureDialog(figure, chart_data.caption_text()) test_win.exec() @@ -1377,22 +1377,21 @@ def test_phylogenetic_simple_test(): options.tip_names = data.cols[0] print("UNWEIGHTED") options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) print() print() print("WEIGHTED") options.effect_vars = data.cols[2] - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) print() print() print("PHYLOGENETIC") options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) @@ -1409,12 +1408,11 @@ def test_phylogenetic_glm_simple(): options.random_effects = True options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA print(data.column_labels()[1]) - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) print() @@ -1426,11 +1424,10 @@ def test_phylogenetic_glm_simple(): options.effect_vars = data.cols[4] options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) print() @@ -1441,11 +1438,10 @@ def test_phylogenetic_glm_simple(): options.effect_data = data.cols[5] options.effect_vars = data.cols[6] options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) print() @@ -1456,11 +1452,10 @@ def test_phylogenetic_glm_simple(): options.effect_data = data.cols[7] options.effect_vars = data.cols[8] options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) print() @@ -1471,11 +1466,10 @@ def test_phylogenetic_glm_simple(): options.effect_data = data.cols[9] options.effect_vars = data.cols[10] options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output) print() @@ -1486,9 +1480,8 @@ def test_phylogenetic_glm_simple(): options.effect_data = data.cols[11] options.effect_vars = data.cols[12] options.structure = MetaWinAnalysis.SIMPLE_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4) print_test_output(output) options.structure = MetaWinAnalysis.PHYLOGENETIC_MA - output, figure, fig_caption, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, - tree=tree) + output, figure, chart_data, analysis_values = MetaWinAnalysis.do_meta_analysis(data, options, 4, tree=tree) print_test_output(output)