Ejemplo n.º 1
0
    def test_keep_sam_file(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--index", index_fp])

        self.args.extend(["--keep-sam-file"])
        human_filter_main(self.args)
        sam_fp = os.path.join(self.output_dir, "B5_short_R1.sam")
        self.assertTrue(os.path.exists(sam_fp))
Ejemplo n.º 2
0
    def test_keep_sam_file(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--index", index_fp])

        self.args.extend(["--keep-sam-file"])
        human_filter_main(self.args)
        sam_fp = os.path.join(self.output_dir, "B5_short_R1.sam")
        self.assertTrue(os.path.exists(sam_fp))
Ejemplo n.º 3
0
    def test_keep_sam_file(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        config_file = tempfile.NamedTemporaryFile(suffix=".json")
        json.dump({"method": "bwa", "index": index_fp}, config_file)
        config_file.seek(0)
        self.args.extend(["--config-file", config_file.name])

        self.args.extend(["--keep-sam-file"])
        human_filter_main(self.args)
        sam_fp = os.path.join(self.output_dir, "B5_short_R1.sam")
        self.assertTrue(os.path.exists(sam_fp))
Ejemplo n.º 4
0
    def test_bwa(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--index", index_fp])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 5
0
    def test_bwa(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--index", index_fp])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 6
0
    def test_bwa(self):
        index_fp = os.path.join(data_dir, "fakehuman")
        config_file = tempfile.NamedTemporaryFile(suffix=".json")
        json.dump({"method": "bwa", "index": index_fp}, config_file)
        config_file.seek(0)
        self.args.extend(["--config-file", config_file.name])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 7
0
    def test_all_human(self):
        self.args.extend(["--method", "all_human"])
        human_filter_main(self.args)

        with open(self.summary_fp) as f:
            obs_summary = json.load(f)
        self.assertEqual(obs_summary["data"], {"true": 10})

        for fp in self.output_fps["nonhuman"]:
            self.assertFalse(os.path.exists(fp))

        for fp in self.output_fps["human"]:
            with open(fp) as f:
                num_lines = len(list(f))
            self.assertEqual(num_lines, 10 * 4)
Ejemplo n.º 8
0
    def test_all_human(self):
        self.args.extend(["--method", "all_human"])
        human_filter_main(self.args)

        with open(self.summary_fp) as f:
            obs_summary = json.load(f)
        self.assertEqual(obs_summary["data"], {"true": 10})

        for fp in self.output_fps["nonhuman"]:
            self.assertFalse(os.path.exists(fp))

        for fp in self.output_fps["human"]:
            with open(fp) as f:
                num_lines = len(list(f))
            self.assertEqual(num_lines, 10 * 4)
Ejemplo n.º 9
0
    def test_with_sam_file(self):
        sam_file = tempfile.NamedTemporaryFile(suffix=".sam", mode="w")
        sam_file.write(b5_sam)
        sam_file.seek(0)
        self.args.extend(["--sam-file", sam_file.name])

        # Set executable for BWA to "false"
        # This program always returns non-zero exit status
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--bwa_fp", "false"])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 10
0
    def test_with_sam_file(self):
        sam_file = tempfile.NamedTemporaryFile(suffix=".sam", mode="w")
        sam_file.write(b5_sam)
        sam_file.seek(0)
        self.args.extend(["--sam-file", sam_file.name])

        # Set executable for BWA to "false"
        # This program always returns non-zero exit status
        self.args.extend(["--method", "bwa"])
        self.args.extend(["--bwa_fp", "false"])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 11
0
    def test_no_human(self):
        config_file = tempfile.NamedTemporaryFile(suffix=".json")
        json.dump({"method": "no_human"}, config_file)
        config_file.seek(0)
        self.args.extend(["--config-file", config_file.name])

        human_filter_main(self.args)

        with open(self.summary_fp) as f:
            obs_summary = json.load(f)
        self.assertEqual(obs_summary["data"], {"false": 10})

        for fp in self.output_fps["nonhuman"]:
            with open(fp) as f:
                num_lines = len(list(f))
            self.assertEqual(num_lines, 10 * 4)

        for fp in self.output_fps["human"]:
            self.assertFalse(os.path.exists(fp))
Ejemplo n.º 12
0
    def test_with_sam_file(self):
        sam_file = tempfile.NamedTemporaryFile(suffix=".sam")
        sam_file.write(b5_sam)
        sam_file.seek(0)
        self.args.extend(["--sam-file", sam_file.name])

        # Set executable for BWA to "false"
        # This program always returns non-zero exit status
        config_file = tempfile.NamedTemporaryFile(suffix=".json")
        config = {"method": "bwa", "bwa_fp": "false"}
        json.dump(config, config_file)
        config_file.seek(0)
        self.args.extend(["--config-file", config_file.name])

        human_filter_main(self.args)

        for fp in self.output_fps["human"]:
            self.assertTrue(os.path.exists(fp))

        for fp in self.output_fps["nonhuman"]:
            self.assertTrue(os.path.exists(fp))
Ejemplo n.º 13
0
#!/usr/bin/python
from decontamlib.main import human_filter_main

human_filter_main()
Ejemplo n.º 14
0
#!/usr/bin/python
from decontamlib.main import human_filter_main
human_filter_main()