Example #1
0
    def test_update(self):
        """
        Test if update on sample data is working
        """
        path_data = "tests/ganon/integration/data/"
        prefix = "test_update"
        ret = ganon.main(
            shlex.split("ganon update --db-prefix " + path_data +
                        "sample_bacteria --output-db-prefix " + prefix +
                        " --taxdump-file " + path_data + "mini_nodes.dmp " +
                        path_data + "mini_names.dmp --seq-info-file " +
                        path_data + "virus_acc_len_taxid.txt --input-files " +
                        path_data + "virus_NC_003676.1.fasta.gz " + path_data +
                        "virus_NC_011646.1.fasta.gz " + path_data +
                        "virus_NC_032412.1.fasta.gz " + path_data +
                        "virus_NC_035470.1.fasta.gz"))

        # check if ran okay
        self.assertFalse(ret, "ganon update finish with an error")

        # check if files were created
        for ext in ["ibf", "map", "tax", "gnn"]:
            self.assertTrue(
                Path(prefix + "." + ext).is_file(), "File (" + ext +
                ") was not created")  # TODO check file contents
Example #2
0
    def test_build(self):
        """
        Test if build on sample data is working
        """
        path_data = "tests/ganon/integration/data/"
        prefix = "test_build"
        ret = ganon.main(
            shlex.split("ganon build --db-prefix " + prefix +
                        " --taxdump-file " + path_data + "mini_nodes.dmp " +
                        path_data + "mini_names.dmp --seq-info-file " +
                        path_data +
                        "bacteria_acc_len_taxid.txt --input-files " +
                        path_data + "bacteria_NC_010333.1.fasta.gz " +
                        path_data + "bacteria_NC_017164.1.fasta.gz " +
                        path_data + "bacteria_NC_017163.1.fasta.gz " +
                        path_data + "bacteria_NC_017543.1.fasta.gz"))

        # check if ran okay
        self.assertFalse(ret, "ganon build finish with an error")

        # check if files were created
        for ext in ["filter", "map", "bins", "nodes"]:
            self.assertTrue(
                Path(prefix + "." + ext).is_file(), "File (" + ext +
                ") was not created")  # TODO check file contents
Example #3
0
    def test_report(self):
        """
        Test if report on sample data is working
        """
        path_data = "tests/ganon/integration/data/"
        output_file = "test_report.tre"
        ret = ganon.main(
            shlex.split("./ganon report --output-report " + output_file +
                        " --db-prefix " + path_data +
                        "sample_bacteria --rep-file " + path_data +
                        "results.rep --rank all"))

        # check if ran okay
        self.assertFalse(ret, "ganon report finish with an error")

        # check if files were created
        self.assertTrue(
            Path(output_file).is_file(),
            "File (" + output_file + ") was not created")
Example #4
0
    def test_classify(self):
        """
        Test if classify on sample data is working
        """
        path_data = "tests/ganon/integration/data/"
        prefix = "test_classify"
        ret = ganon.main(
            shlex.split("./ganon classify --output-all --db-prefix " +
                        path_data + "sample_bacteria --single-reads " +
                        path_data + "bacteria.simulated.1.fq -o " + prefix))

        # check if ran okay
        self.assertFalse(ret, "ganon classify finish with an error")

        # check if files were created
        for ext in ["lca", "all", "rep", "tre"]:
            self.assertTrue(
                Path(prefix + "." + ext).is_file(), "File (" + ext +
                ") was not created")  # TODO check file contents