pyani.pyani_classify module¶
Module providing functions to generate clusters/species hypotheses.
-
class
pyani.pyani_classify.
Cliquesinfo
[source]¶ Bases:
tuple
Summary of clique structure.
-
all_k_complete
¶ Alias for field number 2
-
n_nodes
¶ Alias for field number 0
-
n_subgraphs
¶ Alias for field number 1
-
-
pyani.pyani_classify.
all_components_k_complete
(graph: networkx.classes.graph.Graph) → bool[source]¶ Return True if all components in passed graph are k-complete.
Parameters: graph – NetworkX Graph object
-
pyani.pyani_classify.
analyse_cliques
(graph: networkx.classes.graph.Graph) → pyani.pyani_classify.Cliquesinfo[source]¶ Return Cliquesinfo NamedTuple describing clique data for a graph.
Parameters: graph – NetworkX Graph object
-
pyani.pyani_classify.
build_graph_from_results
(results, label_dict: Dict[int, str], cov_min: float = 0, id_min: float = 0) → networkx.classes.graph.Graph[source]¶ Return undirected graph representing the passed ANIResults object.
The passed ANIResults object is converted to an undirected graph where nodes on the graph represent genomes, and edges represent pairwise comparisons having the minimum coverage and identity indicated.
Parameters: - results –
- Run object from pyani_orm
- label_dict – dictionary of genome labels for result matrices the dict is keyed by the index/column values for the results matrices
- cov_min –
- minimum coverage for an edge
- id_min –
- minimum identity for an edge
- results –
-
pyani.pyani_classify.
k_complete_component_status
(graph: networkx.classes.graph.Graph) → List[bool][source]¶ Return list of Booleans of whether connected components of the graph are k-complete.
Parameters: graph – NetworkX Graph object For each component in the passed graph, a list of Booleans is calculated, representing whether each node has property P: the degree of the node is equal to the number of nodes in that component, minus 1.
The all() gives a Boolean indicating whether all nodes in that component have property P.
-
pyani.pyani_classify.
remove_low_weight_edges
(graph: networkx.classes.graph.Graph, threshold: float, attribute: str = 'identity') → Tuple[networkx.classes.graph.Graph, List[T]][source]¶ Return graph and edgelist where edges having weight < threshold are removed.
Parameters: - graph – NetworkX Graph
- threshold – float, minimum edge weight
- attribute – String, attribute to use as weight