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


Python Cluster.read_line方法代码示例

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


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

示例1: test_sub_and_print

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_sub_and_print(self):
     cluster = Cluster()
     cluster2 = Cluster(write_half_open=False)
     cluster.read_line('chr1    1  1000  10:2|10:4|80:5|500:7|100:7|100:5')
     cluster2.read_line('chr1    11  1000  10:4|80:5|500:6|100:7|99:5|1:4.99')
     cluster2 = cluster - cluster2
     self.assertEqual(cluster2.write_line(), 'chr1\t1\t10\t10:2.00\t2.0\t.\t5\t20.0\nchr1\t101\t600\t500:1.00\t1.0\t.\t350\t500.0\nchr1\t800\t800\t1:0.01\t0.01\t.\t800\t0.01\n')
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:9,代码来源:testCore.py

示例2: test_is_contiguous_wig

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_is_contiguous_wig(self):
     cluster = Cluster(read=WIG,  read_half_open=True)
     cluster.read_line('chr1    1599888 1599949 1.77')
     cluster2 = Cluster(read=WIG, write=WIG,  read_half_open=True)
     cluster2.read_line('chr1    1599949 1600001 2.65')
     #print cluster2.write_line()
     self.assertTrue(cluster.is_contiguous(cluster2))
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:9,代码来源:testCore.py

示例3: test_subtract_with_gaps

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_subtract_with_gaps(self):
     cluster1 = Cluster()
     cluster2 = Cluster()
     cluster1.read_line("chr2 1 100 30:1|50:2|40:1|3000:3")
     cluster2.read_line("chr2 1 100 30:1|50:0|40:1|200:0|5000:1")
     cluster1 -= cluster2
     self.assertEqual(cluster1._profile, [[50, 2.0], [40, 0.0], [200, 3.0], [2800, 2.0]])
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:9,代码来源:testCore.py

示例4: test_add_pk

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_add_pk(self):
     cluster1 = Cluster(read=PK)
     cluster2 = Cluster(read=PK)
     cluster1.read_line('chr1\t1\t145\t9:2.00|41:3.00|50:2.00|45:1.00\n')
     cluster2.read_line('chr1\t1\t125\t9:4.00|41:3.00|30:2.00|45:1.00\n')
     result = cluster1 + cluster2
     self.assertEqual(result.write_line(), 'chr1\t1\t145\t50:6.00|30:4.00|20:3.00|25:2.00|20:1.00\t6.0\t.\t25\t550.0\n')
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:9,代码来源:testCore.py

示例5: test_bug_contiguous_peaks

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_bug_contiguous_peaks(self):
     cluster = Cluster(rounding=True, read=PK, write=PK)
     cluster2 = Cluster(rounding=True, read=PK, write=PK)
     cluster.read_line('chr1    849917  850408  8:2|10:4|80:5|23:6|29:7|8:5|10:3|39:2|12:3|29:4|5:3|18:4|41:3|30:4|15:5|12:4|34:3|59:2|30:1')
     cluster2.read_line('chr1    850408  850648  66:2|25:3|59:4|66:2|25:1        +')
     result = cluster + cluster2
     self.assertTrue(cluster.intersects(cluster2))
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:9,代码来源:testCore.py

