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


Python TitleAlignments.residueCounts方法代码示例

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


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

示例1: testResidueCountsTwoReadsTwoHSPsLeftOverhang

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
    def testResidueCountsTwoReadsTwoHSPsLeftOverhang(self):
        """
        The residueCounts method must return the correct result when two
        reads, each with one HSP are aligned to a title and the leftmost HSP
        is aligned before the left edge of the subject (i.e, will include
        negative subject offsets).

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

示例2: testResidueCountsOneReadTwoHSPsNotOverlapping

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
    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,代码行数:33,代码来源:test_titles.py

示例3: testResidueCountsCaseConvertUpperIsDefault

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
    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,代码行数:28,代码来源:test_titles.py

示例4: testResidueCountsCaseConvertLower

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
    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,代码行数:29,代码来源:test_titles.py

示例5: testResidueCountsOneReadTwoHSPsNotAtStartOfSubject

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
    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,代码行数:30,代码来源:test_titles.py

示例6: testResidueCountsNoReads

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
 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,代码行数:10,代码来源:test_titles.py

示例7: testResidueCountsOneReadOneHSP

# 需要导入模块: from dark.titles import TitleAlignments [as 别名]
# 或者: from dark.titles.TitleAlignments import residueCounts [as 别名]
 def testResidueCountsOneReadOneHSP(self):
     """
     The residueCounts method must return the correct result when just one
     read with one HSP is aligned to a title.
     """
     read = Read('id', 'ACGT')
     hsp = HSP(33, readStart=0, readEnd=4, readStartInSubject=0,
               readEndInSubject=4, subjectStart=0, subjectEnd=4,
               readMatchedSequence='ACGT', subjectMatchedSequence='ACGT')
     titleAlignments = TitleAlignments('subject title', 55)
     titleAlignment = TitleAlignment(read, [hsp])
     titleAlignments.addAlignment(titleAlignment)
     self.assertEqual(
         {
             0: {'A': 1},
             1: {'C': 1},
             2: {'G': 1},
             3: {'T': 1},
         },
         titleAlignments.residueCounts())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:22,代码来源:test_titles.py


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