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


Python titles.TitleAlignments类代码示例

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


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

示例1: testReadIdsEmpty

 def testReadIdsEmpty(self):
     """
     The readIds function must return the empty set if no reads matched a
     title.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     self.assertEqual(0, len(titleAlignments.readIds()))
开发者ID:terrycojones,项目名称:dark-matter,代码行数:7,代码来源:test_titles.py

示例2: testReadsEmpty

 def testReadsEmpty(self):
     """
     The reads function must return an empty Reads instance if there are no
     reads for the title.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     self.assertEqual(0, len(titleAlignments.reads()))
开发者ID:terrycojones,项目名称:dark-matter,代码行数:7,代码来源:test_titles.py

示例3: testCoverageNoReads

 def testCoverageNoReads(self):
     """
     The coverage method must return zero when a title alignments has no
     alignments (and therefore no coverage).
     """
     titleAlignments = TitleAlignments('subject title', 100)
     self.assertEqual(0.0, titleAlignments.coverage())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:7,代码来源:test_titles.py

示例4: testResidueCountsOneReadTwoHSPsNotAtStartOfSubject

    def testResidueCountsOneReadTwoHSPsNotAtStartOfSubject(self):
        """
        The residueCounts method must return the correct result when just one
        read with two HSPs is aligned to a title and the leftmost HSP is not
        aligned with the left edge of the subject.

        HSP1:       ACGT
        HSP2:        CGTT
        """
        read = Read('id', 'ACGT')
        hsp1 = HSP(33, readStart=0, readEnd=4, readStartInSubject=10,
                   readEndInSubject=14, subjectStart=10, subjectEnd=14,
                   readMatchedSequence='ACGT', subjectMatchedSequence='ACGT')
        hsp2 = HSP(33, readStart=0, readEnd=4, readStartInSubject=11,
                   readEndInSubject=15, subjectStart=11, subjectEnd=15,
                   readMatchedSequence='CGTT', subjectMatchedSequence='CGTT')
        titleAlignments = TitleAlignments('subject title', 55)
        titleAlignment = TitleAlignment(read, [hsp1, hsp2])
        titleAlignments.addAlignment(titleAlignment)
        self.assertEqual(
            {
                10: {'A': 1},
                11: {'C': 2},
                12: {'G': 2},
                13: {'T': 2},
                14: {'T': 1},
            },
            titleAlignments.residueCounts())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:28,代码来源:test_titles.py

示例5: testResidueCountsCaseConvertUpperIsDefault

    def testResidueCountsCaseConvertUpperIsDefault(self):
        """
        The residueCounts method must convert to uppercase by default.

        HSP1:       AcgT
        HSP2:        CGTT
        """
        read = Read('id', 'ACGT')
        hsp1 = HSP(33, readStart=0, readEnd=4, readStartInSubject=10,
                   readEndInSubject=14, subjectStart=10, subjectEnd=14,
                   readMatchedSequence='AcgT', subjectMatchedSequence='ACGT')
        hsp2 = HSP(33, readStart=0, readEnd=4, readStartInSubject=11,
                   readEndInSubject=15, subjectStart=11, subjectEnd=15,
                   readMatchedSequence='CGTT', subjectMatchedSequence='CGTT')
        titleAlignments = TitleAlignments('subject title', 55)
        titleAlignment = TitleAlignment(read, [hsp1, hsp2])
        titleAlignments.addAlignment(titleAlignment)
        self.assertEqual(
            {
                10: {'A': 1},
                11: {'C': 2},
                12: {'G': 2},
                13: {'T': 2},
                14: {'T': 1},
            },
            titleAlignments.residueCounts())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:26,代码来源:test_titles.py

示例6: testResidueCountsCaseConvertLower

    def testResidueCountsCaseConvertLower(self):
        """
        The residueCounts method must return the correct result when asked to
        convert residues to lower case.

        HSP1:       AcgT
        HSP2:        CGTT
        """
        read = Read('id', 'ACGT')
        hsp1 = HSP(33, readStart=0, readEnd=4, readStartInSubject=10,
                   readEndInSubject=14, subjectStart=10, subjectEnd=14,
                   readMatchedSequence='AcgT', subjectMatchedSequence='ACGT')
        hsp2 = HSP(33, readStart=0, readEnd=4, readStartInSubject=11,
                   readEndInSubject=15, subjectStart=11, subjectEnd=15,
                   readMatchedSequence='CGTT', subjectMatchedSequence='CGTT')
        titleAlignments = TitleAlignments('subject title', 55)
        titleAlignment = TitleAlignment(read, [hsp1, hsp2])
        titleAlignments.addAlignment(titleAlignment)
        self.assertEqual(
            {
                10: {'a': 1},
                11: {'c': 2},
                12: {'g': 2},
                13: {'t': 2},
                14: {'t': 1},
            },
            titleAlignments.residueCounts(convertCaseTo='lower'))
开发者ID:terrycojones,项目名称:dark-matter,代码行数:27,代码来源:test_titles.py

