ggtree
ggtree copied to clipboard
reverse branch in my ggtree
I have a MSA file and wanted to create tree from it. I created the distance matrix first then created a ggtree for that. Now it works. My issue is I have a reverse branch in my tree. Something similar to https://groups.google.com/forum/#!topic/bioc-ggtree/41wU6trCIPA . I tried to solve it based on that but couldn't. I have a negative branch length. Here is my code:
MSA.alnFasta <- readDNAMultipleAlignment(InputFile)
> class(MSA.alnFasta)
[1] "DNAMultipleAlignment"
attr(,"package")
[1] "Biostrings"
> names(MSA.alnFasta)
NULL
> MSA.alnFasta.Dis <- msaConvert(MSA.alnFasta, type="seqinr::alignment")
> d <- dist.alignment(MSA.alnFasta.Dis, "identity")
I want to add clade information from another data frame called Ann so matched the first column with SampleTree$tip.label using :
> dput(Ann)
structure(list(genbank_accession = c("MT019531.1 ", "MN996531.1 ",
"MT019530.1 ", "LR757998.1 ", "MN996529.1 ", "MN996527.1 ", "MT106053.1 ",
"MT049951.1 ", "MN997409.1 ", "MT106054.1 ", "MN994467.1 ", "MT044257.1 ",
"MT106052.1 ", "LR757995.1 ", "MT066175.1 ", "MN985325.1 ", "MT163717.1 ",
"MT093631.2 ", "MT007544.1 ", "MT121215.1 ", "MT093571.1 ", "MT019532.1 ",
"MN996530.1 ", "MN988668.1 ", "LR757996.1 ", "MN908947.3 ", "MT072688.1 ",
"MT039887.1 ", "MT027064.1 ", "MN996528.1 ", "MN988669.1 ", "MT044258.1 ",
"MN988713.1 ", "MT066176.1 ", "MT118835.1 ", "MT020781.2 ", "MN994468.1 ",
"MT039888.1 ", "MT027062.1 ", "MT027063.1 ", "MT126808.1 "), Clade = c("", "", "", "", "", "", "",
"B", "B2", "B2", "B", "B", "B4", "B", "B", "B1", "B1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "A7", "", "", "", "", "", "A1a")), class = "data.frame", row.names = c("1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "25", "26", "27", "28",
"29", "30", "31", "32", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46"))
> SampleTree <- nj(d)
> SampleTree<- rename_taxa(SampleTree, Strain.Ann, genbank_accession, genbank_accession )
> tree.plot<- ggtree::ggtree(SampleTree)
> tree.plot<- tree.plot %<+% Ann + geom_tiplab(aes(color=Clade)) +
+ geom_tippoint(aes(color=Clade), alpha=0.5) +
+ ggtitle(Phylogenetic Tree of sample") +
+ theme(legend.position="right")
I got the tree with one reverse branch like below:

Thank you very much in advance for your help.
A proper minimal example would help people to better help you fix your problem. For example, it would help to dput(), MSA.alnFasta and SampleTree.