示例#1
0
    def test_humann2_gene_families_biom_input(self):
        """
        Test the standard humann2 flow on a gene families output file as input
        Test with the biom format of the gene families file
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("gene_families")

        # run humann2 test
        command = [
            "humann2", "--input", cfg.demo_gene_families_biom, "--output",
            tempdir
        ]
        utils.run_humann2(command)

        # check the output files are as expected
        # it will include all output files except the gene families output file
        # since this file was used as input
        for expression, message in utils.check_output(
                cfg.expected_demo_output_files_genefamilies_input, tempdir):
            self.assertTrue(expression, message)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)
示例#2
0
    def test_humann2_fastq_biom_output_pathways(self):
        """
        Test the standard humann2 flow on a fastq input file
        Test biom output is written
        Test the expected pathways are identified
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("fastq")

        # run humann2 test
        command = [
            "humann2", "--input", cfg.demo_fastq, "--output", tempdir,
            "--output-format", "biom", "--gap-fill", "off"
        ]
        utils.run_humann2(command)

        # check the output file of pathway abundance has the expected pathways
        pathways_file_tsv = utils.read_biom_table(
            os.path.join(tempdir, "demo_pathabundance.biom"))
        pathways_found = set([
            x.split("\t")[0].split(":")[0]
            for x in filter(lambda x: "PWY" in x, pathways_file_tsv)
        ])

        self.assertEqual(pathways_found,
                         cfg.expected_demo_output_files_biom_pathways)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)
示例#3
0
    def test_humann2_m8(self):
        """
        Test the standard humann2 flow on a m8 input file
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("m8")

        # run humann2 test
        command = ["humann2", "--input", cfg.demo_m8, "--output", tempdir]
        utils.run_humann2(command)

        # check the output files are as expected
        for expression, message in utils.check_output(
                cfg.expected_demo_output_files, tempdir):
            self.assertTrue(expression, message)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)
示例#4
0
    def test_humann2_fastq_biom_output(self):
        """
        Test the standard humann2 flow on a fastq input file
        Test biom output is written
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("fastq")

        # run humann2 test
        command = [
            "humann2", "--input", cfg.demo_fastq, "--output", tempdir,
            "--output-format", "biom"
        ]
        utils.run_humann2(command)

        # check the output files are as expected
        for expression, message in utils.check_output(
                cfg.expected_demo_output_files_biom, tempdir):
            self.assertTrue(expression, message)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)
示例#5
0
    def test_humann2_fastq_custom_taxonomic_profile(self):
        """
        Test the standard humann2 flow on a fastq input file
        Test with a custom taxonomic profile
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("fastq_custom_taxonomic_profile")

        # run humann2 test
        command = [
            "humann2", "--input", cfg.demo_fastq, "--output", tempdir,
            "--taxonomic-profile", cfg.demo_bugs_list
        ]
        utils.run_humann2(command)

        # check the output files are as expected
        for expression, message in utils.check_output(
                cfg.expected_demo_output_files, tempdir):
            self.assertTrue(expression, message)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)
示例#6
0
    def test_humann2_fasta_bypass_prescreen(self):
        """
        Test the standard humann2 flow on a fasta input file
        Test with bypassing prescreen
        """

        # create a temp directory for output
        tempdir = utils.create_temp_folder("fasta_bypass_prescreen")

        # run humann2 test
        command = [
            "humann2", "--input", cfg.demo_fasta, "--output", tempdir,
            "--bypass-prescreen"
        ]
        utils.run_humann2(command)

        # check the output files are as expected
        for expression, message in utils.check_output(
                cfg.expected_demo_output_files, tempdir):
            self.assertTrue(expression, message)

        # remove the temp directory
        utils.remove_temp_folder(tempdir)