示例7: testResidueCountsOneReadTwoHSPsNotOverlapping

    def testResidueCountsOneReadTwoHSPsNotOverlapping(self):
        """
        The residueCounts method must return the correct result when just one
        read with two HSPs is aligned to a title and the HSPs do not overlap
        one another.

        HSP1:    ACGT
        HSP2:              CGTT
        """
        read = Read('id', 'ACGT')
        hsp1 = HSP(33, readStart=0, readEnd=4, readStartInSubject=0,
                   readEndInSubject=4, subjectStart=0, subjectEnd=4,
                   readMatchedSequence='ACGT', subjectMatchedSequence='ACGT')
        hsp2 = HSP(33, readStart=0, readEnd=4, readStartInSubject=10,
                   readEndInSubject=14, subjectStart=10, subjectEnd=14,
                   readMatchedSequence='CGTT', subjectMatchedSequence='CGTT')
        titleAlignments = TitleAlignments('subject title', 55)
        titleAlignment = TitleAlignment(read, [hsp1, hsp2])
        titleAlignments.addAlignment(titleAlignment)
        self.assertEqual(
            {
                0: {'A': 1},
                1: {'C': 1},
                2: {'G': 1},
                3: {'T': 1},
                10: {'C': 1},
                11: {'G': 1},
                12: {'T': 1},
                13: {'T': 1},
            },
            titleAlignments.residueCounts())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:31,代码来源:test_titles.py

示例8: testResidueCountsNoReads

 def testResidueCountsNoReads(self):
     """
     When a title has no reads aligned to it, the residueCounts method
     must retrun an empty result.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     counts = titleAlignments.residueCounts()
     self.assertEqual(0, len(counts))
开发者ID:terrycojones,项目名称:dark-matter,代码行数:8,代码来源:test_titles.py

示例9: testCoverageInfoNoReads

 def testCoverageInfoNoReads(self):
     """
     When a title has no reads aligned to it, the coverageInfo method
     must return an empty result.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     coverage = titleAlignments.coverageInfo()
     self.assertEqual({}, coverage)
开发者ID:acorg,项目名称:dark-matter,代码行数:8,代码来源:test_titles.py

示例10: testMedianScoreWithNoHsps

 def testMedianScoreWithNoHsps(self):
     """
     The medianScore function must raise ValueError if there are no HSPs.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     read = Read('id1', 'AAA')
     titleAlignment = TitleAlignment(read, [])
     titleAlignments.addAlignment(titleAlignment)
     error = '^arg is an empty sequence$'
     six.assertRaisesRegex(self, ValueError, error,
                           titleAlignments.medianScore)
开发者ID:terrycojones,项目名称:dark-matter,代码行数:11,代码来源:test_titles.py

示例11: testAddAlignment

 def testAddAlignment(self):
     """
     It must be possible to add an alignment to an instance of
     TitleAlignments.
     """
     titleAlignments = TitleAlignments('subject title', 55)
     read = Read('id', 'AAA')
     titleAlignment = TitleAlignment(read, [])
     titleAlignments.addAlignment(titleAlignment)
     self.assertEqual(read, titleAlignments[0].read)
     self.assertEqual([], titleAlignments[0].hsps)
开发者ID:terrycojones,项目名称:dark-matter,代码行数:11,代码来源:test_titles.py

示例12: testMedianScoreOfTwo

 def testMedianScoreOfTwo(self):
     """
     The medianScore function must return the median score for the HSPs in
     all the alignments matching a title when given 2 scores.
     """
     hsp1 = HSP(7)
     hsp2 = HSP(15)
     titleAlignments = TitleAlignments('subject title', 55)
     read = Read('id1', 'AAA')
     titleAlignment = TitleAlignment(read, [hsp1, hsp2])
     titleAlignments.addAlignment(titleAlignment)
     self.assertEqual(11, titleAlignments.medianScore())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:12,代码来源:test_titles.py

示例13: testFullCoverage

 def testFullCoverage(self):
     """
     The coverage method must return the correct value when the title is
     fully covered by its reads.
     """
     hsp1 = HSP(7, subjectStart=0, subjectEnd=50)
     hsp2 = HSP(8, subjectStart=50, subjectEnd=100)
     titleAlignments = TitleAlignments('subject title', 100)
     read = Read('id1', 'AAA')
     titleAlignment = TitleAlignment(read, [hsp1, hsp2])
     titleAlignments.addAlignment(titleAlignment)
     self.assertEqual(1.0, titleAlignments.coverage())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:12,代码来源:test_titles.py

示例14: makeTitleAlignments

    def makeTitleAlignments(self, *readIds):
        """
        Create a TitleAlignments instance containing reads with the
        ids given by C{ids}.

        param readIds: A C{list} of integer ids for reads.
        @return: A C{TitleAlignments} instance with reads with the given ids.
        """
        titleAlignments = TitleAlignments("subject title", 55)
        for readId in readIds:
            titleAlignment = TitleAlignment(Read("id" + str(readId), "A"), [])
            titleAlignments.addAlignment(titleAlignment)
        return titleAlignments
开发者ID:sophiemathias,项目名称:dark-matter,代码行数:13,代码来源:test_filter.py

示例15: testFullCoverageCounts

 def testFullCoverageCounts(self):
     """
     The coverageCounts method must return the correct result when the title
     is fully covered by its reads.
     """
     hsp1 = HSP(7, subjectStart=0, subjectEnd=5)
     hsp2 = HSP(8, subjectStart=5, subjectEnd=10)
     titleAlignments = TitleAlignments('subject title', 10)
     read = Read('id1', 'AAA')
     titleAlignment = TitleAlignment(read, [hsp1, hsp2])
     titleAlignments.addAlignment(titleAlignment)
     c = Counter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
     self.assertEqual(c, titleAlignments.coverageCounts())
开发者ID:acorg,项目名称:dark-matter,代码行数:13,代码来源:test_titles.py


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