knitr::opts_chunk$set(echo = TRUE)

RERconverge includes tree-building functions that perform maximum likelihood branch length estimation given a fixed tree topology and alignments for each sequence of interest. These functions are built directly on phangorn functions pml and optim.pml, including arguments for parameters passed directly to those functions. For more details on those functions, refer to phangorn documentation.

Input file specification

Tree building functions require two inputs: a master tree topology and alignments from which to estimate branch lengths.

An example master tree file is included at extdata/mastertree.tree Example alignment files are included at extdata/ExampleAlignments/

library(RERconverge)
rerpath = find.package('RERconverge')
mastertreefn=paste(rerpath,"/extdata/mastertree.tree",sep="")
alignmentfn=paste(rerpath,"/extdata/ExampleAlignments/",sep="")
outputfn=paste(rerpath,"/extdata/ExampleTrees.trees",sep="")

Run phangorn tree building

The function estimatePhangornTreeAll estimates branch lengths for all sequences included in the specified alignment directory. This process is relatively slow - for example, it takes a couple minutes per gene to estimate branch lengths for most genes. The user must specify, at minimum, the alignment director, a master tree file, and a desired output file. Default function behaviors assume alignments are amino acid sequences in fasta format, and other arguments should be specified for other file and sequence types.

The code below takes a few mintues to run

estimatePhangornTreeAll(alndir=alignmentfn, treefile=mastertreefn, output.file=outputfn)

Note that default argument specification is appropriate for amino acid alignments in fasta format and uses the LG substitution model. This may also be specified by including arguments format="fasta", type="AA", and submodel="LG".

For DNA sequences, the general time reversible model (GTR) is a popular substitution model. When using estimatePhangornTreeAll, specify this model with the arguments type="DNA" and submodel="GTR".



nclark-lab/RERconverge documentation built on March 2, 2024, 8:51 a.m.