当前位置: 首页>>代码示例>>Python>>正文


Python TitlesAlignments.sortTitles方法代码示例

本文整理汇总了Python中dark.titles.TitlesAlignments.sortTitles方法的典型用法代码示例。如果您正苦于以下问题:Python TitlesAlignments.sortTitles方法的具体用法?Python TitlesAlignments.sortTitles怎么用?Python TitlesAlignments.sortTitles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dark.titles.TitlesAlignments的用法示例。


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

示例1: testTitle

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testTitle(self):
     """
     Sorting on title must work.
     """
     mockOpener = mockOpen(read_data=(
         dumps(PARAMS) + '\n' + dumps(RECORD0) + '\n' +
         dumps(RECORD1) + '\n' + dumps(RECORD2) + '\n' +
         dumps(RECORD3) + '\n'))
     with patch.object(builtins, 'open', mockOpener):
         reads = Reads()
         reads.add(Read('id0', 'A' * 70))
         reads.add(Read('id1', 'A' * 70))
         reads.add(Read('id2', 'A' * 70))
         reads.add(Read('id3', 'A' * 70))
         readsAlignments = BlastReadsAlignments(
             reads, 'file.json', scoreClass=LowerIsBetterScore)
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('title')
         self.assertEqual([
             'gi|887699|gb|DQ37780 Cowpox virus 15',
             'gi|887699|gb|DQ37780 Monkeypox virus 456',
             'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',
             'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',
             'gi|887699|gb|DQ37780 Squirrelpox virus 55',
         ], result)
开发者ID:bamueh,项目名称:dark-matter,代码行数:27,代码来源:test_titles.py

示例2: testMaxScore_EValue

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testMaxScore_EValue(self):
     """
     Sorting on max score must work when scores are e values, including a
     secondary sort on title.
     """
     mockOpener = mockOpen(read_data=(
         dumps(PARAMS) + '\n' + dumps(RECORD0) + '\n' +
         dumps(RECORD1) + '\n' + dumps(RECORD2) + '\n' +
         dumps(RECORD3) + '\n'))
     with patch.object(builtins, 'open', mockOpener):
         reads = Reads()
         reads.add(Read('id0', 'A' * 70))
         reads.add(Read('id1', 'A' * 70))
         reads.add(Read('id2', 'A' * 70))
         reads.add(Read('id3', 'A' * 70))
         readsAlignments = BlastReadsAlignments(
             reads, 'file.json', scoreClass=LowerIsBetterScore)
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('maxScore')
         # self.assertEqual([
         #     'gi|887699|gb|DQ37780 Cowpox virus 15',            # 1e-6
         #     'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',   # 1e-7
         #     'gi|887699|gb|DQ37780 Monkeypox virus 456',        # 1e-8
         #     'gi|887699|gb|DQ37780 Squirrelpox virus 55',       # 1e-10
         #     'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',  # 1e-11
         # ], result)
         self.assertEqual([
             'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',  # 1e-11
             'gi|887699|gb|DQ37780 Squirrelpox virus 55',       # 1e-10
             'gi|887699|gb|DQ37780 Monkeypox virus 456',        # 1e-8
             'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',   # 1e-7
             'gi|887699|gb|DQ37780 Cowpox virus 15',            # 1e-6
         ], result)
开发者ID:bamueh,项目名称:dark-matter,代码行数:35,代码来源:test_titles.py

示例3: testMedianScore_Bits

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testMedianScore_Bits(self):
     """
     Sorting on median score must work when scores are bit scores,
     including a secondary sort on title.
     """
     mockOpener = mockOpen(read_data=(
         dumps(PARAMS) + '\n' + dumps(RECORD0) + '\n' +
         dumps(RECORD1) + '\n' + dumps(RECORD2) + '\n' +
         dumps(RECORD3) + '\n' + dumps(RECORD4) + '\n'))
     with patch.object(builtins, 'open', mockOpener):
         reads = Reads()
         reads.add(Read('id0', 'A' * 70))
         reads.add(Read('id1', 'A' * 70))
         reads.add(Read('id2', 'A' * 70))
         reads.add(Read('id3', 'A' * 70))
         reads.add(Read('id4', 'A' * 70))
         readsAlignments = BlastReadsAlignments(reads, 'file.json')
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('medianScore')
         self.assertEqual([
             'gi|887699|gb|DQ37780 Squirrelpox virus 55',       # 25
             'gi|887699|gb|DQ37780 Monkeypox virus 456',        # 20
             'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',   # 20
             'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',  # 20
             'gi|887699|gb|DQ37780 Cowpox virus 15',            # 20
         ], result)
