當前位置: 首頁>>代碼示例>>Python>>正文


Python Fragment._append_to_fragment方法代碼示例

本文整理匯總了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
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:32,代碼來源:importer.py


注:本文中的edge.models.Fragment._append_to_fragment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。