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


Python IntervalFile.next方法代码示例

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


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

示例1: testStart

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
    def testStart(self):
        ivf = IntervalFile(self.file)
        iv = ivf.next()
        orig_string = str(iv)

        # 0-based.
        orig_start = iv.start

        # Setting .start always sets 0-based coord.
        iv.start = orig_start

        # But for GFF setting .start should also make the .fields[3] the GFF
        # 1-based coord
        assert iv.start == int(iv.fields[3])-1

        second_string = str(iv)
        second_start = iv.start
        iv.start = second_start

        # Check .start and .fields[3] internal consistency again
        assert iv.start == int(iv.fields[3])-1

        print '   orig:', '(start=%s)'%orig_start, orig_string
        print ' second:', '(start=%s)'%second_start, second_string
        print 'current:', '(start=%s)'%iv.start, str(iv)
        self.assert_(orig_start == second_start == iv.start)
        self.assert_(orig_string == second_string == str(iv))
开发者ID:ffrancis,项目名称:pybedtools,代码行数:29,代码来源:test_cbedtools.py

示例2: testName

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testName(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     iv.name = "bart simpson"
     self.assertEqual(iv.name, "bart simpson")
     if iv.file_type == "gff":
         self.assert_("bart" in iv.fields[8])
开发者ID:ffrancis,项目名称:pybedtools,代码行数:9,代码来源:test_cbedtools.py

示例3: testSetItem

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testSetItem(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     iv.chrom = 'chrfake'
     print iv.fields
     self.assertEqual(iv['chrom'], 'chrfake')
     self.assertEqual(iv.chrom, 'chrfake')
开发者ID:ffrancis,项目名称:pybedtools,代码行数:9,代码来源:test_cbedtools.py

示例4: testAppend

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testAppend(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     print iv.fields
     iv.append('asdf')
     print iv
     self.assertEqual(iv[-1], 'asdf')
开发者ID:ffrancis,项目名称:pybedtools,代码行数:9,代码来源:test_cbedtools.py

示例5: testGetItemNegative

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testGetItemNegative(self):
     "test negative indexes to feature."
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     self.assert_(iv[-self.fieldcount+self.chrpos].startswith("chr"), iv[-self.fieldcount+self.chrpos])
     self.assert_(iv[-self.fieldcount+self.startpos].isdigit(), iv[-self.fieldcount+self.startpos])
     self.assert_(iv[-self.fieldcount+self.stoppos].isdigit())
开发者ID:ffrancis,项目名称:pybedtools,代码行数:9,代码来源:test_cbedtools.py

示例6: testGetItem

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testGetItem(self):
     "getitem now supports direct access to the line."
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     self.assert_(iv[self.chrpos].startswith("chr"))
     self.assert_(iv[self.startpos].isdigit())
     self.assert_(iv[self.startpos].isdigit())
开发者ID:ffrancis,项目名称:pybedtools,代码行数:9,代码来源:test_cbedtools.py

示例7: testGetItemSliceNone

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testGetItemSliceNone(self):
     " test support for funky slices."
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     self.assertEqual(len(iv[:3]), 3)
     self.assertEqual(len(iv[3:3]), 0)
     self.assertEqual(len(iv[2:]), self.fieldcount-2, iv[2:])
     
     print len(iv.fields), iv.fields
     self.assertRaises(IndexError, lambda x: iv[x], self.fieldcount+1)
开发者ID:ffrancis,项目名称:pybedtools,代码行数:12,代码来源:test_cbedtools.py

示例8: testGetItemSlice

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
    def testGetItemSlice(self):
        "getitem now supports direct access to the line."
        ivf = IntervalFile(self.file)
        iv = ivf.next()
        seqid, = iv[self.chrpos:self.chrpos+1]
        start, end = iv[self.startpos:self.stoppos+1]
        self.assert_(start.isdigit())

        self.assertEqual(int(end), iv.end)
        self.assertEqual(seqid, iv.chrom)
开发者ID:ffrancis,项目名称:pybedtools,代码行数:12,代码来源:test_cbedtools.py

示例9: testSetAttrs

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testSetAttrs(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     if iv.file_type != 'gff':
         self.assertRaises(ValueError, iv.attrs.__setitem__, 'a','b')
         return
     iv.attrs['ID'] = 'fake'
     iv.attrs['field0'] = 'asdf'
     self.assertEqual(str(iv.attrs), iv[8])
     self.assert_('field0=asdf' in iv[8])
     self.assert_('ID=fake' in iv[8])
开发者ID:Fabrices,项目名称:pybedtools,代码行数:13,代码来源:test_cbedtools.py

示例10: testSetItemString

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testSetItemString(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     iv['chrom'] = 'fake'
     self.assertEqual(iv['chrom'], 'fake')
     self.assertEqual(iv.chrom, 'fake')
开发者ID:ffrancis,项目名称:pybedtools,代码行数:8,代码来源:test_cbedtools.py

示例11: testGetItemString

# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import next [as 别名]
 def testGetItemString(self):
     ivf = IntervalFile(self.file)
     iv = ivf.next()
     self.assertEqual(iv['chrom'], iv.chrom)
     self.assertEqual(iv['start'], iv.start)
     self.assertEqual(iv['end'], iv.end)
开发者ID:ffrancis,项目名称:pybedtools,代码行数:8,代码来源:test_cbedtools.py


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