Learn R Programming

phylosim (version 3.0.5)

readTree.PhyloSim: Read tree from file

Description

Read tree from file.

This method reads a tree by using the read.tree function from the ape package and stores in the PhyloSim object. If an alignment is already attached to the PhyloSim object, it must contain all sequences corresponding to tip nodes.

Usage

# S3 method for PhyloSim
readTree(this, file, ...)

Arguments

this

A PhyloSim object.

file

A file name specified by either a variable of mode character, or a double-quoted string.

...

Not used.

Value

The PhyloSim object (invisible).

See Also

For more information see PhyloSim.

Examples

Run this code
# NOT RUN {
	# get a safe file name
	fname<-paste("PhyloSim_dummy_fas_",Sys.getpid(),sep="")
	# write out a fasta alignment
	cat("(a,(b,c));",file=fname);
	# construct a PhyloSim object:
	sim<-PhyloSim()
	# read the alignment
	readTree(sim,fname)
	# remove alignment file
	unlink(fname)
	# plot the tree
	plot(sim)
 
# }

Run the code above in your browser using DataLab