diff --git a/R/tree.R b/R/tree.R index 8eb641d9..5cdc20d1 100755 --- a/R/tree.R +++ b/R/tree.R @@ -37,14 +37,23 @@ ## !! FastTree will only work if there are unique sequence names!! #' convertFA2Tree #' -#' @param fa_path -#' @param tre_path -#' @param fasttree_path +#' @param fa_path Path to the input FASTA alignment file (.fa). Default is the +#' path to "data/alns/pspa_snf7.fa". +#' @param tre_path Path to the output file where the generated tree (.tre) will +#' be saved. Default is the path to "data/alns/pspa_snf7.tre". +#' @param fasttree_path Path to the FastTree executable, which is used to +#' generate the phylogenetic tree. Default is "src/FastTree". #' -#' @return +#' @return No return value. The function generates a tree file (.tre) from the +#' input FASTA file. #' @export #' #' @examples +#' \dontrun{ +#' convert_fa2tre(here("data/alns/pspa_snf7.fa"), +#' here("data/alns/pspa_snf7.tre"), +#' here("src/FastTree") +#' } convertFA2Tree <- function(fa_path = here("data/alns/pspa_snf7.fa"), tre_path = here("data/alns/pspa_snf7.tre"), fasttree_path = here("src/FastTree")) { @@ -72,16 +81,22 @@ convertFA2Tree <- function(fa_path = here("data/alns/pspa_snf7.fa"), #' @description #' Generate Trees for ALL fasta files in "data/alns" #' -#' @param aln_path +#' @param aln_path Path to the directory containing all the alignment FASTA +#' files (.fa) for which trees will be generated. Default is "data/alns/". +#' #' #' @importFrom here here #' @importFrom purrr pmap #' @importFrom stringr str_replace_all #' -#' @return +#' @return No return value. The function generates tree files (.tre) for each +#' alignment file in the specified directory. #' @export #' #' @examples +#' \dontrun{ +#' generate_trees(here("data/alns/")) +#' } convertAlignment2Trees <- function(aln_path = here("data/alns/")) { # finding all fasta alignment files fa_filenames <- list.files(path = aln_path, pattern = "*.fa") @@ -111,16 +126,19 @@ convertAlignment2Trees <- function(aln_path = here("data/alns/")) { #' @description #' Generating phylogenetic tree from alignment file '.fa' #' -#' @param fa_file Character. Path to file. -#' Default is 'pspa_snf7.fa' -#' @param out_file +#' @param fa_file Character. Path to the alignment FASTA file (.fa) from which +#' the phylogenetic tree will be generated. Default is 'pspa_snf7.fa'. +#' @param out_file Path to the output file where the generated tree (.tre) will +#' be saved. Default is "data/alns/pspa_snf7.tre". #' #' @importFrom ape write.tree #' @importFrom phangorn bootstrap.pml dist.ml NJ modelTest phyDat plotBS pml pml.control pratchet optim.parsimony optim.pml read.phyDat upgma #' @importFrom seqinr dist.alignment read.alignment #' @importFrom stats logLik #' -#' @return +#' @return No return value. The function generates a phylogenetic tree file +#' (.tre) based on different approaches like Neighbor Joining, UPGMA, and +#' Maximum Likelihood. #' @export #' #' @details The alignment file would need two columns: 1. accession + diff --git a/man/convertAlignment2Trees.Rd b/man/convertAlignment2Trees.Rd index 002f5203..e0c8fe34 100644 --- a/man/convertAlignment2Trees.Rd +++ b/man/convertAlignment2Trees.Rd @@ -7,8 +7,18 @@ convertAlignment2Trees(aln_path = here("data/alns/")) } \arguments{ -\item{aln_path}{} +\item{aln_path}{Path to the directory containing all the alignment FASTA +files (.fa) for which trees will be generated. Default is "data/alns/".} +} +\value{ +No return value. The function generates tree files (.tre) for each +alignment file in the specified directory. } \description{ Generate Trees for ALL fasta files in "data/alns" } +\examples{ +\dontrun{ +generate_trees(here("data/alns/")) +} +} diff --git a/man/convertFA2Tree.Rd b/man/convertFA2Tree.Rd index b2fb93de..f97cd3d7 100644 --- a/man/convertFA2Tree.Rd +++ b/man/convertFA2Tree.Rd @@ -11,8 +11,26 @@ convertFA2Tree( ) } \arguments{ -\item{fasttree_path}{} +\item{fa_path}{Path to the input FASTA alignment file (.fa). Default is the +path to "data/alns/pspa_snf7.fa".} + +\item{tre_path}{Path to the output file where the generated tree (.tre) will +be saved. Default is the path to "data/alns/pspa_snf7.tre".} + +\item{fasttree_path}{Path to the FastTree executable, which is used to +generate the phylogenetic tree. Default is "src/FastTree".} +} +\value{ +No return value. The function generates a tree file (.tre) from the +input FASTA file. } \description{ convertFA2Tree } +\examples{ +\dontrun{ +convert_fa2tre(here("data/alns/pspa_snf7.fa"), + here("data/alns/pspa_snf7.tre"), + here("src/FastTree") +} +} diff --git a/man/createFA2Tree.Rd b/man/createFA2Tree.Rd index 76da7807..90054280 100644 --- a/man/createFA2Tree.Rd +++ b/man/createFA2Tree.Rd @@ -10,10 +10,16 @@ createFA2Tree( ) } \arguments{ -\item{fa_file}{Character. Path to file. -Default is 'pspa_snf7.fa'} +\item{fa_file}{Character. Path to the alignment FASTA file (.fa) from which +the phylogenetic tree will be generated. Default is 'pspa_snf7.fa'.} -\item{out_file}{} +\item{out_file}{Path to the output file where the generated tree (.tre) will +be saved. Default is "data/alns/pspa_snf7.tre".} +} +\value{ +No return value. The function generates a phylogenetic tree file +(.tre) based on different approaches like Neighbor Joining, UPGMA, and +Maximum Likelihood. } \description{ Generating phylogenetic tree from alignment file '.fa'