本文整理汇总了Python中pyicoteolib.core.Cluster.write_line方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.write_line方法的具体用法?Python Cluster.write_line怎么用?Python Cluster.write_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyicoteolib.core.Cluster
的用法示例。
在下文中一共展示了Cluster.write_line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wig_read_write
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_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')
示例2: test_extend
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_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')
示例3: test_pk_print_empty
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_pk_print_empty(self):
cluster1 = Cluster(write=PK)
self.assertEqual(cluster1.write_line(), '')
cluster1.write_as(WIG)
self.assertEqual(cluster1.write_line(), '')
cluster1.write_as(BED)
self.assertEqual(cluster1.write_line(), '')
cluster1.write_as(ELAND)
self.assertEqual(cluster1.write_line(), '')
示例4: test_write_pk
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_write_pk(self):
cluster = Cluster(write=PK, name='chr5', start=1, rounding=True, write_half_open=True)
cluster.append_level(100, 1)
cluster.append_level(50, 2)
cluster.append_level(50, 3)
cluster.append_level(100, 1)
cluster.append_level(200, 0)
cluster.append_level(1, 3)
cluster.append_level(10, 0)
cluster.append_level(100, 1)
self.assertEqual(cluster.write_line(), 'chr5\t0\t300\t100:1|50:2|50:3|100:1\t3.0\t.\t175\t450.0\nchr5\t500\t501\t1:3\t3.0\t.\t501\t3.0\nchr5\t511\t611\t100:1\t1.0\t.\t561\t100.0\n') #HALF OPEN
cluster.write_as(PK, False) #Now write it as closed
self.assertEqual(cluster.write_line(),'chr5\t1\t300\t100:1|50:2|50:3|100:1\t3.0\t.\t175\t450.0\nchr5\t501\t501\t1:3\t3.0\t.\t501\t3.0\nchr5\t512\t611\t100:1\t1.0\t.\t561\t100.0\n') #Closed
示例5: test_add2
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_add2(self):
cluster = Cluster(read=BED)
cluster.read_line('chr1 1 20000 666 hola +')
cluster.read_line('chr1 1 20000 666 hola +')
cluster.read_line('chr1 1 20000 666 hola +')
cluster.read_line('chr1 1001 20000 666 hola +')
self.assertEqual(cluster.write_line(), 'chr1\t1\t20000\t1000:3.00|19000:4.00\t4.0\t+\t10500\t79000.0\n')
示例6: test_sub_and_print
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_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')
示例7: test_sub_fast
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_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
示例8: test_simple_ucsc_representation
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_simple_ucsc_representation(self):
"""Confirmed visually at the UCSC browser
track name=simple_read visibility=full
chr3 101 200 noname 555 +
track type=wiggle_0 name=the_test visibility=full
chr3 101 200 1
"""
cluster = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding = True, cached=True)
cluster.read_line('chr3 101 200 noname 555 +')
self.assertEqual(cluster.write_line(), 'chr3\t101\t200\t1\n')
示例9: test_bed_to_half_open_wig
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_bed_to_half_open_wig(self):
"""Confirmed visually at the UCSC browser
track name=simple_cluster visibility=full
chr1 1 100 hola 666 +
chr1 10 130 hola 666 +
track type=wiggle_0 name=the_test visibility=full
chr1 1 10 1
chr1 10 100 2
chr1 100 130 1
"""
cluster = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding = True, cached=True)
cluster.read_line('chr1 1 100 hola 666 +')
cluster.read_line('chr1 10 130 hola 666 +')
self.assertEqual(cluster.write_line(), 'chr1\t1\t10\t1\nchr1\t10\t100\t2\nchr1\t100\t130\t1\n')
示例10: test_bed_to_wig_extended
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_bed_to_wig_extended(self):
"""Confirmed visually at the UCSC browser
track name=unextended_cluster visibility=full
chr1 1 36 hola 666 +
chr1 2 37 hola 666 +
chr1 71 106 hola 666 -
chr1 73 108 hola 666 -
track name=extended_cluster visibility=full
chr1 1 101 hola 666 +
chr1 2 102 hola 666 +
chr1 6 106 hola 666 -
chr1 8 108 hola 666 -
track type=wiggle_0 name=extended_wig visibility=full
chr1 1 2 1
chr1 2 6 2
chr1 6 8 3
chr1 8 101 4
chr1 101 102 3
chr1 102 106 2
chr1 106 108 1
"""
cluster = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding = True)
cluster = self.read_and_extend(cluster, 'chr1 1 36 hola 666 +', 100)
cluster = self.read_and_extend(cluster, 'chr1 2 37 hola 666 +', 100)
cluster = self.read_and_extend(cluster, 'chr1 71 106 hola 666 -', 100)
cluster = self.read_and_extend(cluster, 'chr1 73 108 hola 666 -', 100)
result = Cluster(read=WIG, write=WIG, read_half_open=True, write_half_open=True, rounding = True)
result.read_line('chr1 1 2 1')
result.read_line('chr1 2 6 2')
result.read_line('chr1 6 8 3')
result.read_line('chr1 8 101 4')
result.read_line('chr1 101 102 3')
result.read_line('chr1 102 106 2')
result.read_line('chr1 106 108 1')
self.assertEqual(cluster.write_line(), result.write_line())
示例11: test_bed_half_open_to_wig_half_open2
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_bed_half_open_to_wig_half_open2(self):
cluster = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding=True, cached=True)
cluster2 = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding=True, cached=True)
cluster3 = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding=True, cached=True)
result = Cluster(read=BED, write=WIG, read_half_open=True, write_half_open=True, rounding=True)
extension = 130
result.read_line('chr1 156 192 id:7043691 1000 +')
result.extend(extension)
cluster.read_line('chr1 241 277 id:916714 1000 +')
cluster.extend(extension)
result +=cluster
cluster2.read_line('chr1 241 277 id:916714 1000 +')
cluster2.extend(extension)
result +=cluster2
cluster3.read_line('chr1 241 277 id:6880101 1000 +')
cluster3.extend(extension)
result +=cluster3
self.assertEqual(result.write_line(), 'chr1\t156\t241\t1\nchr1\t241\t286\t4\nchr1\t286\t371\t3\n')
示例12: test_eland_read_write
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_eland_read_write(self):
cluster = Cluster(read=ELAND, write=ELAND)
cluster.read_line('>EAS38_1_1_113_546 TAGAATAGGCGAGAATAAAGATGTTGTCTTAGAAT U0 1 0 0 chr2.fa 199668361 R ..')
self.assertEqual(cluster.write_line(), '>EAS38_1_1_113_546\tTAGAATAGGCGAGAATAAAGATGTTGTCTTAGAAT\tU0\t1\t0\t0\tchr2.fa\t199668361\tR\t..\t26A\n')
示例13: test_cluster_pk
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_cluster_pk(self):
cluster = Cluster(read=PK)
cluster.read_line('chr1\t1\t145\t9:2.00|41:3.00|50:2.00|45:1.00\n')
cluster.read_line('chr1\t1\t125\t9:4.00|41:3.00|30:2.00|45:1.00\n')
self.assertEqual(cluster.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')
示例14: test_pk_to_half_open_wig
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_pk_to_half_open_wig(self):
cluster = Cluster(read=PK, write=WIG, write_half_open=True, rounding=True)
cluster.read_line('chr1 1 15 4:1|1:2|2:1|3:4|2:5|2:2|1:1')
self.assertEqual(cluster.write_line(),'chr1\t0\t4\t1\nchr1\t4\t5\t2\nchr1\t5\t7\t1\nchr1\t7\t10\t4\nchr1\t10\t12\t5\nchr1\t12\t14\t2\nchr1\t14\t15\t1\n')
示例15: test_pk_to_variable_wig
# 需要导入模块: from pyicoteolib.core import Cluster [as 别名]
# 或者: from pyicoteolib.core.Cluster import write_line [as 别名]
def test_pk_to_variable_wig(self):
cluster = Cluster(read=PK, write=VARIABLE_WIG)
cluster.read_line('chr1 1599889 1600275 61:1.77|52:2.65|7:1.77|4:2.65|6:3.54|9:2.65|19:3.54|6:4.42|14:5.31|1:6.19|11:7.08|1:7.96|20:7.08|9:7.96|1:8.85|13:9.73|1:10.62|8:11.50|5:12.39|6:13.27|2:12.39|1:13.27|1:14.16|11:15.04|19:14.16|6:13.27|14:12.39|1:11.50|11:10.62|21:9.73|9:8.85|1:7.96|13:7.08|1:6.19|8:5.31|5:4.42|2:3.54|6:2.65|1:1.77')
self.assertEqual(cluster.write_line(), '1599889\t1.77\n1599909\t1.77\n1599929\t1.77\n1599949\t2.606\n1599969\t2.65\n1599989\t2.342\n1600009\t2.9615\n1600029\t3.628\n1600049\t5.2645\n1600069\t7.124\n1600089\t7.476\n1600109\t10.173\n1600129\t12.918\n1600149\t14.556\n1600169\t13.362\n1600189\t11.372\n1600209\t9.73\n1600229\t8.053\n1600249\t5.3085\n')