def write_as_mesquite(self, out, **kwargs): """ For debugging purposes, write out a Mesquite-format file. """ from dendropy.dataio import nexuswriter nw = nexuswriter.NexusWriter(**kwargs) nw.is_write_block_titles = True out.write("#NEXUS\n\n") nw._write_taxa_block(out, self.taxon_namespace) out.write('\n') nw._write_taxa_block(out, self.contained_trees.taxon_namespace) if self.contained_trees.taxon_namespace.label: domain_title = self.contained_trees.taxon_namespace.label else: domain_title = self.contained_trees.taxon_namespace.oid contained_taxon_namespace = self.contained_trees.taxon_namespace contained_label = self.contained_trees.label out.write('\n') self._contained_to_containing_taxon_map.write_mesquite_association_block( out) out.write('\n') nw._write_trees_block( out, dendropy.TreeList([self], taxon_namespace=self.taxon_namespace)) out.write('\n') nw._write_trees_block( out, dendropy.TreeList(self.contained_trees, taxon_namespace=contained_taxon_namespace, label=contained_label)) out.write('\n')
def __init__(self, suppress_standard_preamble=False, ignore_error_returncode=False, strip_extraneous_prompts_from_stderr=True, strip_extraneous_prompts_from_stdout=True, cwd=None, env=None, paup_path=PAUP_PATH): self.suppress_standard_preamble = suppress_standard_preamble self.ignore_error_returncode = ignore_error_returncode self.strip_extraneous_prompts_from_stderr = strip_extraneous_prompts_from_stderr self.strip_extraneous_prompts_from_stdout = strip_extraneous_prompts_from_stdout self.cwd = cwd self.env = env self.paup_path = paup_path self._nexus_writer = nexuswriter.NexusWriter() self.commands = []