Пример #1
0
 def test_quiet(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.quiet, 0)
     cfg = parse_args(['--quiet', 'replicon'])
     self.assertEqual(cfg.quiet, 1)
     cfg = parse_args(['-qq', 'replicon'])
     self.assertEqual(cfg.quiet, 2)
 def test_quiet(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.quiet, 0)
     cfg = parse_args(['--quiet', 'replicon'])
     self.assertEqual(cfg.quiet, 1)
     cfg = parse_args(['-qq', 'replicon'])
     self.assertEqual(cfg.quiet, 2)
 def test_verbose(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.verbose, 0)
     cfg = parse_args(['--verbose', 'replicon'])
     self.assertEqual(cfg.verbose, 1)
     cfg = parse_args(['-vv', 'replicon'])
     self.assertEqual(cfg.verbose, 2)
Пример #4
0
 def test_prodigal(self):
     cfg = parse_args(['replicon'])
     prodigal = 'foo'
     self.assertEqual(cfg.prodigal,
                      distutils.spawn.find_executable('prodigal'))
     cfg = parse_args(['--prodigal', prodigal, 'replicon'])
     self.assertEqual(cfg.prodigal, prodigal)
Пример #5
0
 def test_hmmsearch(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.hmmsearch,
                      distutils.spawn.find_executable("hmmsearch"))
     hmmsearch = 'foo'
     cfg = parse_args(['--hmmsearch', hmmsearch, 'replicon'])
     self.assertEqual(cfg.hmmsearch, hmmsearch)
Пример #6
0
 def test_verbose(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.verbose, 0)
     cfg = parse_args(['--verbose', 'replicon'])
     self.assertEqual(cfg.verbose, 1)
     cfg = parse_args(['-vv', 'replicon'])
     self.assertEqual(cfg.verbose, 2)
Пример #7
0
    def test_wo_replicon(self):
        real_exit = sys.exit

        sys.exit = self.fake_exit
        with self.catch_io(err=True):
            try:
                _ = parse_args([])
            except TypeError as err:
                msg = sys.stderr.getvalue()
                msg_end = 'error: the following arguments are required: replicon\n'
                self.assertTrue(msg.endswith(msg_end), "{} != {}".format(msg[len(msg) - len(msg_end):], msg_end))
                # program exit with returncode = 2
                self.assertEqual(str(err), '2')
            finally:
                sys.exit = real_exit
    def test_wo_replicon(self):
        real_exit = sys.exit

        sys.exit = self.fake_exit
        with self.catch_io(err=True):
            try:
                _ = parse_args([])
            except TypeError as err:
                msg = sys.stderr.getvalue()
                msg_end = 'error: the following arguments are required: replicon\n'
                self.assertTrue(msg.endswith(msg_end), "{} != {}".format(msg[len(msg) - len(msg_end):], msg_end))
                # program exit with returncode = 2
                self.assertEqual(str(err), '2')
            finally:
                sys.exit = real_exit
Пример #9
0
    def test_cirular_n_linear(self):
        real_exit = sys.exit

        sys.exit = self.fake_exit
        with self.catch_io(err=True):
            try:
                _ = parse_args(['--circ', '--linear', 'replicon'])
            except TypeError as err:
                msg = sys.stderr.getvalue()
                msg_end = 'error: argument --linear: not allowed with argument --circ\n'
                self.assertTrue(msg.endswith(msg_end), "{} != {}".format(msg[len(msg) - len(msg_end):], msg_end))
                # program exit with returncode = 2
                self.assertEqual(str(err), '2')
            finally:
                sys.exit = real_exit
Пример #10
0
    def test_cirular_n_linear(self):
        real_exit = sys.exit

        sys.exit = self.fake_exit
        with self.catch_io(err=True):
            try:
                _ = parse_args(['--circ', '--linear', 'replicon'])
            except TypeError as err:
                msg = sys.stderr.getvalue()
                msg_end = 'error: argument --linear: not allowed with argument --circ\n'
                self.assertTrue(msg.endswith(msg_end), "{} != {}".format(msg[len(msg) - len(msg_end):], msg_end))
                # program exit with returncode = 2
                self.assertEqual(str(err), '2')
            finally:
                sys.exit = real_exit
