I am using ggtree
to draw a phylogenetic tree.
Some taxa IDs have a 0 at the beginning.
However, when I plot the tiplabel the leading zero is automatically dropped. How do I retain the leading zero?
Thanks.
The code and tree file and metadata file are attached. I would appreciate any help.
setwd('G:\\Experiments\\Paper\\Torula\\06_iqtree')
dir()
# Load required packages
library(xlsx)
library(ggtree)
library(treeio)
library(ggplot2)
# Read tree
tre <- read.iqtree("concatenate_iqtree2.treefile")
tre_tbl <- fortify(tre)
# Read associated information table
metadf <- read.xlsx('G:\\Experiments\\Paper\\Torula\\00_data\\Torula_taxa.xlsx', sheetIndex = 1)
# Plot tree
ggtree(tre) %<+% metadf +
# our own taxa darkblue
# type strain bold
geom_tiplab(aes(subset = (New == 1 & Type == 1),
label = paste0('bolditalic(', Genus, ')~bolditalic(', Epithet, ')~bold(', Collection,')~bold(', Number,')')),
color = 'darkblue', parse = T) +
geom_tiplab(aes(subset = (New == 0 & Type == 1),
label = paste0('bolditalic(', Genus, ')~bolditalic(', Epithet, ')~bold(', Collection,')~bold(', Number,')')),
color = 'black', parse = T) +
geom_tiplab(aes(subset = (New == 0 & Type == 0),
label = paste0('italic(', Genus, ')~italic(', Epithet, ')', '~', Collection,'~', Number)),
color = 'black', parse = T) +
geom_text(aes(label= UFboot), vjust = 0, hjust = 1, size = 3) +
xlim(NA,0.5)