augur.export module

Export JSON files suitable for visualization with auspice.

augur.export.add_metadata_to_tree(node, metadata)
augur.export.add_tsv_metadata_to_nodes(nodes, meta_tsv, meta_json, extra_fields=['authors', 'url', 'accession'])

Only used for nextflu schema compatability

Add the relevent fields from meta_tsv to the nodes (both are dictionaries keyed off of strain names) * the relevent fields are found by scanning the meta json together with the extra_fields param

augur.export.collect_strain_info(node_data, tsv_path)

Integrate TSV metadata to the per-node metadata structure

augur.export.construct_author_info_and_make_keys(node_metadata, raw_strain_info)

For each node, gather the relevant author information (returned) and create a unique key inside node_metadata

augur.export.construct_author_info_nexflu(metadata, tree, nodes)

author info maps the “authors” property present on tree nodes to further information about the paper etc

augur.export.convert_tree_to_json_structure(node, metadata, div=0, nextflu_schema=False, strains=None)

converts the Biopython tree structure to a dictionary that can be written to file as a json. This is called recursively. Creates the strain property & divergence on each node

input

node – node for which top level dict is produced. div – cumulative divergence (root = 0) nextflu_schema – use nexflu schema (e.g. node[“attr”]). This is deprecated.

returns

tree in JSON structure list of strains

augur.export.get_root_sequence(root_node, ref=None, translations=None)

create a json structure that contains the sequence of the root, both as nucleotide and as translations. This allows look-up of the sequence for all states, including those that are not variable.

Parameters
  • root_node (dict) – data associated with the node

  • ref (str, optional) – filename of the root sequence

  • translations (str, optional) – file name of translations

Returns

dict of nucleotide sequence and translations

Return type

dict

augur.export.get_traits(node_data)
augur.export.process_annotations(node_data)
augur.export.process_colorings(jsn, color_mapping, nodes=None, node_metadata=None, nextflu=False)
augur.export.process_geographic_info(jsn, lat_long_mapping, nextflu=False, node_metadata=None, nodes=None)
augur.export.process_panels(user_panels, meta_json, nextflu=False)
augur.export.recursively_decorate_tree_json_nextflu_schema(node, node_metadata, decorations)

This function is deprecated and is used to produce the nextflu-compatable JSON format

For given decorations, add information from node_metadata to each node in the tree. * decorations must have property “key” which is the key used to insert into the node and the default key used to access node_metadata * if decorations has property “lookup_key”, this is used to access node meta_data instead * if decorations has property “is_attr” (and it’s value is True) then the result is inserted into node[“attr”]

returns Null

augur.export.register_arguments(parser)
augur.export.run(args)
augur.export.transfer_metadata_to_strains(strains, raw_strain_info, traits)
augur.export.tree_layout(T)

calculate tree layout. This function is deprecated, and only used for the nextflu JSON format