Пример #11
0
    def test_version(self):
        real_exit = sys.exit
        sys.exit = self.fake_exit

        from numpy import __version__ as np_vers
        from pandas import __version__ as pd_vers
        from matplotlib import __version__ as mplt_vers
        from Bio import __version__ as bio_vers
        from integron_finder import __version__ as if_vers

        with self.catch_io(out=True):
            try:
                _ = cfg = parse_args(['--version'])
            except TypeError as err:
                msg = sys.stdout.getvalue()
                msg_expected = """integron_finder version {i_f}
Using:    
 - Python {py}
 - numpy {np}
 - pandas {pd}
 - matplolib {mplt}
 - biopython {bio}

Authors:
 - Jean Cury, Bertrand Neron, Eduardo Rocha,

Citation:

 Identification and analysis of integrons and cassette arrays in bacterial genomes
 Jean Cury; Thomas Jove; Marie Touchon; Bertrand Neron; Eduardo PC Rocha
 Nucleic Acids Research 2016; doi: 10.1093/nar/gkw319
 """.format(i_f=if_vers,
            py=sys.version.replace('\n', ' '),
            np=np_vers,
            pd=pd_vers,
            mplt=mplt_vers,
            bio=bio_vers
            )

                self.assertEqual(msg.strip(), msg_expected.strip())
                # program exit with returncode = 2
                self.assertEqual(str(err), '0')
            finally:
                sys.exit = real_exit
Пример #12
0
    def test_version(self):
        real_exit = sys.exit
        sys.exit = self.fake_exit

        from numpy import __version__ as np_vers
        from pandas import __version__ as pd_vers
        from matplotlib import __version__ as mplt_vers
        from Bio import __version__ as bio_vers
        from integron_finder import __version__ as if_vers

        with self.catch_io(out=True):
            try:
                _ = cfg = parse_args(['--version'])
            except TypeError as err:
                msg = sys.stdout.getvalue()
                msg_expected = """integron_finder version {i_f}
Using:    
 - Python {py}
 - numpy {np}
 - pandas {pd}
 - matplolib {mplt}
 - biopython {bio}

Authors:
 - Jean Cury, Bertrand Neron, Eduardo Rocha,

Citation:

 Identification and analysis of integrons and cassette arrays in bacterial genomes
 Jean Cury; Thomas Jove; Marie Touchon; Bertrand Neron; Eduardo PC Rocha
 Nucleic Acids Research 2016; doi: 10.1093/nar/gkw319
 """.format(i_f=if_vers,
            py=sys.version.replace('\n', ' '),
            np=np_vers,
            pd=pd_vers,
            mplt=mplt_vers,
            bio=bio_vers
            )

                self.assertEqual(msg.strip(), msg_expected.strip())
                # program exit with returncode = 2
                self.assertEqual(str(err), '0')
            finally:
                sys.exit = real_exit
Пример #13
0
 def test_min_attc_size(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.min_attc_size, 40)
     min_attc_size = 50
     cfg = parse_args(['--min-attc-size', str(min_attc_size), 'replicon'])
     self.assertEqual(cfg.min_attc_size, min_attc_size)
Пример #14
0
 def test_min_attc_size(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.min_attc_size, 40)
     min_attc_size = 50
     cfg = parse_args(['--min-attc-size', str(min_attc_size), 'replicon'])
     self.assertEqual(cfg.min_attc_size, min_attc_size)
Пример #15
0
 def test_circular(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.circular)
     cfg = parse_args(['--circ', 'replicon'])
     self.assertTrue(cfg.circular)
Пример #16
0
 def test_evalues_attc(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.evalue_attc, 1.0)
     evalue = 5.0
     cfg = parse_args(['--evalue-attc', str(evalue), 'replicon'])
     self.assertEqual(cfg.evalue_attc, evalue)
Пример #17
0
 def test_no_proteins(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.no_proteins)
     cfg = parse_args(['--no-proteins', 'replicon'])
     self.assertTrue(cfg.no_proteins)
Пример #18
0
 def test_gbk(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.gbk)
     cfg = parse_args(['--gbk', 'replicon'])
     self.assertTrue(cfg.gbk)
Пример #19
0
 def test_circular(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.circular)
     cfg = parse_args(['--circ', 'replicon'])
     self.assertTrue(cfg.circular)
Пример #20
0
 def test_pdf(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.pdf)
     cfg = parse_args(['--pdf', 'replicon'])
     self.assertTrue(cfg.pdf)
