@@ -25,16 +25,16 @@ metadata <- read_csv(snakemake@input$metadata)
2525
2626# Extract names from records
2727log_debug(" Reading FASTA" )
28- study_names <- read.dna(
28+ study_records <- read.dna(
2929 snakemake @ input $ study_fasta ,
3030 format = " fasta" ,
3131 as.matrix = FALSE ,
3232)
3333log_debug(" Extracting names" )
34- study_names <- study_names [
35- ! startsWith(names(study_names ), snakemake @ params $ ref_name )
34+ study_records <- study_records [
35+ ! startsWith(names(study_records ), snakemake @ params $ outgroup_id )
3636]
37- study_names <- names(study_names )
37+ study_names <- names(study_records )
3838
3939# Obtain sample names ordered by CollectionDate
4040log_debug(" Sorting names by collection date" )
@@ -59,19 +59,21 @@ tree_tiplab <- data.frame(
5959 ) %> %
6060 ungroup() %> %
6161 add_row(
62- ID = snakemake @ params $ ref_name ,
62+ ID = snakemake @ params $ outgroup_id ,
6363 order = 0 ,
64- tip_label = snakemake @ params $ ref_name
64+ tip_label = snakemake @ params $ outgroup_id
6565 )
6666
6767# Read distance tree and root
6868log_info(" Reading tree" )
6969tree <- read.tree(snakemake @ input $ tree ) %> %
70- root(snakemake @ params $ ref_name , resolve.root = TRUE )
70+ root(snakemake @ params $ outgroup_id , resolve.root = TRUE )
7171
7272# Plot
7373log_info(" Plotting distance tree" )
74- max.tip.length <- max(node.depth.edgelength(tree )[1 : length(tree $ tip.label )])
74+ max.tip.length <- max(
75+ node.depth.edgelength(tree )[seq_along(length(tree $ tip.label ))]
76+ )
7577p <- ggtree(tree ) %< + % tree_tiplab +
7678 geom_tiplab(aes(label = tip_label )) +
7779 geom_treescale(1.1 * max.tip.length ) +
0 commit comments