Skip to content

Commit

Permalink
updating root tip length
Browse files Browse the repository at this point in the history
  • Loading branch information
DOH-JDJ0303 committed Apr 26, 2024
1 parent 247faa0 commit 60f50a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bin/cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,22 @@ clusters <- cutree(as.hclust(tree), h = as.numeric(threshold)) %>%

# adjust height to percentage for more intuitive interpretation
tree$edge.length <- 100*tree$edge.length
# get max edge length
max_edge <- max(tree$edge.length)

# get initial plot to determine the max tip length from root
p <- ggtree(tree)
x_max <- p$data %>%
filter(isTip) %>%
arrange(x) %>%
slice(1) %>%
.$x

# plot tree
p <- ggtree(tree)%<+%clusters+
geom_tippoint(aes(color = as.character(cluster)))+
geom_vline(xintercept = max_edge-100*as.numeric(threshold)/2, linetype = "dashed", color = "#E35335")+
geom_vline(xintercept = x_max-(100*as.numeric(threshold)/2), linetype = "dashed", color = "#E35335")+
theme_tree2()+
labs(color = "Cluster", x = "Estimated Nucleotide Difference (%)")+
xlim(0,max_edge*1.1)
xlim(0,x_max*1.1)

#---- CHECK FOR DISCREPANCIES ----#
join1 <- clusters %>%
Expand Down

0 comments on commit 60f50a3

Please sign in to comment.