def test_generate_rtax_commands(self):
        """Functions correctly using standard valid input data."""
        exp = [[('Assigning taxonomy (RTAX, single-end)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_single '
                 '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt '
                 '--read_1_seqs_fp /foo/bar/read_1_seqs.fna')],
               [('Adding taxa (RTAX, single-end)',
                 'add_taxa.py -i /foo/bar/otu_table.biom '
                 '-o /foo/bar/rtax_single/otu_table_w_taxa.biom '
                 '-t /foo/bar/rtax_single/rep_set_tax_assignments.txt')],
               [('Summarizing taxa (RTAX, single-end)',
                 'summarize_taxa.py -i /foo/bar/rtax_single/otu_table_w_taxa.biom '
                 '-o /foo/bar/rtax_single')],
               [('Assigning taxonomy (RTAX, paired-end)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_paired '
                 '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt '
                 '--read_1_seqs_fp /foo/bar/read_1_seqs.fna '
                 '--read_2_seqs_fp /foo/bar/read_2_seqs.fna')],
               [('Adding taxa (RTAX, paired-end)',
                 'add_taxa.py -i /foo/bar/otu_table.biom '
                 '-o /foo/bar/rtax_paired/otu_table_w_taxa.biom '
                 '-t /foo/bar/rtax_paired/rep_set_tax_assignments.txt')],
               [('Summarizing taxa (RTAX, paired-end)',
                 'summarize_taxa.py -i /foo/bar/rtax_paired/otu_table_w_taxa.biom '
                 '-o /foo/bar/rtax_single')]]

        obs = _generate_rtax_commands('/foo/bar', '/foo/bar/rep_set.fna',
                '/baz/reference_seqs.fasta', '/baz/id_to_taxonomy.txt',
                '/foo/bar/otu_table.biom', '/foo/bar/read_1_seqs.fna',
                read_2_seqs_fp='/foo/bar/read_2_seqs.fna')
    def test_generate_rtax_commands_custom_regexes(self):
        """Correctly passes custom regexes through to RTAX."""
        exp = [[('Assigning taxonomy (RTAX, mode: single)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_single.tmp -m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt --read_1_seqs_fp /foo/bar/read_1_seqs.fna --read_id_regex \'f*\' --amplicon_id_regex \'*b\' --header_id_regex \'b(*)z\'')],
               [('Assigning taxonomy (RTAX, mode: paired)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_paired.tmp ' '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt ' '--read_1_seqs_fp /foo/bar/read_1_seqs.fna ' '--read_2_seqs_fp /foo/bar/read_2_seqs.fna --read_id_regex \'f*\' --amplicon_id_regex \'*b\' --header_id_regex \'b(*)z\' --single_ok')]]

        obs = _generate_rtax_commands('/foo/bar', '/foo/bar/rep_set.fna',
                '/baz/reference_seqs.fasta', '/baz/id_to_taxonomy.txt',
                '/foo/bar/otu_table.biom', ['single', 'paired'],
                '/foo/bar/read_1_seqs.fna', '/foo/bar/read_2_seqs.fna', 'f*',
                '*b', 'b(*)z')

        self.assertEqual(len(obs), 8)
        self.assertEqual(obs[0], exp[0])
        self.assertEqual(obs[4], exp[1])
Ejemplo n.º 3
0
    def test_generate_rtax_single_commands(self):
        """Functions correctly using standard valid input data."""
        exp = [
            [('Assigning taxonomy (RTAX, single-end)',
              'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_single '
              '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt '
              '--read_1_seqs_fp /foo/bar/read_1_seqs.fna')],
            [('Adding taxa (RTAX, single-end)',
              'add_taxa.py -i /foo/bar/otu_table.biom '
              '-o /foo/bar/rtax_single/otu_table_w_taxa.biom '
              '-t /foo/bar/rtax_single/rep_set_tax_assignments.txt')],
            [('Summarizing taxa (RTAX, single-end)',
              'summarize_taxa.py -i /foo/bar/rtax_single/otu_table_w_taxa.biom '
              '-o /foo/bar/rtax_single')]
        ]

        obs = _generate_rtax_commands('/foo/bar', '/foo/bar/rep_set.fna',
                                      '/baz/reference_seqs.fasta',
                                      '/baz/id_to_taxonomy.txt',
                                      '/foo/bar/otu_table.biom',
                                      '/foo/bar/read_1_seqs.fna')
    def test_generate_rtax_commands(self):
        """Functions correctly using standard valid input data."""
        exp = [[('Assigning taxonomy (RTAX, mode: single)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_single.tmp '
                 '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt '
                 '--read_1_seqs_fp /foo/bar/read_1_seqs.fna')],
                 [('Adding metadata (RTAX, mode: single)',
                 'biom add-metadata -i /foo/bar/otu_table.biom -o '
                 '/foo/bar/rtax_single.tmp/otu_table_w_taxa.biom '
                 '--observation-metadata-fp '
                 '/foo/bar/rtax_single.tmp/rep_set_tax_assignments.txt '
                 '--sc-separated taxonomy --observation-header OTUID,taxonomy')],
                 [('Summarizing taxa (RTAX, mode: single)',
                 'summarize_taxa.py -i /foo/bar/rtax_single.tmp/otu_table_w_taxa.biom '
                 '-o /foo/bar/rtax_single.tmp')],
                 [('Renaming output directory (RTAX, mode: single)',
                 'mv /foo/bar/rtax_single.tmp /foo/bar/rtax_single')],
                 [('Assigning taxonomy (RTAX, mode: paired)',
                 'assign_taxonomy.py -i /foo/bar/rep_set.fna -o /foo/bar/rtax_paired.tmp '
                 '-m rtax -r /baz/reference_seqs.fasta -t /baz/id_to_taxonomy.txt '
                 '--read_1_seqs_fp /foo/bar/read_1_seqs.fna '
                 '--read_2_seqs_fp /foo/bar/read_2_seqs.fna --single_ok')],
                 [('Adding metadata (RTAX, mode: paired)',
                 'biom add-metadata -i /foo/bar/otu_table.biom -o '
                 '/foo/bar/rtax_paired.tmp/otu_table_w_taxa.biom '
                 '--observation-metadata-fp '
                 '/foo/bar/rtax_paired.tmp/rep_set_tax_assignments.txt '
                 '--sc-separated taxonomy --observation-header OTUID,taxonomy')],
                 [('Summarizing taxa (RTAX, mode: paired)',
                 'summarize_taxa.py -i /foo/bar/rtax_paired.tmp/otu_table_w_taxa.biom '
                 '-o /foo/bar/rtax_paired.tmp')],
                 [('Renaming output directory (RTAX, mode: paired)',
                 'mv /foo/bar/rtax_paired.tmp /foo/bar/rtax_paired')]]

        obs = _generate_rtax_commands('/foo/bar', '/foo/bar/rep_set.fna',
                '/baz/reference_seqs.fasta', '/baz/id_to_taxonomy.txt',
                '/foo/bar/otu_table.biom', ['single', 'paired'],
                '/foo/bar/read_1_seqs.fna', '/foo/bar/read_2_seqs.fna')
        self.assertEqual(obs, exp)