本文整理汇总了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,))
示例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()
示例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)
示例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))
示例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
示例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)