From 112e0a73d9f748dfbd0fefeb1444692b7177ab32 Mon Sep 17 00:00:00 2001 From: John Huddleston Date: Tue, 21 Jul 2026 13:02:27 -0700 Subject: [PATCH] Add example for edge list distances Adds pairwise nucleotide distance calculation to the workflow with edge list output in TSV format that can be loaded into MicrobeTrace (along with optional metadata.tsv) to visualize a network of samples. --- Snakefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Snakefile b/Snakefile index 83475d1..e79e5c5 100644 --- a/Snakefile +++ b/Snakefile @@ -1,6 +1,7 @@ rule all: input: auspice_json = "auspice/zika.json", + pairwise_nucleotide_distances = "results/distances_pairwise_nucleotides.tsv", input_fasta = "data/sequences.fasta", input_metadata = "data/metadata.tsv", @@ -202,6 +203,36 @@ rule nucleotide_distances: --output {output.node_data} """ +rule pairwise_nucleotide_distances: + input: + tree = "results/tree.nwk", + alignments = [ + "results/aligned.fasta", + ], + distance_maps = [ + "config/distance_map_nucleotides.json", + ], + output: + node_data = "results/distances_pairwise_nucleotides.json", + edge_list = "results/distances_pairwise_nucleotides.tsv", + conda: "envs/nextstrain.yaml" + params: + gene_names = "nuc", + attribute_name = "snvs", + compare_to = "pairwise", + shell: + """ + augur distance \ + --tree {input.tree} \ + --alignment {input.alignments} \ + --map {input.distance_maps} \ + --gene-names {params.gene_names} \ + --attribute-name {params.attribute_name} \ + --compare-to {params.compare_to} \ + --output {output.node_data} \ + --output-edge-list {output.edge_list} + """ + rule amino_acid_distances: input: tree = "results/tree.nwk",