示例6: get_overlaping_clusters

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [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

示例7: test_wig_read_write

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_wig_read_write(self):
     cluster = Cluster(read=WIG, write=WIG, read_half_open=True, write_half_open=True, rounding=True)
     cluster.read_line('chr2 1 10 1')
     cluster.read_line('chr2 10 16 2')
     cluster.read_line('chr2 16 26 1')
     self.assertEqual(cluster.write_line(), 'chr2\t1\t10\t1\nchr2\t10\t16\t2\nchr2\t16\t26\t1\n')
     cluster.write_as(WIG, False)
     self.assertEqual(cluster.write_line(), 'chr2\t2\t10\t1\nchr2\t11\t16\t2\nchr2\t17\t26\t1\n')
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:10,代码来源:testCore.py

示例8: test_sub_fast

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_sub_fast(self):
    #random/experiment.pk 
    experiment = Cluster(rounding=True)       
    experiment.read_line("chr1   1     1107     101:2|7:1  2.0     .       263     238.0")   
    control = Cluster() 
    control.read_line(  "chr1   46    1222      47:1|54:2|47:1 2.0     .       71331   202.0")
    experiment -= control
    self.assertEqual(experiment.write_line(), 'chr1\t1\t92\t45:2|47:1\t2.0\t.\t23\t137.0\n')#chr1    1       92      45:2|47:1       2.0     .       23      137.0
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:10,代码来源:testCore.py

示例9: test_is_significant

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_is_significant(self):
     cluster = Cluster(rounding=True)
     cluster.read_line('chr1 1 15 4:1|1:2|2:1|3:4|2:5|2:2|1:1') #area 35
     self.assertTrue(cluster.is_significant(5, "numreads"))
     self.assertTrue(cluster.is_significant(34, "numreads"))
     self.assertFalse(cluster.is_significant(36, "numreads"))
     self.assertFalse(cluster.is_significant(20))
     self.assertTrue(cluster.is_significant(1))
     self.assertTrue(cluster.is_significant(5))
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:11,代码来源:testCore.py

示例10: test_extend

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_extend(self):
     cluster = Cluster(read=BED)
     cluster.read_line('chr3 1 35 noname 666 +')
     cluster2 = Cluster(read=BED)
     cluster2.read_line('chr3 56 100 noname 666 -')
     cluster.extend(100)
     cluster2.extend(100)
     self.assertEqual(cluster.write_line(), 'chr3\t1\t100\t100:1.00\t1.0\t+\t50\t100.0\n')
     self.assertEqual(cluster2.write_line(), 'chr3\t1\t100\t100:1.00\t1.0\t-\t50\t100.0\n')
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:11,代码来源:testCore.py

示例11: test_extend_bug

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_extend_bug(self):
     cluster = Cluster(read=BED, write=PK)
     cluster.read_line('chr3 1 35 666 noname +')
     cluster2 = Cluster(read=BED, write=PK)
     cluster2.read_line('chr3 156 200 666 noname -')
     cluster.extend(100)
     cluster2.extend(100)
     result = cluster + cluster2
     self.assertEqual(200, len(result))
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:11,代码来源:testCore.py

示例12: test_split_subtract_result

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_split_subtract_result(self):
     sub_result = Cluster(write_half_open=True, cached=True)
     sub_result.read_line('chr4 1 300 20:1|40:0|20:3|20:0.3|10:-6|80:1|10:0')
     clusters = sub_result.absolute_split(threshold=0)
     result = []
     result.append('chr4\t0\t20\t20:1.00\t1.0\t.\t10\t20.0\n')
     result.append('chr4\t60\t100\t20:3.00|20:0.30\t3.0\t.\t70\t66.0\n')
     result.append('chr4\t110\t190\t80:1.00\t1.0\t.\t150\t80.0\n')
     for i in range(0, len(clusters)):
         self.assertEqual(clusters[i].write_line(), result[i])
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:12,代码来源:testCore.py

示例13: test_intersects

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
 def test_intersects(self):
     self.assertTrue(Cluster('chr1', 1, 10).intersects(Cluster('chr1', 10, 14)))
     self.assertFalse(Cluster('chr2', 1, 10).intersects(Cluster('chr1', 4, 14)))
     self.assertTrue(Cluster('chr1', 1, 10).intersects(Cluster('chr1', 4, 14)))
     cluster = Cluster(read=PK, rounding=True)
     cluster.read_line('chr1  1 100 100:1')
     cluster2 = Cluster(read=PK,rounding=True)
     cluster2.read_line('chr1 100 199 100:1')
     result = cluster + cluster2
     self.assertTrue(cluster.intersects(cluster2))
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:12,代码来源:testCore.py

示例14: test_get_profile

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
    def test_get_profile(self):
        r = Region(start=1, end=1999)
        c = Cluster(read=BED)
        c.read_line('chr4 1 40')
        r.add_tags(c, True)
        c = Cluster(read=BED, read_half_open=True)
        c.read_line('chr4 400 500')
        r.add_tags(c, True)

        meta = r.get_metacluster()
        self.assertEqual(meta._levels, [[40, 1.0], [360, 0.0], [100, 1.0]])
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:13,代码来源:testCore.py

示例15: test_split

# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import read_line [as 别名]
    def test_split(self):
        double_cluster = Cluster(rounding=True)
        double_cluster.read_line('chr1  100  215  5:1|10:5|5:7|5:80|5:1|5:40|15:1|10:2|5:3|5:8|10:6|10:5|10:4|10:3|6:2')

        results = double_cluster.split(0.01)
        correct_clusters = [Cluster(rounding=True), Cluster(rounding=True), Cluster(rounding=True)]
        correct_clusters[0].read_line('chr1    100      125      5:1|10:5|5:7|5:80|2:1')
        correct_clusters[1].read_line('chr1    128      141      2:1|5:40|7:1')
        correct_clusters[2].read_line('chr1    143      215      7:1|10:2|5:3|5:8|10:6|10:5|10:4|10:3|6:2')
        for i in range (0,len(correct_clusters)):
            self.assertEqual(results[i].write_line(), correct_clusters[i].write_line())
开发者ID:23Skidoo,项目名称:genomizer-server,代码行数:13,代码来源:testCore.py


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