Exemple #1
0
    def test_make_plots(self):
        """make_plots: tests whether the average plots are generated and if
           dictionary for the html generation is properly formatted"""

        filename1='/tmp/test/testSampleIDSample1_ave.png'
        filename2='/tmp/test/testSampleIDSample1_raw.png'
        folder1='/tmp/test/'
        
        self._paths_to_clean_up = [filename1,filename2]
        self._folders_to_cleanup=[folder1]

        exp1={'SampleID': {'Sample1': {'test': {'ave': ['     7.000', '     2.052'], 'err': ['       nan', '     0.000']}}}}
        exp2={'test': {'groups': {'SampleID': {'Sample1': {'groupcolor': '#0000ff', 'raw_link': 'html_plots/testSampleIDSample1_raw.png', 'groupsamples': ['Sample1'], 'ave_link': 'html_plots/testSampleIDSample1_ave.png'}}}, 'samples': {'Sample1': {'color': '#0000ff', 'link': 'html_plots/testSample1.png'}}}}
        
        create_dir('/tmp/test/',False)
        
        obs1,obs2 = make_plots(self.background_color,self.label_color, \
                          self.rare_data,self.ymax, self.xmax,'/tmp/test/', \
                          self.resolution, self.imagetype,self.groups,\
                          self.colors,self.data_colors,self.metric_name,\
                          self.labelname,self.rarefaction_data_mat, \
                          self.rarefaction_legend_mat,self.sample_dict, \
                          self.data_colors,self.colors2)
        
        self.assertEqual(obs1,exp1)
        self.assertEqual(obs2,exp2)
        self.assertTrue(exists(filename1))
        self.assertTrue(exists(filename2))
        self.assertTrue(exists(folder1))
    def test_make_plots(self):
        """make_plots: tests whether the average plots are generated and if
           dictionary for the html generation is properly formatted"""

        filename1='/tmp/test/testcol_0_row_0_ave.png'
        filename2='/tmp/test/testcol_0_row_0_raw.png'
        folder1='/tmp/test/'
        
        self._paths_to_clean_up = [filename1,filename2]
        self._folders_to_cleanup=[folder1]

        exp1={'SampleID': {'Sample1': {'test': {'ave': ['     7.000', '     2.052'], 'err': ['       nan', '     0.000']}}}}
        exp2={'test': {'groups': {'SampleID': {'Sample1': {'groupcolor': '#ff0000', 'raw_link': 'html_plots/testcol_0_row_0_raw.png', 'groupsamples': ['Sample1'], 'ave_link': 'html_plots/testcol_0_row_0_ave.png'}}}, 'samples': {'Sample1': {'color': '#ff0000', 'link': 'html_plots/testcol_0_row_0.png'}}}}
        
        create_dir('/tmp/test/',False)
        
        obs1,obs2 = make_plots(self.background_color,self.label_color, \
                          self.rare_data,self.ymax, self.xmax,'/tmp/test/', \
                          self.resolution, self.imagetype,self.groups,\
                          self.colors,self.data_colors,self.metric_name,\
                          self.labelname,self.rarefaction_data_mat, \
                          self.rarefaction_legend_mat,self.sample_dict, \
                          self.data_colors,self.colors2,self.mapping_lookup)
        
        self.assertEqual(obs1,exp1)
        self.assertEqual(obs2,exp2)
        self.assertTrue(exists(filename1))
        self.assertTrue(exists(filename2))
        self.assertTrue(exists(folder1))
    def test_make_plots(self):
        """make_plots: tests whether the average plots are generated and if
           dictionary for the html generation is properly formatted"""

        filename1 = "/tmp/test/testcol_0_row_0_ave.png"
        filename2 = "/tmp/test/testcol_0_row_0_raw.png"
        folder1 = "/tmp/test/"

        self._paths_to_clean_up = [filename1, filename2]
        self._folders_to_cleanup = [folder1]

        exp1 = {
            "SampleID": {
                "Sample1": {"test": {"ave": ["     7.000", "     2.052"], "err": ["       nan", "     0.000"]}}
            }
        }
        exp2 = {
            "test": {
                "groups": {
                    "SampleID": {
                        "Sample1": {
                            "groupcolor": "#ff0000",
                            "raw_link": "html_plots/testcol_0_row_0_raw.png",
                            "groupsamples": ["Sample1"],
                            "ave_link": "html_plots/testcol_0_row_0_ave.png",
                        }
                    }
                },
                "samples": {"Sample1": {"color": "#ff0000", "link": "html_plots/testcol_0_row_0.png"}},
            }
        }

        create_dir("/tmp/test/", False)

        obs1, obs2 = make_plots(
            self.background_color,
            self.label_color,
            self.rare_data,
            self.ymax,
            self.xmax,
            "/tmp/test/",
            self.resolution,
            self.imagetype,
            self.groups,
            self.colors,
            self.data_colors,
            self.metric_name,
            self.labelname,
            self.rarefaction_data_mat,
            self.rarefaction_legend_mat,
            self.sample_dict,
            self.data_colors,
            self.colors2,
            self.mapping_lookup,
        )

        self.assertEqual(obs1, exp1)
        self.assertEqual(obs2, exp2)
        self.assertTrue(exists(filename1))
        self.assertTrue(exists(filename2))
        self.assertTrue(exists(folder1))