本文整理汇总了Python中edge.models.Fragment._append_to_fragment方法的典型用法代码示例。如果您正苦于以下问题:Python Fragment._append_to_fragment方法的具体用法?Python Fragment._append_to_fragment怎么用?Python Fragment._append_to_fragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edge.models.Fragment
的用法示例。
在下文中一共展示了Fragment._append_to_fragment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_fragment
# 需要导入模块: from edge.models import Fragment [as 别名]
# 或者: from edge.models.Fragment import _append_to_fragment [as 别名]
def build_fragment(self):
# pre-chunk the fragment sequence at feature start and end locations.
# there should be no need to further divide any chunk during import.
break_points = list(set(
[f[0] for f in self.__features] +
[f[1] + 1 for f in self.__features]))
break_points = sorted(break_points)
chunk_sizes = []
for i, bp in enumerate(break_points):
if i == 0:
if bp > 1:
chunk_sizes.append(break_points[i] - 1)
else:
chunk_sizes.append(break_points[i] - break_points[i - 1])
print '%d chunks' % (len(chunk_sizes),)
new_fragment = Fragment(name=self.__rec.id, circular=False, parent=None, start_chunk=None)
new_fragment.save()
new_fragment = new_fragment.indexed_fragment()
prev = None
flen = 0
seqlen = len(self.__sequence)
for sz in chunk_sizes:
prev = new_fragment._append_to_fragment(prev, flen, self.__sequence[flen:flen + sz])
flen += sz
if flen < seqlen:
f = new_fragment._append_to_fragment(prev, flen, self.__sequence[flen:seqlen])
return new_fragment