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


Python MSA.from_file方法代碼示例

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


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

示例1: _teardown

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [as 別名]
 def _teardown(self, config, temp):
     # Validate output from MAFFT
     output_file = reroot_path(temp, self._output_file)
     try:
         MSA.from_file(output_file)
     except MSAError, error:
         raise NodeError("Invalid MSA produced by MAFFT:\n%s" % (error,))
開發者ID:muslih14,項目名稱:paleomix,代碼行數:9,代碼來源:mafft.py

示例2: _read_sequences

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [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

示例3: _run

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [as 別名]
    def _run(self, _config, temp):
        alignment = MSA.from_file(self._input_file)
        for (to_filter, groups) in self._filter_by.iteritems():
            alignment = alignment.filter_singletons(to_filter, groups)

        temp_filename = fileutils.reroot_path(temp, self._output_file)
        with open(temp_filename, "w") as handle:
            alignment.to_file(handle)
        fileutils.move_file(temp_filename, self._output_file)
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:11,代碼來源:sequences.py

示例4: _run

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [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

示例5: _is_sufficently_covered

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [as 別名]
def _is_sufficently_covered(filepath, min_coverage):
    msa = MSA.from_file(filepath)
    if msa.seqlen() % 3:
        return False

    total_bases_not_covered = 0
    for fasta_record in msa:
        total_bases_not_covered += fasta_record.sequence.upper().count("N")
        total_bases_not_covered += fasta_record.sequence.count("-")

    total_bases = float(len(msa) * msa.seqlen())
    frac_covered = 1.0 - total_bases_not_covered / total_bases
    return frac_covered >= min_coverage
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:15,代碼來源:select_highly_covered_genes.py

示例6: test_msa_from_file__compressed_bz2

# 需要導入模塊: from paleomix.common.formats.msa import MSA [as 別名]
# 或者: from paleomix.common.formats.msa.MSA import from_file [as 別名]
def test_msa_from_file__compressed_bz2():
    expected = MSA([FASTA("This_is_BZ_FASTA!", None, "CGTNA"),
                    FASTA("This_is_ALSO_BZ_FASTA!", None,  "ACGTN")])
    results = MSA.from_file(test_file("fasta_file.fasta.bz2"))
    assert_equal(results, expected)
開發者ID:MikkelSchubert,項目名稱:paleomix,代碼行數:7,代碼來源:msa_test.py


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