Пример #21
0
 def test_gbk(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.gbk)
     cfg = parse_args(['--gbk', 'replicon'])
     self.assertTrue(cfg.gbk)
Пример #22
0
 def test_keep_palindromes(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.keep_palindromes)
     cfg = parse_args(['--keep-palindromes', 'replicon'])
     self.assertTrue(cfg.keep_palindromes)
Пример #23
0
 def test_evalues_attc(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.evalue_attc, 1.0)
     evalue = 5.0
     cfg = parse_args(['--evalue-attc', str(evalue), 'replicon'])
     self.assertEqual(cfg.evalue_attc, evalue)
Пример #24
0
 def test_mute(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.mute)
     cfg = parse_args(['--mute', 'replicon'])
     self.assertTrue(cfg.mute)
Пример #25
0
 def test_topology_file(self):
     cfg = parse_args(['replicon'])
     self.assertIsNone(cfg.topology_file)
     topo = 'foo'
     cfg = parse_args(['--topology-file', topo, 'replicon'])
     self.assertEqual(cfg.topology_file, topo)
Пример #26
0
 def test_linear(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.linear)
     cfg = parse_args(['--linear', 'replicon'])
     self.assertTrue(cfg.linear)
Пример #27
0
 def test_mute(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.mute)
     cfg = parse_args(['--mute', 'replicon'])
     self.assertTrue(cfg.mute)
Пример #28
0
 def test_keep_tmp(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.keep_tmp)
     cfg = parse_args(['--keep-tmp', 'replicon'])
     self.assertTrue(cfg.keep_tmp)
Пример #29
0
 def test_gembase(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.gembase)
     cfg = parse_args(['--gembase', 'replicon'])
     self.assertTrue(cfg.gembase)
Пример #30
0
 def test_split_results(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.split_results)
     cfg = parse_args(['--split-results', 'replicon'])
     self.assertTrue(cfg.split_results)
Пример #31
0
 def test_split_results(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.split_results)
     cfg = parse_args(['--split-results', 'replicon'])
     self.assertTrue(cfg.split_results)
Пример #32
0
 def test_replicon(self):
     replicon = 'foo'
     cfg = parse_args([replicon])
     self.assertEqual(cfg.input_seq_path, os.path.abspath(replicon))
Пример #33
0
 def test_attc_model(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.model_attc_name, 'attc_4')
     model = 'foo'
     cfg = parse_args(['--attc-model', model, 'replicon'])
     self.assertEqual(cfg.model_attc_name, model)
Пример #34
0
 def test_local_max(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.local_max)
     cfg = parse_args(['--local-max', 'replicon'])
     self.assertTrue(cfg.local_max)
Пример #35
0
 def test_keep_palindromes(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.keep_palindromes)
     cfg = parse_args(['--keep-palindromes', 'replicon'])
     self.assertTrue(cfg.keep_palindromes)
Пример #36
0
 def test_func_annot(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.func_annot)
     cfg = parse_args(['--func-annot', 'replicon'])
     self.assertTrue(cfg.func_annot)
Пример #37
0
 def test_max_attc_size(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.max_attc_size, 200)
     max_attc_size = 50
     cfg = parse_args(['--max-attc-size', str(max_attc_size), 'replicon'])
     self.assertEqual(cfg.max_attc_size, max_attc_size)
Пример #38
0
 def test_cpu(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.cpu, 1)
     cpu = 10
     cfg = parse_args(['--cpu', str(cpu), 'replicon'])
     self.assertEqual(cfg.cpu, cpu)
Пример #39
0
 def test_eagle_eyes(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.local_max)
     # eagle option is an "alias" for local_max
     cfg = parse_args(['--eagle-eyes', 'replicon'])
     self.assertTrue(cfg.local_max)
Пример #40
0
 def test_local_max(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.local_max)
     cfg = parse_args(['--local-max', 'replicon'])
     self.assertTrue(cfg.local_max)
Пример #41
0
 def test_linear(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.linear)
     cfg = parse_args(['--linear', 'replicon'])
     self.assertTrue(cfg.linear)
Пример #42
0
 def test_cpu(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.cpu, 1)
     cpu = 10
     cfg = parse_args(['--cpu', str(cpu), 'replicon'])
     self.assertEqual(cfg.cpu, cpu)
