本文整理匯總了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))
示例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])
示例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')
示例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')
示例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())
示例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())
示例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)
示例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)
示例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])
示例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')
示例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)