开发者ID:bamueh,项目名称:dark-matter,代码行数:28,代码来源:test_titles.py

示例4: testLength

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testLength(self):
     """
     Sorting on sequence length must work, including a secondary sort on
     title.
     """
     mockOpener = mockOpen(read_data=(
         dumps(PARAMS) + '\n' + dumps(RECORD0) + '\n' +
         dumps(RECORD1) + '\n' + dumps(RECORD2) + '\n' +
         dumps(RECORD3) + '\n'))
     with patch('__builtin__.open', mockOpener, create=True):
         reads = Reads()
         reads.add(Read('id0', 'A' * 70))
         reads.add(Read('id1', 'A' * 70))
         reads.add(Read('id2', 'A' * 70))
         reads.add(Read('id3', 'A' * 70))
         readsAlignments = BlastReadsAlignments(
             reads, 'file.json', scoreClass=LowerIsBetterScore)
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('length')
         self.assertEqual([
             'gi|887699|gb|DQ37780 Squirrelpox virus 55',       # 38000
             'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',  # 37000
             'gi|887699|gb|DQ37780 Monkeypox virus 456',        # 35000
             'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',   # 35000
             'gi|887699|gb|DQ37780 Cowpox virus 15',            # 30000
         ], result)
开发者ID:sophiemathias,项目名称:dark-matter,代码行数:28,代码来源:test_titles.py

示例5: testMedianScore_EValue

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testMedianScore_EValue(self):
     """
     Sorting on median score must work when scores are bit scores,
     including a secondary sort on title.
     """
     mockOpener = mockOpen(read_data=(
         dumps(PARAMS) + '\n' + dumps(RECORD0) + '\n' +
         dumps(RECORD1) + '\n' + dumps(RECORD2) + '\n' +
         dumps(RECORD3) + '\n' + dumps(RECORD4) + '\n'))
     with patch('__builtin__.open', mockOpener, create=True):
         reads = Reads()
         reads.add(Read('id0', 'A' * 70))
         reads.add(Read('id1', 'A' * 70))
         reads.add(Read('id2', 'A' * 70))
         reads.add(Read('id3', 'A' * 70))
         reads.add(Read('id4', 'A' * 70))
         readsAlignments = BlastReadsAlignments(
             reads, 'file.json', scoreClass=LowerIsBetterScore)
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('medianScore')
         self.assertEqual([
             'gi|887699|gb|DQ37780 Squirrelpox virus 1296/99',  # 1e-11
             'gi|887699|gb|DQ37780 Squirrelpox virus 55',       # 1e-10
             'gi|887699|gb|DQ37780 Monkeypox virus 456',        # 1e-8
             'gi|887699|gb|DQ37780 Mummypox virus 3000 B.C.',   # 1e-7
             'gi|887699|gb|DQ37780 Cowpox virus 15',            # worst :-)
         ], result)
开发者ID:sophiemathias,项目名称:dark-matter,代码行数:29,代码来源:test_titles.py

示例6: testEmpty

# 需要导入模块: from dark.titles import TitlesAlignments [as 别名]
# 或者: from dark.titles.TitlesAlignments import sortTitles [as 别名]
 def testEmpty(self):
     """
     Sorting when there are no titles must return the empty list.
     """
     mockOpener = mockOpen(read_data=dumps(PARAMS) + '\n')
     with patch.object(builtins, 'open', mockOpener):
         reads = Reads()
         readsAlignments = BlastReadsAlignments(reads, 'file.json')
         titlesAlignments = TitlesAlignments(readsAlignments)
         result = titlesAlignments.sortTitles('title')
         self.assertEqual([], result)
开发者ID:bamueh,项目名称:dark-matter,代码行数:13,代码来源:test_titles.py


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