• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python stockholm._tabular_msa_to_stockholm函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skbio.io.format.stockholm._tabular_msa_to_stockholm函数的典型用法代码示例。如果您正苦于以下问题:Python _tabular_msa_to_stockholm函数的具体用法?Python _tabular_msa_to_stockholm怎么用?Python _tabular_msa_to_stockholm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_tabular_msa_to_stockholm函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_msa_to_stockholm_multiple_references

 def test_msa_to_stockholm_multiple_references(self):
     fp = get_data_path('stockholm_multiple_references')
     msa = TabularMSA(
         [],
         metadata={'RN': [OrderedDict([('RM', '123456789'),
                                       ('RT', 'Title 1'),
                                       ('RA', 'Author 1'),
                                       ('RL', 'Location 1'),
                                       ('RC', 'Comment 1')]),
                          OrderedDict([('RM', '987654321'),
                                       ('RT', 'Title 2'),
                                       ('RA', 'Author 2'),
                                       ('RL', 'Location 2'),
                                       ('RC', 'Comment 2')]),
                          OrderedDict([('RM', '132465879'),
                                       ('RT', 'Title 3'),
                                       ('RA', 'Author 3'),
                                       ('RL', 'Location 3'),
                                       ('RC', 'Comment 3')])]})
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:26,代码来源:test_stockholm.py


示例2: test_rn_not_list_of_refs_error

 def test_rn_not_list_of_refs_error(self):
     msa = TabularMSA([], metadata={'RN': '1'})
     with self.assertRaisesRegex(StockholmFormatError,
                                 r"Expected 'RN'.*list of reference"
                                 ".*got '1'"):
         fh = io.StringIO()
         _tabular_msa_to_stockholm(msa, fh)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:7,代码来源:test_stockholm.py


示例3: test_msa_to_stockholm_extensive

 def test_msa_to_stockholm_extensive(self):
     fp = get_data_path('stockholm_all_data_types')
     msa = TabularMSA([DNA('GAGGCCATGCCCAGGTGAAG',
                           metadata=OrderedDict([('DT', 'February 1, 2016'),
                                                 ('NM', 'Unknown')])),
                       DNA('ACCTGAGCCACAGTAGAAGT'),
                       DNA('CCCTTCGCTGGAAATGTATG',
                           metadata={'DT': 'Unknown'},
                           positional_metadata=OrderedDict([('AS',
                                                             list('CCGAAAGT'
                                                                  'CGTTCGA'
                                                                  'AAATG')),
                                                            ('SS',
                                                             list('GGCGAGTC'
                                                                  'GTTCGAGC'
                                                                  'TGG'
                                                                  'C'))]))],
                      metadata=OrderedDict([('NM', 'Kestrel Gorlick'),
                                           ('DT', 'February 11, 2016'),
                                           ('FN', 'Writer test file')]),
                      positional_metadata=OrderedDict([('AS_cons',
                                                        list('CGTTCGTTCTAAC'
                                                             'AATTCCA')),
                                                       ('SS_cons',
                                                        list('GGCGCTACGACCT'
                                                             'ACGACCG'))]),
                      index=['seq1', 'seq2', 'seq3'])
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:34,代码来源:test_stockholm.py


示例4: test_unoriginal_index_error

 def test_unoriginal_index_error(self):
     msa = TabularMSA([DNA('ATCGCCAGCT'), DNA('TTGTGCTGGC')],
                      index=['seq1', 'seq1'])
     with self.assertRaisesRegex(StockholmFormatError,
                                 'index labels must be unique.'):
         fh = io.StringIO()
         _tabular_msa_to_stockholm(msa, fh)
开发者ID:bassio,项目名称:scikit-bio,代码行数:7,代码来源:test_stockholm.py


