Example #1
0
 def test_continuousMetaAnalysis(self):
     # assert result is not None
     
     studies = self.model.get_studies_in_current_order()
     data_location = {'experimental_mean': 2, 'effect_size': 18, 'experimental_std_dev': 5, 'experimental_sample_size': 1, 'control_std_dev': 5, 'control_sample_size': 1, 'variance': 19, 'control_mean': 4}
     data_type = CONTINUOUS
     python_to_R.dataset_to_simple_continuous_robj(model=self.model,
                                                   included_studies=studies,
                                                   data_location=data_location,
                                                   data_type=data_type, 
                                                   covs_to_include=[])
     method = "continuous.random"
     params = {'conf.level': 95.0, 'digits': 3, 'fp_col2_str': u'[default]', 'fp_show_col4': False, 'fp_xlabel': u'[default]', 'fp_col4_str': u'Ev/Ctrl', 'fp_xticks': '[default]', 'fp_col3_str': u'Ev/Trt', 'fp_show_col3': False, 'fp_show_col2': True, 'fp_show_col1': True, 'fp_plot_lb': '[default]', 'fp_outpath': u'./r_tmp/forest.png', 'rm.method': 'DL', 'fp_plot_ub': '[default]', 'fp_col1_str': u'Studies', 'measure': 'SMD', 'fp_show_summary_line': True}
     result = python_to_R.run_continuous_ma(function_name=method,
                                            params=params)
     self.assertIsNotNone(result, "Result is unexpectedly none!")
 def populate_cbo_box(self):
     print("populating combo box")
     
     self.method_cbo_box.clear()
     
     # we first build an R object with the current data. this is to pass off         
     # to the R side to check the feasibility of the methods over the current data.
     # i.e., we do not display methods that cannot be performed over the 
     # current data.
     tmp_obj_name = "tmp_obj"
     
     covs_to_include = []
     #if self.mode==SUBGROUP_MODE:
     #       covs_to_include = [self.wizard().get_subgroup_variable(),]
     covs_to_include = []
     
     if OMA_CONVENTION[self.data_type] == "binary":
         python_to_R.dataset_to_simple_binary_robj(self.model,
                                                   included_studies = self.get_included_studies_in_proper_order(),
                                                   data_location = self.data_location,
                                                   var_name = tmp_obj_name,
                                                   covs_to_include=covs_to_include,
                                                   one_arm=False)
     elif OMA_CONVENTION[self.data_type] == "continuous":
         python_to_R.dataset_to_simple_continuous_robj(model=self.model,
                                                       included_studies=self.get_included_studies_in_proper_order(),
                                                       data_location=self.data_location, 
                                                       data_type=self.data_type, 
                                                       var_name=tmp_obj_name, 
                                                       covs_to_include=covs_to_include,
                                                       one_arm=False)
         
     self.available_method_d = python_to_R.get_available_methods(
                                             for_data_type=OMA_CONVENTION[self.data_type],
                                             data_obj_name=tmp_obj_name,
                                             metric=self.metric,
                                             funnel_mode=self.funnel_mode)
     print "\n\navailable %s methods: %s" % (self.data_type, ", ".join(self.available_method_d.keys()))
     method_names = self.available_method_d.keys()
     method_names.sort(reverse=True)
     
     for method in method_names:
         self.method_cbo_box.addItem(method)
     self.current_method = self.available_method_d[str(self.method_cbo_box.currentText())]
     self.setup_params()
     self.parameter_grp_box.setTitle(self.current_method)
Example #3
0
 def test_bootstrapped_ma(self):
     ''' bootstrapped meta analysis '''
     studies = self.model.get_studies_in_current_order()
     method = "continuous.random"
     current_param_vals = {'conf.level': 95.0, 'histogram.xlab': 'Effect Size', 'fp_xticks': '[default]', 'fp_show_col4': False, 'fp_show_col3': False, 'fp_xlabel': u'[default]', 'fp_show_col1': True, 'fp_show_col2': True, 'fp_outpath': u'./r_tmp/forest.png', 'rm.method': 'DL', 'fp_plot_ub': '[default]', 'fp_col1_str': u'Studies', 'measure': 'SMD', 'fp_plot_lb': '[default]', 'bootstrap.plot.path': '/Users/george/git/OpenMEE/r_tmp/bootstrap.png', 'digits': 3, 'fp_col2_str': u'[default]', 'num.bootstrap.replicates': 1000, 'fp_col4_str': u'Ev/Ctrl', 'histogram.title': 'Bootstrap Histogram', 'fp_col3_str': u'Ev/Trt', 'fp_show_summary_line': True, 'bootstrap.type': 'boot.ma'}
     data_location = {'experimental_mean': 2, 'effect_size': 18, 'experimental_std_dev': 5, 'experimental_sample_size': 1, 'control_std_dev': 5, 'control_sample_size': 1, 'variance': 19, 'control_mean': 4}
     meta_f_str = "bootstrap.continuous"
     
     python_to_R.dataset_to_simple_continuous_robj(model=self.model,
                                                   included_studies=studies,
                                                   data_location=data_location,
                                                   data_type=CONTINUOUS, 
                                                   covs_to_include=[])
     result = python_to_R.run_meta_method(meta_function_name = meta_f_str,
                                          function_name = method,
                                          params = current_param_vals)
     # assert result is not None
     self.assertIsNotNone(result, "Result is unexpectedly none!")
Example #4
0
 def test_subgroup(self):
     ''' subgroup meta analysis '''
     studies = self.model.get_studies_in_current_order()
     method = "continuous.random"
     current_param_vals = {'conf.level': 95.0, 'digits': 3, 'fp_col2_str': u'[default]', 'fp_show_col4': False, 'fp_xlabel': u'[default]', 'fp_col4_str': u'Ev/Ctrl', 'fp_xticks': '[default]', 'fp_col3_str': u'Ev/Trt', 'fp_show_col3': False, 'fp_show_col2': True, 'fp_show_col1': True, 'fp_plot_lb': '[default]', 'fp_outpath': u'./r_tmp/forest.png', 'rm.method': 'DL', 'fp_plot_ub': '[default]', 'fp_col1_str': u'Studies', 'cov_name': 'Gender', 'measure': 'SMD', 'fp_show_summary_line': True}
     data_location = {'experimental_mean': 2, 'effect_size': 18, 'experimental_std_dev': 5, 'experimental_sample_size': 1, 'control_std_dev': 5, 'control_sample_size': 1, 'variance': 19, 'control_mean': 4}
     meta_f_str = "subgroup.ma.continuous"
     cov_names_to_include = ["Gender",]
     covs_to_include = get_covs_from_names(cov_names_to_include, model=self.model)
     
     python_to_R.dataset_to_simple_continuous_robj(model=self.model,
                                                   included_studies=studies,
                                                   data_location=data_location,
                                                   data_type=CONTINUOUS, 
                                                   covs_to_include=covs_to_include)
     result = python_to_R.run_meta_method(meta_function_name = meta_f_str,
                                          function_name = method,
                                          params = current_param_vals)
     # assert result is not None
     self.assertIsNotNone(result, "Result is unexpectedly none!")