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


Python MSA.validate方法代碼示例

本文整理匯總了Python中paleomix.common.formats.msa.MSA.validate方法的典型用法代碼示例。如果您正苦於以下問題:Python MSA.validate方法的具體用法?Python MSA.validate怎麽用?Python MSA.validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在paleomix.common.formats.msa.MSA的用法示例。


在下文中一共展示了MSA.validate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _read_sequences

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import validate [as 別名]
def _read_sequences(filenames):
    results = {}
    for filename in filenames:
        results[filename] = MSA.from_file(filename)
    MSA.validate(*results.values())

    return results.iteritems()
開發者ID:muslih14,項目名稱:paleomix,代碼行數:9,代碼來源:formats.py

示例2: interleaved_phy

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import validate [as 別名]
def interleaved_phy(msa, add_flag = False, max_name_length = _MAX_NAME_LENGTH):
    MSA.validate(msa)
    header = "%i %i" % (len(msa), msa.seqlen())
    if add_flag:
        header += " I"
    result = [header, ""]

    padded_len  = min(max_name_length, max(len(name) for name in msa.names())) + 2
    padded_len -= padded_len % -(_BLOCK_SIZE + _BLOCK_SPACING) + _BLOCK_SPACING

    streams = []
    spacing = " " * _BLOCK_SPACING
    for record in sorted(msa):
        name    = record.name[:max_name_length]
        padding = (padded_len - len(name)) * " "

        lines = []
        line  = [name, padding]
        for block in grouper(_BLOCK_SIZE, record.sequence, fillvalue = ""):
            block = "".join(block)
            if sum(len(segment) for segment in line) >= _LINE_SIZE:
                lines.append("".join(line))
                line = [block]
            else:
                line.extend((spacing, block))

        lines.append("".join(line))
        streams.append(lines)

    for rows in zip(*streams):
        result.extend(row for row in rows)
        result.append("")
    result.pop()

    return "\n".join(result)
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:37,代碼來源:phylip.py

示例3: _run

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import validate [as 別名]
    def _run(self, _config, temp):
        # Read and check that MSAs share groups
        msas = [MSA.from_file(filename) for filename in sorted(self.input_files)]
        MSA.validate(*msas)

        blocks = []
        for msa in msas:
            blocks.append(sequential_phy(msa, add_flag = self._add_flag))

        with open(reroot_path(temp, self._out_phy), "w") as output:
            output.write("\n\n".join(blocks))
開發者ID:muslih14,項目名稱:paleomix,代碼行數:13,代碼來源:formats.py

示例4: sequential_phy

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import validate [as 別名]
def sequential_phy(msa, add_flag = False, max_name_length = _MAX_NAME_LENGTH):
    MSA.validate(msa)
    header = "%i %i" % (len(msa), msa.seqlen())
    if add_flag:
        header += " S"

    spacing = " " * _BLOCK_SPACING
    result = [header, ""]
    for record in sorted(msa):
        result.append(record.name[:max_name_length])

        blocks = grouper(_BLOCK_SIZE, record.sequence, fillvalue = "")
        lines  = grouper(_NUM_BLOCKS, blocks)
        for line in lines:
            result.append(spacing.join("".join(block) for block in line if block))

    return "\n".join(result)
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:19,代碼來源:phylip.py


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