本文整理汇总了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
示例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)