Learn R Programming

phylotools (version 0.1.2)

supermat: Build super matrix using PHYLIP files

Description

This function could be used to build the super dataframe described by Kress et al.(2009). The out put dataframe could be converted to Phylip format file for phylogenetic analysis.

Usage

supermat(rbcl = NULL, matk = NULL, trn = NULL)

Arguments

rbcl
A character string indicting the name of rbcl phylip file.
matk
A character string indicting the name of matK phylip file.
trn
A vector of character strings indicting the names of trnH-psbA phylip files.

Value

The super data frame to be converted to supermatrix.

Details

The phylip files should be first put into a directory. Users are encouraged to copy the phylip files which generated by software Clustal to a directory, and then set it as the working directory. The function will search the input phylip file names from the working directory and build the "super" dataframe. The dataframe then could be converted to phylip format by dat2phy and be written to the working directory by writeLines so that to generate a super matrix.

References

Kress W., Erickson D., Jones F., Swenson N., Perez R., Sanjur O., Bermingham E., Plant DNA barcodes and community phylogeny of a tropical forest dynamics plot in Panama. Proceedings of the National Academy of Sciences of the United States of America. 2009 18621-18626

See Also

See Also dat2phy, writeLines

Examples

Run this code

dir <- system.file("extdata", package = "phylotools")
setwd(dir)
## Supermatrix with "rbcla","matk","trnH-psbA"
supermat1 <- supermat(rbcl = "rbcla.phy", matk = "matK.phy", 
           trn = c("trn1.phy", "trn2.phy","trn3.phy","trn4.phy"))	   
write.mat(supermat1, "result1.phy")


## Supermatrix with"matk","trnH-psbA"
supermat2 <- supermat(matk = "matK.phy", 
           trn = c("trn1.phy", "trn2.phy","trn3.phy","trn4.phy"))	      
write.mat(supermat2, "result2.phy")


## Supermatrix with "rbcla","matk"
supermat3 <- supermat(matk = "matK.phy", rbcl = "rbcla.phy")	   
write.mat(supermat3, "result3.phy")


## Supermatrix with "rbcla","trnH-psbA"
supermat4 <- supermat(rbcl = "rbcla.phy", 
           trn = c("trn1.phy", "trn2.phy","trn3.phy","trn4.phy"))	   
write.mat(supermat4, "result4.phy")

## Delete the results
unlink(c("result1.phy", "result2.phy", "result3.phy", "result4.phy"))

Run the code above in your browser using DataLab