plotAnnotatedTree: Plotting HomoplasyFinder results

Description Usage Arguments Examples

View source: R/homoplasyFinder.R

Description

This function plots an annotated phylogeny with the inconsistent sites identified by HomoplasyFinder. Alignment colours: A=red, C=blue, G=cyan, and T=orange. NOTE: Works best with addTextLabels() package installed.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plotAnnotatedTree(
  tree,
  inconsistentPositions,
  fastaFile,
  addScale = FALSE,
  alignmentCex = 2,
  addNodeLabels = TRUE,
  nodeLabelCex = 1,
  alignmentPositionCex = 0.5,
  addSeparatorLines = TRUE,
  actualPositions = NULL
)

Arguments

tree

An object of class "phylo" produced by readAnnotatedTree()

inconsistentPositions

An integer array of the inconsistent positions identified by HomoplasyFinder. Produced by runHomoplasyFinderInJava()

fastaFile

The full path to the FASTA formatted nucleotide sequence alignment

addScale

A boolean value to determine whether a scale is added to plot. Defaults to FALSE

alignmentCex

A multiplier value to change the size of the space alotted to plotting the homoplasy alignment. Defaults to 2

addNodeLabels

A multiplier value to change the size node labels. Defaults to 1

nodeLabelCex

A multiplier value to change the size of the internal node labels added to phylogeny. Defaults to 1

alignmentPositionCex

A multiplier value to change the size of the position labels added above alignment. Defaults to 0.5

addSeparatorLines

A boolean variable to determine whether white separator lines are plotted on alignment. Defaults to true

actualPositions

An integer array of length=length(inconsistentPositions) that reports the actual positions on the genome of inconsistent positions. Useful when homoplasyFinder was run on concatenated sites. Defaults to NULL meaning it is ignored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Find the FASTA and tree files attached to package
fastaFile <- system.file("extdata", "example.fasta", package = "homoplasyFinder")
treeFile <- system.file("extdata", "example.tree", package = "homoplasyFinder")

# Get the current working directory
workingDirectory <- paste0(getwd(), "/")

# Run the HomoplasyFinder java code
inconsistentPositions <- runHomoplasyFinderInJava(treeFile, fastaFile, workingDirectory)

# Get the current date
date <- format(Sys.Date(), "%d-%m-%y")
 
# Read in the output table
resultsFile <- paste0(workingDirectory, "consistencyIndexReport_", date, ".txt")
results <- read.table(resultsFile, header=TRUE, sep="\t", stringsAsFactors=FALSE)

# Read in the annotated tree
tree <- readAnnotatedTree(workingDirectory)

# Plot the annotated tree
plotAnnotatedTree(tree, inconsistentPositions, fastaFile)

JosephCrispell/homoplasyFinder documentation built on June 7, 2021, 11 a.m.