示例5: test_invalid_reference_tag_error

 def test_invalid_reference_tag_error(self):
     msa = TabularMSA([], metadata={'RN': [OrderedDict([('RL', 'Flagstaff'),
                                                        ('foo', 'bar')])]})
     with self.assertRaisesRegex(StockholmFormatError,
                                 r"Invalid reference.*foo' found "
                                 "in.*1.*Valid reference tags are:"):
             fh = io.StringIO()
             _tabular_msa_to_stockholm(msa, fh)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:8,代码来源:test_stockholm.py


示例6: test_round_trip_nonstring_index_values

 def test_round_trip_nonstring_index_values(self):
     fp = get_data_path('stockholm_nonstring_labels')
     msa = _stockholm_to_tabular_msa(fp, constructor=DNA)
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例7: test_round_trip_empty

 def test_round_trip_empty(self):
     fp = get_data_path('stockholm_no_data')
     msa = _stockholm_to_tabular_msa(fp, constructor=Protein)
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例8: test_msa_to_stockholm_single_tree

 def test_msa_to_stockholm_single_tree(self):
     fp = get_data_path('stockholm_single_tree_without_id')
     msa = TabularMSA([], metadata=OrderedDict([('NH', 'ABCD')]))
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例9: test_msa_to_stockholm_minimal

 def test_msa_to_stockholm_minimal(self):
     fp = get_data_path('stockholm_minimal')
     msa = TabularMSA([DNA('TGTGTCGCAGTTGTCGTTTG')], index=['0235244'])
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例10: test_rn_data_not_in_dict_error

 def test_rn_data_not_in_dict_error(self):
     msa = TabularMSA([], metadata={'RN': [OrderedDict([('RL',
                                                         'Flagstaff')]),
                                           'Incorrect Item']})
     with self.assertRaisesRegex(StockholmFormatError,
                                 r"Expected reference information.*stored"
                                 " as a dictionary, found.*2 stored as "
                                 "'str'"):
         fh = io.StringIO()
         _tabular_msa_to_stockholm(msa, fh)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例11: test_msa_to_stockholm_empty

 def test_msa_to_stockholm_empty(self):
     fp = get_data_path('stockholm_no_data')
     msa = TabularMSA([])
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例12: test_msa_to_stockholm_single_tree_as_dict

 def test_msa_to_stockholm_single_tree_as_dict(self):
     fp = get_data_path('stockholm_single_tree_with_id')
     msa = TabularMSA([], metadata={'NH': {'tree1': 'ABCD'}})
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:10,代码来源:test_stockholm.py


示例13: test_msa_to_stockholm_data_only

 def test_msa_to_stockholm_data_only(self):
     fp = get_data_path('stockholm_data_only')
     msa = TabularMSA([RNA('ACUCCGACAUGCUCC'),
                       RNA('UAGUGCCGAACGCUG'),
                       RNA('GUGUGGGCGUGAUUC')],
                      index=['seq1', 'seq2', 'seq3'])
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:13,代码来源:test_stockholm.py


示例14: test_gc_wrong_dataframe_item_length_error

 def test_gc_wrong_dataframe_item_length_error(self):
     seq1 = list('GAGCAAGCCACTAGA')
     seq1.append('GG')
     pos_metadata_dataframe = pd.DataFrame({'AC': seq1,
                                            'SS': list('TCCTTGAACTACCCGA'),
                                            'AS': list('TCAGCTCTGCAGCGTT')})
     msa = TabularMSA([DNA('TCCTTGAACTACCCGA')],
                      positional_metadata=pos_metadata_dataframe)
     with self.assertRaisesRegex(StockholmFormatError,
                                 'Multiple sequence alignment positional '
                                 'metadata.*must contain a single character'
                                 '.*Found value\(s\) in column AC'):
         fh = io.StringIO()
         _tabular_msa_to_stockholm(msa, fh)
开发者ID:bassio,项目名称:scikit-bio,代码行数:14,代码来源:test_stockholm.py