Пример #43
0
 def test_topology_file(self):
     cfg = parse_args(['replicon'])
     self.assertIsNone(cfg.topology_file)
     topo = 'foo'
     cfg = parse_args(['--topology-file', topo, 'replicon'])
     self.assertEqual(cfg.topology_file, topo)
Пример #44
0
 def test_outdir(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.outdir, os.path.abspath('.'))
     outdir = 'foo'
     cfg = parse_args(['--outdir', outdir, 'replicon'])
     self.assertEqual(cfg.outdir, os.path.abspath(outdir))
Пример #45
0
 def test_attc_model(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.model_attc_name, 'attc_4')
     model = 'foo'
     cfg = parse_args(['--attc-model', model, 'replicon'])
     self.assertEqual(cfg.model_attc_name, model)
Пример #46
0
 def test_replicon(self):
     replicon = 'foo'
     cfg = parse_args([replicon])
     self.assertEqual(cfg.input_seq_path, os.path.abspath(replicon))
Пример #47
0
 def test_pdf(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.pdf)
     cfg = parse_args(['--pdf', 'replicon'])
     self.assertTrue(cfg.pdf)
Пример #48
0
 def test_max_attc_size(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.max_attc_size, 200)
     max_attc_size = 50
     cfg = parse_args(['--max-attc-size', str(max_attc_size), 'replicon'])
     self.assertEqual(cfg.max_attc_size, max_attc_size)
Пример #49
0
 def test_keep_tmp(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.keep_tmp)
     cfg = parse_args(['--keep-tmp', 'replicon'])
     self.assertTrue(cfg.keep_tmp)
Пример #50
0
 def test_gembase(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.gembase)
     cfg = parse_args(['--gembase', 'replicon'])
     self.assertTrue(cfg.gembase)
Пример #51
0
 def test_path_func_annot(self):
     cfg = parse_args(['replicon'])
     self.assertIsNone(cfg.path_func_annot)
     func_annot = 'foo'
     cfg = parse_args(['--path-func-annot', func_annot, 'replicon'])
     self.assertEqual(cfg.path_func_annot, func_annot)
Пример #52
0
 def test_eagle_eyes(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.local_max)
     # eagle option is an "alias" for local_max
     cfg = parse_args(['--eagle-eyes', 'replicon'])
     self.assertTrue(cfg.local_max)
Пример #53
0
 def test_distance_threshold(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.distance_threshold, 4000)
     dt = 50
     cfg = parse_args(['--distance-thresh', str(dt), 'replicon'])
     self.assertEqual(cfg.distance_threshold, dt)
Пример #54
0
 def test_no_proteins(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.no_proteins)
     cfg = parse_args(['--no-proteins', 'replicon'])
     self.assertTrue(cfg.no_proteins)
Пример #55
0
 def test_func_annot(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.func_annot)
     cfg = parse_args(['--func-annot', 'replicon'])
     self.assertTrue(cfg.func_annot)
Пример #56
0
 def test_outdir(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.outdir, os.path.abspath('.'))
     outdir = 'foo'
     cfg = parse_args(['--outdir', outdir, 'replicon'])
     self.assertEqual(cfg.outdir, os.path.abspath(outdir))
Пример #57
0
 def test_distance_threshold(self):
     cfg = parse_args(['replicon'])
     self.assertEqual(cfg.distance_threshold, 4000)
     dt = 50
     cfg = parse_args(['--distance-thresh', str(dt), 'replicon'])
     self.assertEqual(cfg.distance_threshold, dt)
Пример #58
0
 def test_union_integrase(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.union_integrases)
     cfg = parse_args(['--union-integrases', 'replicon'])
     self.assertTrue(cfg.union_integrases)
Пример #59
0
 def test_union_integrase(self):
     cfg = parse_args(['replicon'])
     self.assertFalse(cfg.union_integrases)
     cfg = parse_args(['--union-integrases', 'replicon'])
     self.assertTrue(cfg.union_integrases)
Пример #60
0
 def test_prodigal(self):
     cfg = parse_args(['replicon'])
     prodigal = 'foo'
     self.assertEqual(cfg.prodigal, distutils.spawn.find_executable('prodigal'))
     cfg = parse_args(['--prodigal', prodigal, 'replicon'])
     self.assertEqual(cfg.prodigal, prodigal)