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


Python Cluster.overlap方法代码示例

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


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

示例1: get_overlaping_clusters

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import overlap [as 别名]
    def get_overlaping_clusters(self, region, overlap=1):
        clusters = []
        bam_tell, read_start = self.get_bam_tell(region)
        print "TELL", bam_tell, read_start
        if bam_tell or region.start < LINEAR_SIZE*4:
            r = BamReader(self.bam_path, self.logger, bam_tell, read_start, self.chr_dict_inv)
            for line in r:
                c = Cluster(read=SAM, cached=False, read_half_open=self.read_half_open, rounding=self.rounding)
                try:
                    c.read_line(line)
                except InvalidLine:
                    print "Invalid line, .bam or .bai corrupt"
                    break

                if c.overlap(region) >= overlap:                
                    clusters.append(c)
                elif c.start > region.end or c.name != region.name:
                    break

        if len(clusters) > 0:
            print "Num clusters", len(clusters)
            print "first:", clusters[0].start, clusters[0].end
            if len(clusters) > 1: print "end:", clusters[-1].start, clusters[-1].end
        else:
            print "No clusters found!"
        print

        return clusters
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:30,代码来源:bam.py

示例2: test_overlap

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import overlap [as 别名]
    def test_overlap(self):
        cluster1 = Cluster(read=BED)
        cluster1.read_line('chr1 1 100 hola 666 +')
        cluster2 = Cluster(read=BED)
        cluster2.read_line('chr1 51 200 hola 666 +')
        cluster3 = Cluster(read=PK)
        cluster3.read_line('chr3 1 100 100:1')
        cluster4 = Cluster(read=BED)
        cluster4.read_line('chr5 1 1000 hola 666 +')
        cluster5 = Cluster(read=PK)
        cluster5.read_line('chr5 1 300 300:1')
        cluster6 = Cluster(read=BED)
        cluster6.read_line('chr5 100 900 hola 666 +')

        cluster_discard = Cluster(read=BED, read_half_open=True)
        cluster_discard.read_line('chrX	61836251	61836287	id:105282	1000	+')
        cluster_satellite = Cluster(read=BED)
        cluster_satellite.read_line('chrX	61836270	61837703	Satellite')
        self.assertEqual(cluster_discard.overlap(cluster_satellite), 0.5)
        self.assertEqual(cluster1.overlap(cluster3), 0)
        self.assertEqual(cluster1.overlap(cluster1), 1)
        self.assertEqual(cluster1.overlap(cluster2), 0.5)
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:24,代码来源:testCore.py


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