示例15: test_msa_to_stockholm_single_reference

 def test_msa_to_stockholm_single_reference(self):
     fp = get_data_path('stockholm_single_reference')
     msa = TabularMSA(
         [],
         metadata={'RN': [OrderedDict([('RM', '123456789'),
                                       ('RT', 'A Title'),
                                       ('RA', 'The Author'),
                                       ('RL', 'A Location'),
                                       ('RC', 'Comment')])]})
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:16,代码来源:test_stockholm.py


示例16: test_msa_to_stockholm_multiple_trees

 def test_msa_to_stockholm_multiple_trees(self):
     fp = get_data_path('stockholm_multiple_trees')
     msa = TabularMSA([], metadata=OrderedDict([('NH',
                                                 OrderedDict([('tree1',
                                                               'ABCD'),
                                                              ('tree2',
                                                               'EFGH'),
                                                              ('tree3',
                                                               'IJKL')]))]))
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:16,代码来源:test_stockholm.py


示例17: test_msa_to_stockholm_nonstring_values

 def test_msa_to_stockholm_nonstring_values(self):
     fp = get_data_path('stockholm_nonstring_labels')
     msa = TabularMSA([DNA('ACTG', metadata=OrderedDict([(8, 123)]),
                           positional_metadata=OrderedDict([(1.0,
                                                             [1, 2, 3, 4])])
                           )],
                      metadata=OrderedDict([(1.3, 2857)]),
                      positional_metadata=OrderedDict([(25, [4, 3, 2, 1])]),
                      index=[11214])
     fh = io.StringIO()
     _tabular_msa_to_stockholm(msa, fh)
     obs = fh.getvalue()
     fh.close()
     with io.open(fp) as fh:
         exp = fh.read()
     self.assertEqual(obs, exp)
开发者ID:bassio,项目名称:scikit-bio,代码行数:16,代码来源:test_stockholm.py


示例18: test_unoriginal_gc_feature_names_error

    def test_unoriginal_gc_feature_names_error(self):
        pos_metadata_dataframe = pd.DataFrame(
            [
                list('GAGCAAGCCACTAGA'),
                list('TCCTTGAACTACCCG'),
                list('TCAGCTCTGCAGCGT'),
                list('GTCAGGCGCTCGGTG')
            ],
            index=['AC', 'SS', 'SS', 'AC']

        ).T

        msa = TabularMSA([DNA('CCCCTGCTTTCGTAG')],
                         positional_metadata=pos_metadata_dataframe)
        with self.assertRaisesRegex(StockholmFormatError,
                                    r'Multiple sequence alignment positional '
                                    'metadata.*must be unique. Found 2 '
                                    'duplicate'):
            fh = io.StringIO()
            _tabular_msa_to_stockholm(msa, fh)
开发者ID:mortonjt,项目名称:scikit-bio,代码行数:20,代码来源:test_stockholm.py


示例19: test_unoriginal_gr_feature_names_error

 def test_unoriginal_gr_feature_names_error(self):
     pos_metadata_dataframe = pd.DataFrame.from_items([('AC',
                                                        list('GAGCAAGCCACTA'
                                                             'GA')),
                                                       ('SS',
                                                        list('TCCTTGAACTACC'
                                                             'CG')),
                                                       ('AS',
                                                        list('TCAGCTCTGCAGC'
                                                             'GT')),
                                                       ('SS',
                                                        list('GTCAGGCGCTCGG'
                                                             'TG'))])
     msa = TabularMSA([DNA('CGTCAATCTCGAACT',
                       positional_metadata=pos_metadata_dataframe)],
                      index=['seq1'])
     with self.assertRaisesRegex(StockholmFormatError,
                                 'Sequence-specific positional metadata.*'
                                 'must be unique. Found 1 duplicate'):
         fh = io.StringIO()
         _tabular_msa_to_stockholm(msa, fh)
开发者ID:bassio,项目名称:scikit-bio,代码行数:21,代码来源:test_stockholm.py



注:本文中的skbio.io.format.stockholm._tabular_msa_to_stockholm函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python metadata.IntervalMetadata类代码示例发布时间:2022-05-27
下一篇:
Python _base._get_nth_sequence函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap