Esempio n. 1
0
    def test_format_shogun_params(self):
        obs = _format_params(self.params, SHOGUN_PARAMS)
        exp = {
            'database': join(self.db_path, 'shogun'),
            'aligner': 'bowtie2',
            'threads': 1
        }

        self.assertEqual(obs, exp)
Esempio n. 2
0
    def test_format_shogun_params(self):
        obs = _format_params(self.params, SHOGUN_PARAMS)
        exp = {
            'database': join(self.db_path, 'rep82'),
            'aligner': 'bowtie2',
            'threads': 5,
            'percent_id': 0.95,
            'capitalist': False
        }

        self.assertEqual(obs, exp)
Esempio n. 3
0
    def test_generate_shogun_align_commands(self):
        out_dir = self.out_dir
        with TemporaryDirectory(dir=out_dir, prefix='shogun_') as temp_dir:

            exp_cmd = [('shogun align --aligner bowtie2 --threads 1 '
                        '--database %sshogun --input %s/combined.fna '
                        '--output %s') % (self.db_path, temp_dir, temp_dir)]

            params = _format_params(self.params, SHOGUN_PARAMS)
            obs_cmd = generate_shogun_align_commands(
                join(temp_dir, 'combined.fna'), temp_dir, params)

        self.assertEqual(obs_cmd, exp_cmd)
Esempio n. 4
0
    def test_generate_shogun_redist_commands(self):
        out_dir = self.out_dir
        with TemporaryDirectory(dir=out_dir, prefix='shogun_') as temp_dir:

            exp_cmd = [('shogun redistribute '
                        '--database %sshogun --level species --input %s '
                        '--output %s') %
                       (self.db_path, join(temp_dir, 'profile.tsv'),
                        join(temp_dir, 'profile.redist.species.tsv'))]
            profile_dir = join(temp_dir, 'profile.tsv')
            params = _format_params(self.params, SHOGUN_PARAMS)
            obs_cmd, output = generate_shogun_redist_commands(
                profile_dir, temp_dir, params, 'species')

        self.assertEqual(obs_cmd, exp_cmd)
Esempio n. 5
0
    def test_generate_shogun_assign_taxonomy_commands(self):
        out_dir = self.out_dir
        with TemporaryDirectory(dir=out_dir, prefix='shogun_') as temp_dir:

            exp_cmd = [('shogun assign_taxonomy --aligner bowtie2 '
                        '--database %sshogun --input %s/alignment.bowtie2.sam '
                        '--output %s/profile.tsv') %
                       (self.db_path, temp_dir, temp_dir)]
            exp_output_fp = join(temp_dir, 'profile.tsv')
            params = _format_params(self.params, SHOGUN_PARAMS)
            obs_cmd, obs_output_fp = generate_shogun_assign_taxonomy_commands(
                temp_dir, params)

        self.assertEqual(obs_cmd, exp_cmd)
        self.assertEqual(obs_output_fp, exp_output_fp)