splitp.parsers package

Submodules

splitp.parsers.fasta module

splitp.parsers.fasta.fasta_to_dict(path_to_file)
splitp.parsers.fasta.get_pattern_counts(alignment)
splitp.parsers.fasta.pattern_counts_to_probs(patterns, seqLen)
splitp.parsers.fasta.pattern_probs_from_alignment(path_to_file, return_sequence_length=False)
splitp.parsers.fasta.read_alignment_from_file(path_to_file)

splitp.parsers.newick module

splitp.parsers.newick.json_to_newick(json_dict, namestring='id', lengthstring='branch_length', childrenstring='children')

Converts a JSON tree to a newick string

Arguments:

json_dict: The JSON tree to convert to newick.

splitp.parsers.newick.move_tree_edge_labels_to_nodes(tree, remove_edge_attributes=True)

Every node is given all of the attributes of it’s in-edge

Arguments:

tree: The tree to move edge labels to nodes in. remove_edge_attributes: Whether or not to remove the edge attributes after moving them to the nodes.

splitp.parsers.newick.newick_to_json(newick_string, namestring='id', lengthstring='branch_length', childrenstring='children', generate_names=False)

Parses a newick string (example “((A,B),C)”) into JSON format accepted by NetworkX

Arguments:
newick_string: The newick string to convert to JSON. Names, branch lengths and named

internal nodes accepted. If no names are given, an ID is generated for the name if generate_names=True.

namestring: The label for node name to use in the JSON (default “id”). lengthstring: The label for branch length to use in the JSON (default “branch_length”). childrenstring: The label for children arrays to use in the JSON (default “children”). generate_names: Whether or not to generate names if none are given

splitp.parsers.newick.strip_newick(newick)

Module contents