Exemplo n.º 1
0
    def run(self, **kwargs):
        result = {}

        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        if parameters:
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt)
        elif bench_files:
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError(
                    "The length of bench_files and in_opts must "
                    "be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt)
        else:
            raise CommandError("Must specify parameters or bench_files.")

        result['bench_suite'] = bench_str

        return result
 def test_make_bench_suite_files_single(self):
     """Correctly generates the benchmark suite for single input option"""
     cmd = "pick_otus.py"
     in_opts = ["-i"]
     bench_files = [["1000000.fna"], ["2000000.fna"], ["3000000.fna"]]
     out_opt = "-o"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt)
     self.assertEqual(obs, exp_bench_suite_files_single)
 def test_make_bench_suite_files_single(self):
     """Correctly generates the benchmark suite for single input option"""
     cmd = "pick_otus.py"
     in_opts = ["-i"]
     bench_files = [["1000000.fna"], ["2000000.fna"], ["3000000.fna"]]
     out_opt = "-o"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt)
     self.assertEqual(obs, exp_bench_suite_files_single)
 def test_make_bench_suite_files_multiple(self):
     """Correctly generates the bench suite for multiple input options"""
     cmd = "split_libraries_fastq.py -m mapping.txt"
     in_opts = ["-i", "-b"]
     bench_files = [["reads/1000000.fna", "barcodes/1000000.fna"],
                    ["reads/2000000.fna", "barcodes/2000000.fna"],
                    ["reads/3000000.fna", "barcodes/3000000.fna"]]
     out_opt = "-o"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt)
     self.assertEqual(obs, exp_bench_suite_files_multiple)
 def test_make_bench_suite_files_multiple(self):
     """Correctly generates the bench suite for multiple input options"""
     cmd = "split_libraries_fastq.py -m mapping.txt"
     in_opts = ["-i", "-b"]
     bench_files = [["reads/1000000.fna", "barcodes/1000000.fna"],
                    ["reads/2000000.fna", "barcodes/2000000.fna"],
                    ["reads/3000000.fna", "barcodes/3000000.fna"]]
     out_opt = "-o"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt)
     self.assertEqual(obs, exp_bench_suite_files_multiple)
 def test_make_bench_suite_files_pbs(self):
     """Correctly generates the bench suite for a pbs environment"""
     cmd = "pick_otus.py"
     in_opts = ["-i"]
     bench_files = [["1000000.fna"], ["2000000.fna"], ["3000000.fna"]]
     out_opt = "-o"
     pbs = True
     job_prefix = "test"
     queue = "friendlyq"
     pbs_extra_args = "-m abe"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt, pbs,
                                  job_prefix, queue, pbs_extra_args)
     self.assertEqual(obs, exp_bench_suite_files_pbs)
 def test_make_bench_suite_files_pbs(self):
     """Correctly generates the bench suite for a pbs environment"""
     cmd = "pick_otus.py"
     in_opts = ["-i"]
     bench_files = [["1000000.fna"], ["2000000.fna"], ["3000000.fna"]]
     out_opt = "-o"
     pbs = True
     job_prefix = "test"
     queue = "friendlyq"
     pbs_extra_args = "-m abe"
     obs = make_bench_suite_files(cmd, in_opts, bench_files, out_opt, pbs,
                                  job_prefix, queue, pbs_extra_args)
     self.assertEqual(obs, exp_bench_suite_files_pbs)
Exemplo n.º 8
0
    def run(self, **kwargs):
        # Get command parameters
        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        pbs = kwargs['pbs']
        job_prefix = kwargs['job_prefix']
        queue = kwargs['queue']
        pbs_extra_args = kwargs['pbs_extra_args']

        # Check which type of bench suite are we generating
        if parameters:
            # We are generating a benchmark suite based on different parameter
            # values. In such case, the user should not provide any bench file
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt, pbs, job_prefix,
                                                    queue, pbs_extra_args)
        elif bench_files:
            # We are generating a benchmark suite based on input files,
            # Check that the number of benchmark files for test case match
            # the number of options to provide the input files
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError("The length of bench_files and in_opts "
                                   "must be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt, pbs, job_prefix, queue,
                                               pbs_extra_args)
        else:
            # Not enough parameters!
            raise CommandError("Must specify parameters or bench_files.")

        return {'bench_suite': bench_str}
Exemplo n.º 9
0
    def run(self, **kwargs):
        # Get command parameters
        command = kwargs['command']
        out_opt = kwargs['out_opt']
        parameters = kwargs['parameters']
        bench_files = kwargs['bench_files']
        in_opts = kwargs['in_opts']
        pbs = kwargs['pbs']
        job_prefix = kwargs['job_prefix']
        queue = kwargs['queue']
        pbs_extra_args = kwargs['pbs_extra_args']

        # Check which type of bench suite are we generating
        if parameters:
            # We are generating a benchmark suite based on different parameter
            # values. In such case, the user should not provide any bench file
            if bench_files:
                raise CommandError("Parameters or bench_files should be "
                                   "provided, but not both.")
            bench_str = make_bench_suite_parameters(command, parameters,
                                                    out_opt, pbs, job_prefix,
                                                    queue, pbs_extra_args)
        elif bench_files:
            # We are generating a benchmark suite based on input files,
            # Check that the number of benchmark files for test case match
            # the number of options to provide the input files
            if not all(len(x) == len(in_opts) for x in bench_files):
                raise CommandError("The length of bench_files and in_opts "
                                   "must be the same.")
            bench_str = make_bench_suite_files(command, in_opts, bench_files,
                                               out_opt, pbs, job_prefix, queue,
                                               pbs_extra_args)
        else:
            # Not enough parameters!
            raise CommandError("Must specify parameters or bench_files.")

        return {'bench_suite': bench_str}