Ejemplo n.º 1
0
 def test_functional_no_hits(self):
     out = os.path.join(self.tmpdir, 'test_macsyprofile')
     previous_run = self.find_data('functional_test_degenerated_systems')
     expected_result = self.find_data('results_macsyprofile_no_hits.tsv')
     cmd = f"macsyprofile -o {out} --index-dir {self.tmpdir} --i-evalue-sel 1e-10 --coverage-profile 2.0 {previous_run}"
     macsyprofile.main(cmd.split()[1:], log_level='WARNING')
     self.assertFileEqual(expected_result, out, comment='#')
Ejemplo n.º 2
0
 def test_functional_best_score(self):
     out = os.path.join(self.tmpdir, 'test_macsyprofile')
     previous_run = self.find_data('functional_test_degenerated_systems')
     expected_result = self.find_data('results_macsyprofile_best_score.tsv')
     cmd = f"macsyprofile -o {out} --index-dir {self.tmpdir} --best-hits score {previous_run} "
     macsyprofile.main(cmd.split()[1:], log_level='WARNING')
     self.assertFileEqual(expected_result, out, comment='#')
Ejemplo n.º 3
0
    def test_functional(self):
        old = self.find_data('conf_files', 'macsyfinder-old.conf')
        shutil.copyfile(old, os.path.join(self.tmpdir, 'macsyfinder.conf'))

        previous_run = self.tmpdir
        cmd = f"macsyprofile --index-dir {self.tmpdir} {previous_run}"
        with self.assertRaises(ValueError):
            macsyprofile.main(cmd.split()[1:], log_level=logging.CRITICAL + 1)
Ejemplo n.º 4
0
 def test_functional_pattern(self):
     out = os.path.join(self.tmpdir, 'test_macsyprofile')
     previous_run = self.find_data('functional_test_degenerated_systems')
     expected_result = self.find_data('results_macsyprofile_pattern.tsv')
     # the argument do not need to be protected (we do not use shell)
     # as on real command line so '*mpf' => *mpf
     cmd = f"macsyprofile -o {out} --index-dir {self.tmpdir} -p *mfp {previous_run} "
     macsyprofile.main(cmd.split()[1:], log_level='WARNING')
     self.assertFileEqual(expected_result, out, comment='#')
Ejemplo n.º 5
0
    def test_functional_out_exists(self):
        out = os.path.join(self.tmpdir, 'test_macsyprofile')
        open(out, 'w').close()
        previous_run = self.find_data('functional_test_degenerated_systems')
        cmd = f"macsyprofile -o {self.tmpdir} --mute --best-hits score {previous_run} "

        # we cannot test the log message here
        # because the logger are init when main is called
        # after that the context is establish
        # so when the wrapper is called the handler cannot be substitute by the fake
        with self.assertRaises(ValueError):
            macsyprofile.main(cmd.split()[1:])
Ejemplo n.º 6
0
    def test_functional_no_previous_run(self):
        cmd = "macsyprofile --mute nimportnaoik "

        # we cannot test the log message here
        # because the logger are init when main is called
        # after that the context is establish
        # so when the wrapper is called the handler cannot be substitute by the fake
        with self.assertRaises(FileNotFoundError):
            macsyprofile.main(cmd.split()[1:])

        bad_previous_run = os.path.join(self.tmpdir, 'test_macsyprofile')
        open(bad_previous_run, 'w').close()
        cmd = f"macsyprofile  {bad_previous_run} "

        with self.assertRaises(ValueError):
            macsyprofile.main(cmd.split()[1:], log_level=logging.CRITICAL + 1)