def constrained_kingman(*args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treesim.constrained_kingman()' function has moved to 'dendropy.simulate.treesim.constrained_kingman_tree()'.", old_construct="from dendropy import treesim\ntree = treesim.constrained_kingman(...)", new_construct="from dendropy.simulate import treesim\ntree = treesim.constrained_kingman_tree(...)", ) return treesim.constrained_kingman_tree(*args, **kwargs)
def find_missing_splits(reference_tree, test_tree): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.find_missing_splits()' function has moved to 'dendropy.calculate.treecompare.find_missing_splits()'.", old_construct="from dendropy import treecalc\nd = treecalc.find_missing_splits(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.find_missing_splits(...)", ) return treecompare.find_missing_splits(reference_tree=reference_tree, comparison_tree=test_tree)
def pop_gen_tree(*args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treesim.pop_gen_tree()' function has moved to 'dendropy.simulate.popgensim.pop_gen_tree()'.", old_construct="from dendropy import treesim\ntree = treesim.pop_gen_tree(...)", new_construct="from dendropy.simulate import popgensim\ntree = popgensim.pop_gen_tree(...)", ) return popgensim.pop_gen_tree(*args, **kwargs)
def _deprecate_tree_manip(old, new): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: Tree structure manipulation and editing functionality are now native methods of the 'dendropy.Tree' class.", old_construct=old, new_construct=new, stacklevel=4)
def generate_hky_dataset(seq_len, tree_model, mutation_rate=1.0, kappa=1.0, base_freqs=[0.25, 0.25, 0.25, 0.25], root_states=None, dataset=None, rng=None): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.seqsim.generate_hky_dataset()' function has been replaced with 'dendropy.simulate.charsim.hky85_chars()'.", old_construct= "from dendropy import seqsim\ndataset = seqsim.generate_hky_dataset(...)", new_construct= "import dendropy\nfrom dendropy.simulate import charsim\ndataset = dendropy.DataSet()\nchar_matrix = charsim.hky85_chars(...)\ndataset.add_char_matrix(char_matrix)" ) if dataset is None: dataset = dendropy.DataSet() char_matrix = dataset.new_char_matrix( char_matrix_type="dna", taxon_namespace=tree_model.taxon_namespace) charsim.hky85_chars(seq_len=seq_len, tree_model=tree_model, mutation_rate=mutation_rate, kappa=kappa, base_freqs=base_freqs, root_states=root_states, char_matrix=char_matrix, rng=rng) return dataset
def is_compatible(split1, split2, mask): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.is_compatible()'.", old_construct= "from dendropy import treesplit\nd = treesplit.is_compatible(...)", new_construct="""\ # if using a bipartition d = bipartition.is_compatible_with(other_bipartition) # if a "raw" bitmask d = dendropy.Bipartition.is_compatible_bitmasks(m1, m2, fill_bitmask=mask)""") """ Mask should have 1 for every leaf in the leaf_set """ # m1 = mask & split1 # m2 = mask & split2 # if 0 == (m1 & m2): # return True # c2 = mask ^ split2 # if 0 == (m1 & c2): # return True # c1 = mask ^ split1 # if 0 == (c1 & m2): # return True # if 0 == (c1 & c2): # return True # return False return dendropy.Bipartition.is_compatible_bitmasks(split1, split2, fill_bitmask=mask)
def generate_hky_dataset(seq_len, tree_model, mutation_rate=1.0, kappa=1.0, base_freqs=[0.25, 0.25, 0.25, 0.25], root_states=None, dataset=None, rng=None): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.seqsim.generate_hky_dataset()' function has been replaced with 'dendropy.simulate.charsim.hky85_chars()'.", old_construct="from dendropy import seqsim\ndataset = seqsim.generate_hky_dataset(...)", new_construct="import dendropy\nfrom dendropy.simulate import charsim\ndataset = dendropy.DataSet()\nchar_matrix = charsim.hky85_chars(...)\ndataset.add_char_matrix(char_matrix)") if dataset is None: dataset = dendropy.DataSet() char_matrix = dataset.new_char_matrix(char_matrix_type="dna", taxon_namespace=tree_model.taxon_namespace) charsim.hky85_chars( seq_len=seq_len, tree_model=tree_model, mutation_rate=mutation_rate, kappa=kappa, base_freqs=base_freqs, root_states=root_states, char_matrix=char_matrix, rng=rng) return dataset
def average_number_of_pairwise_differences(char_matrix, ignore_uncertain=True): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct="from dendropy import popgenstat\npopgenstat.average_number_of_pairwise_differences(...)", new_construct="from dendropy.calculate import popgenstat\npopgenstat.average_number_of_pairwise_differences(...)", ) return popgenstat.average_number_of_pairwise_differences(char_matrix=char_matrix, ignore_uncertain=ignore_uncertain)
def reconciliation_discordance(gene_tree, species_tree): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct="from dendropy import reconcile\nreconcile.reconciliation_discordance(...)", new_construct="from dendropy.model import reconcile\nreconcile.reconciliation_discordance(...)", ) return reconcile.reconciliation_discordance(gene_tree, species_tree)
def num_segregating_sites(char_matrix, ignore_uncertain=True): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct="from dendropy import popgenstat\npopgenstat.num_segregating_sites(...)", new_construct="from dendropy.calculate import popgenstat\npopgenstat.num_segregating_sites(...)", ) return popgenstat.num_segregating_sites(char_matrix, ignore_uncertain)
def symmetric_difference(tree1, tree2): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.symmetric_difference()' function has moved to 'dendropy.calculate.treecompare.symmetric_difference()'.", old_construct="from dendropy import treecalc\nd = treecalc.symmetric_difference(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.symmetric_difference(...)", ) return treecompare.symmetric_difference(tree1=tree1, tree2=tree2)
def uniform_pure_birth(*args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treesim.uniform_pure_birth()' function has moved to 'dendropy.simulate.treesim.uniform_pure_birth_tree()'.", old_construct="from dendropy import treesim\ntree = treesim.uniform_pure_birth(...)", new_construct="from dendropy.simulate import treesim\ntree = treesim.uniform_pure_birth_tree(...)", ) return treesim.uniform_pure_birth_tree(*args, **kwargs)
def node_waiting_time_pairs(tree, ultrametricity_precision=constants.DEFAULT_ULTRAMETRICITY_PRECISION): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.coalescent' module has moved to 'dendropy.model.coalescent'.", old_construct="from dendropy import coalescent\ncoalescent.node_waiting_time_pairs(...)", new_construct="from dendropy.model import coalescent\ncoalescent.node_waiting_time_pairs(...)") return coalescent.node_waiting_time_pairs(tree=tree, ultrametricity_precision=ultrametricity_precision)
def simulate_continuous(node, rng=None, **kwargs): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.continuous' module has moved to 'dendropy.model.continuous', and this function has been renamed 'evolve_continuous_char()'.", old_construct="from dendropy import continuous\ncontinuous.simulate_continuous(...)", new_construct="from dendropy.model import continuous\ncontinuous.evolve_continuous_char(...)", epilog="Note that this function is also available through 'dendropy.simulate.charsim.evolve_continuous_char(...)'.") return continuous.evolve_continuous_char(node, rng, **kwargs)
def is_compatible(split1, split2, mask): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: 'dendropy.treesplit.is_compatible()'.", old_construct="from dendropy import treesplit\nd = treesplit.is_compatible(...)", new_construct="""\ # if using a bipartition d = bipartition.is_compatible_with(other_bipartition) # if a "raw" bitmask d = dendropy.Bipartition.is_compatible_bitmasks(m1, m2, fill_bitmask=mask)""") """ Mask should have 1 for every leaf in the leaf_set """ # m1 = mask & split1 # m2 = mask & split2 # if 0 == (m1 & m2): # return True # c2 = mask ^ split2 # if 0 == (m1 & c2): # return True # c1 = mask ^ split1 # if 0 == (c1 & m2): # return True # if 0 == (c1 & c2): # return True # return False return dendropy.Bipartition.is_compatible_bitmasks(split1, split2, fill_bitmask=mask)
def __init__(self, *args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct="from dendropy import reconcile\nreconcile.ContainingTree(...)", new_construct="from dendropy.model import reconcile\nreconcile.ContainingTree(...)", ) reconcile.ContainingTree.__init__(self, *args, **kwargs)
def monophyletic_partition_discordance(tree, taxon_namespace_partition): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct="from dendropy import reconcile\nreconcile.monophyletic_partition_discordance(...)", new_construct="from dendropy.model import reconcile\nreconcile.monophyletic_partition_discordance(...)", ) return reconcile.monophyletic_partition_discordance(tree, taxon_namespace_partition)
def wattersons_theta(char_matrix, ignore_uncertain=True): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct="from dendropy import popgenstat\npopgenstat.watterson_theta(...)", new_construct="from dendropy.calculate import popgenstat\npopgenstat.watterson_theta(...)", ) return popgenstat.wattersons_theta(char_matrix=char_matrix, ignore_uncertain=ignore_uncertain)
def __init__(self, *args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgensim' module has moved to 'dendropy.simulate.popgensim'.", old_construct="from dendropy import popgensim\npopgensim.FragmentedPopulations(...)", new_construct="from dendropy.simulate import popgensim\npopgensim.FragmentedPopulations(...)", ) popgensim.FragmentedPopulations.__init__(self, *args, **kwargs)
def unify_taxa(self, taxon_set=None, bind=None): deprecate.dendropy_deprecation_warning( message= "Deprecated since DendroPy 4: '{class_name}.unify_taxa()' will no longer be supported in future releases; use '{class_name}.unify_taxon_namespaces()' instead" .format(class_name=self.__class__.__name__)) self.unify_taxon_namespaces(taxon_namespace=taxon_set, attach_taxon_namespace=bind)
def robinson_foulds_distance(tree1, tree2, edge_length_attr="length"): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.robinson_foulds_distance()' function has moved to 'dendropy.calculate.treecompare.weighted_robinson_foulds_distance()'.", old_construct="from dendropy import treecalc\nd = treecalc.robinson_foulds_distance(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.weighted_robinson_foulds_distance(...)", ) return treecompare.weighted_robinson_foulds_distance(tree1=tree1, tree2=tree2, edge_weight_attr=edge_length_attr)
def patristic_distance(tree, taxon1, taxon2): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.patristic_distance()' function has moved to 'dendropy.calculate.treemeasure.patristic_distance()'.", old_construct="from dendropy import treecalc\npdm = treecalc.patristic_distance(...)", new_construct="from dendropy.calculate import treemeasure\npdm = treemeasure.patristic_distance(...)", ) return treemeasure.patristic_distance(tree=tree, taxon1=taxon1, taxon2=taxon2)
def __init__(self, tree=None): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.PhylogeneticDistanceMatrix' class has moved to 'dendropy.PhylogeneticDistanceMatrix'.", old_construct="from dendropy import treecalc\npdm = treecalc.PhylogeneticDistanceMatrix(...)", new_construct="import dendropy\npdm = dendropy.PhylogeneticDistanceMatrix(...)", ) dendropy.PhylogeneticDistanceMatrix.__init__(self, tree=tree)
def __init__(self, *args, **kwargs): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct="from dendropy import popgenstat\npopgenstat.PopulationPairSummaryStatistics(...)", new_construct="from dendropy.calculate import popgenstat\npopgenstat.PopulationPairSummaryStatistics(...)", ) popgenstat.PopulationPairSummaryStatistics.__init__(self, *args, **kwargs)
def delete_outdegree_one(tree): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.delete_outdegree_one()'.", old_construct= "from dendropy import treesplit\nd = treesplit.delete_outdegree_one(tree)", new_construct="tree.suppress_unifurcations()") return tree.suppress_unifurcations()
def attach_taxon_set(self, taxon_set=None): """ DEPRECATED: Use `attach_taxon_namespace()` instead. """ deprecate.dendropy_deprecation_warning( message="Deprecated since DendroPy 4: 'attach_taxon_set' will no longer be supported in future releases; use 'attach_taxon_namespace' instead", stacklevel=3) return self.attach_taxon_namespace(taxon_namespace=taxon_set)
def new_taxon_set(self, *args, **kwargs): """ DEPRECATED: Use `new_taxon_namespace()` instead. """ deprecate.dendropy_deprecation_warning( message="Deprecated since DendroPy 4: 'new_taxon_set' will no longer be supported in future releases; use 'new_taxon_namespace' instead", stacklevel=3) return self.new_taxon_namespace(*args, **kwargs)
def detach_taxon_set(self): """ DEPRECATED: Use `detach_taxon_namespace()` instead. """ deprecate.dendropy_deprecation_warning( message="Deprecated since DendroPy 4: 'detach_taxon_set' will no longer be supported in future releases; use 'detach_taxon_namespace' instead", stacklevel=3) self.detach_taxon_namespace()
def star_tree(*args, **kwargs): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.treesim.star()' function has moved to 'dendropy.simulate.treesim.star_tree()'.", old_construct="from dendropy import treesim\ntree = treesim.star(...)", new_construct= "from dendropy.simulate import treesim\ntree = treesim.star_tree(...)") return treesim.star_tree(*args, **kwargs)
def find_missing_splits(reference_tree, test_tree): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.find_missing_splits()' function has moved to 'dendropy.calculate.treecompare.find_missing_splits()'.", old_construct="from dendropy import treecalc\nd = treecalc.find_missing_splits(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.find_missing_splits(...)") return treecompare.find_missing_splits( reference_tree=reference_tree, comparison_tree=test_tree)
def symmetric_difference(tree1, tree2): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.symmetric_difference()' function has moved to 'dendropy.calculate.treecompare.symmetric_difference()'.", old_construct="from dendropy import treecalc\nd = treecalc.symmetric_difference(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.symmetric_difference(...)") return treecompare.symmetric_difference( tree1=tree1, tree2=tree2)
def derived_state_matrix(char_matrix, ancestral_seq=None): deprecate.dendropy_deprecation_warning( preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct="from dendropy import popgenstat\npopgenstat.derived_state_matrix(...)", new_construct="from dendropy.calculate import popgenstat\npopgenstat.derived_state_matrix(...)", ) return popgenstat.derived_state_matrix( char_matrix=char_matrix, ancestral_sequence=ancestral_seq)
def __init__(self, tree=None): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.treecalc.PhylogeneticDistanceMatrix' class has moved to 'dendropy.PhylogeneticDistanceMatrix'.", old_construct= "from dendropy import treecalc\npdm = treecalc.PhylogeneticDistanceMatrix(...)", new_construct= "import dendropy\npdm = dendropy.PhylogeneticDistanceMatrix(...)") dendropy.PhylogeneticDistanceMatrix.__init__(self, tree=tree)
def __init__(self, **kwargs): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4:", old_construct="d = dendropy.CharacterMatrix.get_from_path(schema='proteinfasta', ...)\nd = dendropy.DataSet.get_from_path(schema='proteinfasta', ...)", new_construct="d = dendropy.ProteinCharacterMatrix.get(path=..., schema='fasta', ...)\nd = dendropy.DataSet.get(path=..., schema='fasta', data_type='protein', ...)", stacklevel=7) # raise TypeError("'proteinfasta' is no longer a supported schema: use 'schema=\"fasta\"' with the 'ProteinCharacterMatrix.get()' method instead or 'schema=\"fasta\"' and 'data_type=\"dna\" with the 'DataSet.get()' or 'DataSet.read()' methods") kwargs["data_type"] = "protein" FastaReader.__init__(self, **kwargs)
def __init__(self, state_alphabet=None, rng=None): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.seqmodel.Jc69SeqModel' class has moved to 'dendropy.model.discrete.Jc69'.", old_construct="from dendropy import seqmodel\nm = seqmodel.NucleotideSeqModel(...)", new_construct="from dendropy.model import discrete\ndiscrete.Jc69(...)") discrete.Jc69.__init__( self, state_alphabet=state_alphabet, rng=rng)
def patristic_distance(tree, taxon1, taxon2): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.patristic_distance()' function has moved to 'dendropy.calculate.treemeasure.patristic_distance()'.", old_construct="from dendropy import treecalc\npdm = treecalc.patristic_distance(...)", new_construct="from dendropy.calculate import treemeasure\npdm = treemeasure.patristic_distance(...)") return treemeasure.patristic_distance( tree=tree, taxon1=taxon1, taxon2=taxon2)
def __init__(self, state_alphabet=None, rng=None): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.seqmodel.Jc69SeqModel' class has moved to 'dendropy.model.discrete.Jc69'.", old_construct= "from dendropy import seqmodel\nm = seqmodel.NucleotideSeqModel(...)", new_construct= "from dendropy.model import discrete\ndiscrete.Jc69(...)") discrete.Jc69.__init__(self, state_alphabet=state_alphabet, rng=rng)
def euclidean_distance(tree1, tree2, edge_length_attr="length", value_type=float): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.euclidean_distance()' function has moved to 'dendropy.calculate.treecompare.euclidean_distance()'.", old_construct="from dendropy import treecalc\nd = treecalc.euclidean_distance(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.euclidean_distance(...)", ) return treecompare.euclidean_distance( tree1=tree1, tree2=tree2, edge_weight_attr=edge_length_attr, value_type=value_type )
def __init__(self, state_alphabet, rng=None): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.seqmodel.SeqModel' class has moved to 'dendropy.model.discrete.DiscreteCharacterEvolutionModel'.", old_construct="from dendropy import seqmodel\nm = seqmodel.SeqModel(...)", new_construct="from dendropy.model import discrete\nm = discrete.DiscreteCharacterEvolutionModel(...)") discrete.DiscreteCharacterEvolutionModel.__init__( self, state_alphabet=state_alphabet, rng=rng)
def tree_from_splits(splits, taxon_set, is_rooted=False): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: 'dendropy.treesplit.tree_from_splits()'.", old_construct="from dendropy import treesplit\ntree = treesplit.tree_from_splits(...)", new_construct="import dendropy\ntree = dendropy.Tree.from_split_bitmasks(...)") return dendropy.Tree.from_split_bitmasks( split_bitmasks=splits, taxon_namespace=taxon_set, is_rooted=is_rooted)
def count_bits(a): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.count_bits()'.", old_construct= "from dendropy import treesplit\nd = treesplit.count_bits(...)", new_construct= "from dendropy.utility import bitprocessing\nd = bitprocessing.num_set_bits(...)" ) return bitprocessing.num_set_bits(a)
def lowest_bit_only(s): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.lowest_bit_only()'.", old_construct= "from dendropy import treesplit\nd = treesplit.lowest_bit_only(...)", new_construct= "from dendropy.utility import bitprocessing\nd = bitprocessing.least_significant_set_bit(...)" ) return bitprocessing.least_significant_set_bit(s)
def num_segregating_sites(char_matrix, ignore_uncertain=True): deprecate.dendropy_deprecation_warning( preamble= "The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.", old_construct= "from dendropy import popgenstat\npopgenstat.num_segregating_sites(...)", new_construct= "from dendropy.calculate import popgenstat\npopgenstat.num_segregating_sites(...)", ) return popgenstat.num_segregating_sites(char_matrix, ignore_uncertain)
def __init__(self, **kwargs): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.treesum.TopologyCounter' class has moved to 'dendropy.calculate.treesum.TopologyCounter'.", old_construct= "from dendropy import treesum\nm = treesum.TopologyCounter(...)", new_construct= "from dendropy.calculate import treesum\nm = treesum.TopologyCounter(...)" ) treesum.TopologyCounter.__init__(self, **kwargs)
def is_trivial_split(split, mask): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.is_trivial_split()'.", old_construct= "from dendropy import treesplit\nd = treesplit.is_trivial_split(...)", new_construct= "import dendropy\nd = dendropy.Bipartition.is_trivial_bitmask(...)") return dendropy.Bipartition.is_trivial_bitmask(bitmask=split, fill_bitmask=mask)
def find_edge_from_split(root, split_to_find, mask=-1): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: 'dendropy.treesplit.find_edge_from_split()'", old_construct="from dendropy import treesplit\nd = treesplit.find_edge_from_split(...)", new_construct="""\ # if using a bipartition d = bipartition.edge # if a "raw" bitmask d = tree.find_edge_for_split_bitmask(...)""") return root.find_edge_for_split_bitmask(split_to_find, fill_bitmask=mask)
def reconciliation_discordance(gene_tree, species_tree): deprecate.dendropy_deprecation_warning( preamble= "The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct= "from dendropy import reconcile\nreconcile.reconciliation_discordance(...)", new_construct= "from dendropy.model import reconcile\nreconcile.reconciliation_discordance(...)", ) return reconcile.reconciliation_discordance(gene_tree, species_tree)
def __init__(self, *args, **kwargs): deprecate.dendropy_deprecation_warning( preamble= "The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct= "from dendropy import reconcile\nreconcile.ContainingTree(...)", new_construct= "from dendropy.model import reconcile\nreconcile.ContainingTree(...)", ) reconcile.ContainingTree.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): deprecate.dendropy_deprecation_warning( preamble= "The 'dendropy.popgensim' module has moved to 'dendropy.simulate.popgensim'.", old_construct= "from dendropy import popgensim\npopgensim.FragmentedPopulations(...)", new_construct= "from dendropy.simulate import popgensim\npopgensim.FragmentedPopulations(...)", ) popgensim.FragmentedPopulations.__init__(self, *args, **kwargs)
def robinson_foulds_distance(tree1, tree2, edge_length_attr="length"): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4: The 'dendropy.treecalc.robinson_foulds_distance()' function has moved to 'dendropy.calculate.treecompare.weighted_robinson_foulds_distance()'.", old_construct="from dendropy import treecalc\nd = treecalc.robinson_foulds_distance(...)", new_construct="from dendropy.calculate import treecompare\nd = treecompare.weighted_robinson_foulds_distance(...)") return treecompare.weighted_robinson_foulds_distance( tree1=tree1, tree2=tree2, edge_weight_attr=edge_length_attr)
def __init__(self, **kwargs): deprecate.dendropy_deprecation_warning( preamble="Deprecated since DendroPy 4:", old_construct= "d = dendropy.CharacterMatrix.get_from_path(schema='proteinfasta', ...)\nd = dendropy.DataSet.get_from_path(schema='proteinfasta', ...)", new_construct= "d = dendropy.ProteinCharacterMatrix.get(path=..., schema='fasta', ...)\nd = dendropy.DataSet.get(path=..., schema='fasta', data_type='protein', ...)", stacklevel=7) # raise TypeError("'proteinfasta' is no longer a supported schema: use 'schema=\"fasta\"' with the 'ProteinCharacterMatrix.get()' method instead or 'schema=\"fasta\"' and 'data_type=\"dna\" with the 'DataSet.get()' or 'DataSet.read()' methods") kwargs["data_type"] = "protein" FastaReader.__init__(self, **kwargs)
def __init__(self, state_alphabet, rng=None): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: The 'dendropy.seqmodel.SeqModel' class has moved to 'dendropy.model.discrete.DiscreteCharacterEvolutionModel'.", old_construct= "from dendropy import seqmodel\nm = seqmodel.SeqModel(...)", new_construct= "from dendropy.model import discrete\nm = discrete.DiscreteCharacterEvolutionModel(...)" ) discrete.DiscreteCharacterEvolutionModel.__init__( self, state_alphabet=state_alphabet, rng=rng)
def monophyletic_partition_discordance(tree, taxon_namespace_partition): deprecate.dendropy_deprecation_warning( preamble= "The 'dendropy.reconcile' module has moved to 'dendropy.model.reconcile'.", old_construct= "from dendropy import reconcile\nreconcile.monophyletic_partition_discordance(...)", new_construct= "from dendropy.model import reconcile\nreconcile.monophyletic_partition_discordance(...)", ) return reconcile.monophyletic_partition_discordance( tree, taxon_namespace_partition)
def encode_splits(tree, create_dict=True, suppress_unifurcations=True): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.encode_splits()'.", old_construct= "from dendropy import treesplit\nd = treesplit.encode_splits(tree, ...)", new_construct= "bipartitions = tree.encode_bipartitions(...)\nsplit_bitmasks = tree.split_bitmask_edge_map.keys()" ) return tree.encode_bipartitions( suppress_unifurcations=suppress_unifurcations)
def tree_from_splits(splits, taxon_set, is_rooted=False): deprecate.dendropy_deprecation_warning( preamble= "Deprecated since DendroPy 4: 'dendropy.treesplit.tree_from_splits()'.", old_construct= "from dendropy import treesplit\ntree = treesplit.tree_from_splits(...)", new_construct= "import dendropy\ntree = dendropy.Tree.from_split_bitmasks(...)") return dendropy.Tree.from_split_bitmasks(split_bitmasks=splits, taxon_namespace=taxon_set, is_rooted=is_rooted)