omicverse.micro.attach_tree

Contents

omicverse.micro.attach_tree#

omicverse.micro.attach_tree(adata, newick=None, tree_path=None, prune=True, store_key='tree', strict=False)[source]#

Attach a phylogenetic tree to adata.uns[store_key].

Parameters:
  • adata (AnnData) – The AnnData to annotate (var_names = ASV / OTU ids).

  • newick (Optional[str] (default: None)) – The tree as a newick string. Mutually exclusive with tree_path.

  • tree_path (Union[str, Path, None] (default: None)) – Path to a newick file. Mutually exclusive with newick.

  • prune (bool (default: True)) – When True (default), the tree is restricted to tips that appear in adata.var_names. Tips absent from var_names are dropped.

  • store_key (str (default: 'tree')) – Key under adata.uns where the newick string is written.

  • strict (bool (default: False)) – If True, raise when any ASV in var_names has no matching tree tip. Default False only warns.

Return type:

AnnData