Exemple #1
0
    def test_filename_basename_keep_filtered_gc_bounds_min_length(self):
        for min_length in self.min_length_test_set:
            test_args = [
                ("fastq_filtrator.py", "--min_length", min_length,
                 "--gc_bounds", "20", "21", "--keep_filtered",
                 "--output_base_name", "filtered", "example.fastq"),
                ("fastq_filtrator.py", "example.fastq", "--min_length",
                 min_length, "--gc_bounds", "20", "21", "--keep_filtered",
                 "--output_base_name", "filtered"),
                ("fastq_filtrator.py", "--output_base_name", "filtered",
                 "--min_length", min_length, "example.fastq", "--gc_bounds",
                 "20", "21", "--keep_filtered"),
                ("fastq_filtrator.py", "--output_base_name", "filtered",
                 "--keep_filtered", "--min_length", min_length, "--gc_bounds",
                 "20", "21", "example.fastq"),
                ("fastq_filtrator.py", "--output_base_name", "filtered",
                 "--keep_filtered", "--gc_bounds", "20", "21", "--min_length",
                 min_length, "example.fastq")
            ]
            answ = deepcopy(self.output_dict_default)
            answ.update(
                dict(file_name="example.fastq",
                     output_base_name="filtered",
                     keep_filtered=True,
                     gc_bounds=[20, 21],
                     min_length=int(min_length)))

            for arg_set in test_args:
                result = parse_arguments(arg_set)
                self.assertDictEqual(result, answ)
Exemple #2
0
    def test_filename_basename_keep_filtered_gc_bounds(self):
        for gc_bounds in self.gc_bounds_test_set:
            test_args = [
                ("fastq_filtrator.py", "--gc_bounds", *gc_bounds,
                 "--keep_filtered", "--output_base_name", "filtered",
                 "example.fastq"),
                ("fastq_filtrator.py", "example.fastq", "--gc_bounds",
                 *gc_bounds, "--keep_filtered", "--output_base_name",
                 "filtered"),
                ("fastq_filtrator.py", "--output_base_name", "filtered",
                 "example.fastq", "--gc_bounds", *gc_bounds,
                 "--keep_filtered"),
                ("fastq_filtrator.py", "--output_base_name", "filtered",
                 "--keep_filtered", "--gc_bounds", *gc_bounds, "example.fastq")
            ]
            answ = deepcopy(self.output_dict_default)
            if len(gc_bounds) == 2:
                answ.update(
                    dict(file_name="example.fastq",
                         output_base_name="filtered",
                         keep_filtered=True,
                         gc_bounds=[int(gc_bounds[0]),
                                    int(gc_bounds[1])]))
            elif len(gc_bounds) == 1:
                answ.update(
                    dict(file_name="example.fastq",
                         output_base_name="filtered",
                         keep_filtered=True,
                         gc_bounds=[int(gc_bounds[0]), 100]))

            for arg_set in test_args:
                result = parse_arguments(arg_set)
                self.assertDictEqual(result, answ)
Exemple #3
0
    def test_filename_only(self):
        test_args = ["fastq_filtrator.py", "example.fastq"]
        answ = deepcopy(self.output_dict_default)
        answ.update(dict(file_name="example.fastq",
                         output_base_name="example"))

        result = parse_arguments(test_args)
        self.assertDictEqual(result, answ)
Exemple #4
0
    def test_filename_and_basename(self):
        for base_name in self.base_names_test_set:
            test_args = [("fastq_filtrator.py", "--output_base_name",
                          base_name, "example.fastq"),
                         ("fastq_filtrator.py", "example.fastq",
                          "--output_base_name", base_name)]
            answ = deepcopy(self.output_dict_default)
            answ.update(
                dict(file_name="example.fastq", output_base_name=base_name))

            for arg_set in test_args:
                result = parse_arguments(arg_set)
                self.assertDictEqual(result, answ)
Exemple #5
0
    def test_filename_basename_keep_filtered(self):
        test_args = [("fastq_filtrator.py", "--keep_filtered",
                      "--output_base_name", "filtered", "example.fastq"),
                     ("fastq_filtrator.py", "example.fastq", "--keep_filtered",
                      "--output_base_name", "filtered"),
                     ("fastq_filtrator.py", "example.fastq",
                      "--output_base_name", "filtered", "--keep_filtered")]
        answ = deepcopy(self.output_dict_default)
        answ.update(
            dict(file_name="example.fastq",
                 output_base_name="filtered",
                 keep_filtered=True))

        for arg_set in test_args:
            result = parse_arguments(arg_set)
            self.assertDictEqual(result, answ)