コード例 #1
0
ファイル: test_fasta.py プロジェクト: squirrelo/scikit-bio
    def test_fasta_to_tabular_msa(self):
        test_cases = (self.empty, self.single,
                      self.tabular_msa_different_type,
                      self.lowercase_seqs)

        # see comment in test_fasta_to_generator_valid_files (above) for
        # testing strategy
        for exp_list, kwargs, fasta_fps, qual_fps in test_cases:
            if 'constructor' not in kwargs:
                kwargs['constructor'] = CustomSequence
                exp_list = [CustomSequence(seq) for seq in exp_list]

            exp = TabularMSA(exp_list)

            for fasta_fp in fasta_fps:
                obs = _fasta_to_tabular_msa(fasta_fp, **kwargs)

                self.assertEqual(len(obs), len(exp))
                for o, e in zip(obs, exp):
                    e = e.copy()
                    del e.positional_metadata['quality']
                    self.assertEqual(o, e)

                for qual_fp in qual_fps:
                    obs = _fasta_to_tabular_msa(fasta_fp, qual=qual_fp,
                                                **kwargs)
                    self.assertEqual(obs, exp)
コード例 #2
0
    def test_fasta_to_tabular_msa(self):
        test_cases = (self.empty, self.single,
                      self.tabular_msa_different_type,
                      self.lowercase_seqs)

        # see comment in test_fasta_to_generator_valid_files (above) for
        # testing strategy
        for exp_list, kwargs, fasta_fps, qual_fps in test_cases:
            if 'constructor' not in kwargs:
                kwargs['constructor'] = CustomSequence
                exp_list = [CustomSequence(seq) for seq in exp_list]

            exp = TabularMSA(exp_list)

            for fasta_fp in fasta_fps:
                obs = _fasta_to_tabular_msa(fasta_fp, **kwargs)

                self.assertEqual(len(obs), len(exp))
                for o, e in zip(obs, exp):
                    e = e.copy()
                    del e.positional_metadata['quality']
                    self.assertEqual(o, e)

                for qual_fp in qual_fps:
                    obs = _fasta_to_tabular_msa(fasta_fp, qual=qual_fp,
                                                **kwargs)
                    self.assertEqual(obs, exp)
コード例 #3
0
ファイル: test_fasta.py プロジェクト: squirrelo/scikit-bio
 def test_fasta_to_tabular_msa_no_constructor(self):
     with self.assertRaisesRegex(ValueError, '`constructor`'):
         _fasta_to_tabular_msa(get_data_path('fasta_single_seq'))
コード例 #4
0
 def test_fasta_to_tabular_msa_no_constructor(self):
     with six.assertRaisesRegex(self, ValueError, '`constructor`'):
         _fasta_to_tabular_msa(get_data_path('fasta_single_seq'))