Пример #1
0
    def test_Setting_get_genovo(self):

        setting = Setting()
        setting.add_all(assembler_infile="gInfile",
                        filename="gOutfile", genovo_thresh=2)
#        setting.print_all()
        self.assertRaises(KeyError, setting.check_parameters_program, "genovo")

        setting = Setting()
        setting.add_all(assembler_infile="gInfile",
                        filename="gOutfile", genovo_num_iter=2)
        self.assertRaises(KeyError, setting.check_parameters_program, "genovo")

        setting.add("genovo_thresh", 10)
        setting.add_all(genovo_thresh=14, assembler_pdir="g_p_dir", wdir=self.wdir)
        expected = {"assembler_infile": "gInfile", "filename": "gOutfile",
                    "genovo_num_iter": 2, "genovo_thresh": 14,
                    "assembler_pdir": "g_p_dir",
                    "wdir": self.wdir, "check_exist": True,
                    "assembler_outfile": None}
        self.assertEqual(expected, setting.check_parameters_program("genovo"))

        setting.add("wdir", "otherdir")
        expected["wdir"] = "otherdir"
        self.assertEqual(expected, setting.check_parameters_program("genovo"))

        setting = Setting()
        setting.add_all(assembler_infile="gInfile", genovo_thresh=14,
                        genovo_pdir="g_p_dir", genovo_num_iter=2)
        setting.add("wdir", "otherdir")
        expected.pop("filename")
        self.assertEqual(expected, setting.check_parameters_program("genovo"))
Пример #2
0
    def test_Setting_get_metasim(self):  # "metasim_pdir", "metasim_model_infile", "metasim_taxon_infile", "metasim_no_reads"
        setting = Setting()
        setting.add_all(metasim_model_infile="mmInfile",
                        filename="mOutfile", metasim_no_reads=200)
        #        setting.print_all()
        self.assertRaises(KeyError, setting.check_parameters_program, "metasim")

        setting = Setting()
        setting.add_all(metasim_model_infile="mmInfile",
                        filename="mOutfile", metasim_taxon_infile="tInfile")
        self.assertRaises(KeyError, setting.check_parameters_program, "metasim")

        setting.add("metasim_pdir", "m_p_dir")
        setting.add_all(metasim_no_reads=250, wdir=self.wdir)
        expected = {"metasim_model_infile": "mmInfile", "filename": "mOutfile",
                    "metasim_taxon_infile": "tInfile", "metasim_pdir": "m_p_dir",
                    "metasim_no_reads": 250,
                    "wdir": self.wdir, "check_exist": True,
                    "metasim_outfile": None}
        setting.debug = 0
        self.assertEqual(expected, setting.check_parameters_program("metasim"))

        setting.add("wdir", "otherdir")
        expected["wdir"] = "otherdir"
        self.assertEqual(expected, setting.check_parameters_program("metasim"))

        setting = Setting()
        setting.add_all(metasim_model_infile="mmInfile", metasim_no_reads=250,
                        metasim_taxon_infile="tInfile", metasim_pdir="m_p_dir")
        setting.add("wdir", "otherdir")
        expected.pop("filename")
        self.assertEqual(expected, setting.check_parameters_program("metasim"))
Пример #3
0
    def test_Setting_get_blast(self):
        setting = Setting()
        setting.add_all(blast_infile="bInfile", blast_outfile="bOutfile")

        with self.assertRaises(KeyError):
            setting.check_parameters_program("blast")

        setting.add_all(blast_e_value=1e-15,
                        wdir="working_dir", check_exist=True)
        expected = {"blast_infile": "bInfile", "blast_outfile": "bOutfile",
                    "blast_e_value": 1e-15, "blast_batch_size": 20,
                    "wdir": "working_dir", "check_exist": True
                    }
        setting.debug = True
        self.assertEqual(expected, setting.check_parameters_program("blast"))


        setting.add("wdir", "otherdir")
        expected["wdir"] = "otherdir"
        self.assertEqual(expected, setting.check_parameters_program("blast"))

        setting = Setting()
        setting.add_all(blast_infile="bInfile")
        setting.add("wdir", "otherdir")
        setting.add("blast_e_value", 1e-15)
        setting.add("blast_outfile", "bOutfile")
