Minimal working example for phylogenetic tree construction in R using an alignment of DNA strings and a vector of names?
A key difference from many examples provided is that they assume that the data provided is in the form of sequences rather than an already aligned sequence alignment.
library(&quot;Biostrings&quot;)
library(&quot;seqinr&quot;)
library(&quot;ape&quot;)
library(phylogram)
library(&quot;dendextend&quot;)


#read in the data from a format with the aligned sequences (eg msf)
msf.res &lt;- read.alignment(file = &quot;geneticAlignment.msf&quot;, format = &quot;msf&quot;)
#dist.alignment and not dna.dist commonly used in tutorials
msf.res.dist.alignment = dist.alignment(msf.res, matrix = &quot;identity&quot;)
#perform neighbor joining upon the distance set
msf.res.dist.alignment.nj = nj(msf.res.dist.alignment)
#then plot the joined sequences
plot(msf.res.dist.alignment.nj, main = &quot;Neighbor Joining&quot;)