Description Usage Arguments Value Author(s) See Also Examples
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).
1 2 | ## S3 method for class 'PhyloSim'
readAlignment(this, file, format="fasta", ...)
|
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. |
The PhyloSim object (invisible).
Botond Sipos, Gregory Jordan
For more information see PhyloSim
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.