#        expected.pop("filename")
#        TODO: debug switch
        setting.debug = True
        self.assertEqual(expected, setting.check_parameters_program("blast"))
Пример #4
0
    def test_Setting_get_mine(self):
        setting = Setting()
        setting.add_all(filename="Outfile")
        setting.debug = True
        #        setting.print_all()
#        self.assertRaises(KeyError, setting._get_mine())

        setting.add_all(mine_outfile="mineOut",
                        mine_pdir="mine_pdir", mine_comparison_style="-allPairs")
        setting.add("mine_infile", "infile")
        setting.add("wdir", "working_dir")
        setting.add("csv_files", "file1,file2,file3")

        expected = {"mine_infile": "infile",
                    "filename": "Outfile", "mine_outfile": "mineOut",
                    "mine_pdir": "mine_pdir", "mine_comparison_style": "-allPairs",
                    "wdir": "working_dir", "check_exist": True,
                    "mine_cv": 0.0, "mine_exp": 0.6,
                    "mine_clumps": 15, "mine_jobID": None,
                    "csv_files": ["file1", "file2", "file3"]}

        self.assertEqual(expected, setting.check_parameters_program("mine"))

        setting.add_all(mine_infile="mineInfile")
        expected["mine_infile"] = "mineInfile"
Пример #5
0
    def test_Setting_get_pars(self):
        setting = Setting(genovo_infile="gInfile", genovo_thresh=14)
        setting.add_all(genovo_pdir="g_p_dir", genovo_num_iter=2,
                        wdir="otherdir", check_exist=True)
        expected = {"genovo_infile": "gInfile", "genovo_num_iter": 2,
                    "genovo_thresh": 14, "genovo_pdir": "g_p_dir",
                    "check_exist": True, "genovo_outfile": None,
                    "wdir": "otherdir"}
        print "W", setting.check_parameters_program("genovo")
        self.assertEqual(expected, setting.check_parameters_program("genovo"))


        setting = Setting()
        setting.add_all(filename="Outfile", genovo_outfile="infile",
                        glimmer_outfile="glimOut", glimmer_pdir="glimp_dir",
                        wdir="working_dir")

        expected = {"glimmer_infile": "infile", "genovo_outfile": "infile",
                    "filename": "Outfile", "glimmer_outfile": "glimOut",
                    "glimmer_pdir": "glimp_dir",
                    "wdir": "working_dir", "check_exist": True
                    }
        print setting.check_parameters_program("glimmer")
        self.assertEqual(expected, setting.check_parameters_program("glimmer"))

        setting.add("glimmer_infile", "glInfile")
        expected["glimmer_infile"] = "glInfile"
        self.assertEqual(expected, setting.check_parameters_program("glimmer"))
Пример #6
0
    def test_Setting_get_glimmer(self):
        setting = Setting()
        setting.add_all(filename="Outfile")
        #        setting.print_all()
        self.assertRaises(KeyError, setting.check_parameters_program, "glimmer")


        setting.add_all(genovo_outfile="infile", glimmer_outfile="glimOut",
            glimmer_pdir="glimp_dir", wdir=self.wdir)
        expected = {"glimmer_infile": "infile", "genovo_outfile": "infile",
                    "filename": "Outfile", "glimmer_outfile": "glimOut",
                    "glimmer_pdir": "glimp_dir",
                    "wdir": self.wdir, "check_exist": True}
        self.assertEqual(expected, setting.check_parameters_program("glimmer"))

        setting.add_all(glimmer_infile="glInfile")
        expected["glimmer_infile"] = "glInfile"