readAlignment.PhyloSim: Read alignment from file

Description Usage Arguments Value Author(s) See Also Examples

Description

Read alignment from file.

This method reads an alignment by using the read.dna function from the ape package and stores in the PhyloSim object. If a tree is already attached to the PhyloSim object, the alignment must at least contain the sequences corresponding to tip nodes (but it may also contain additional ancestral sequences).

Usage

1
2
## S3 method for class 'PhyloSim'
readAlignment(this, file, format="fasta", ...)

Arguments

this

A PhyloSim object.

file

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

format

a character string specifying the format of the DNA sequences. Four choices are possible: "interleaved", "sequential", "clustal", or "fasta", or any unambiguous abbreviation of these.

...

Not used.

Value

The PhyloSim object (invisible).

Author(s)

Botond Sipos, Gregory Jordan

See Also

For more information see PhyloSim.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
	# get a safe file name
	fname<-paste("PhyloSim_dummy_fas_",Sys.getpid(),sep="")
	# write out a fasta alignment
	cat("> t3\nGTCTTT-CG-\n",file=fname);
	cat("> t4\nG--TC-TCGG\n",file=fname,append=TRUE);
	cat("> t2\nG--TC-TCGG\n",file=fname,append=TRUE);
	cat("> t1\nGTC-G-TCGG",file=fname,append=TRUE);
	# construct a PhyloSim object,
	# set the phylo object
	sim<-PhyloSim(phylo=rcoal(4))
	# read the alignment
	readAlignment(sim,fname)
	# remove alignment file
	unlink(fname)
	# plot the tree & alignment
	plot(sim)
 

phylosim documentation built on Nov. 22, 2019, 1:07 a.m.