-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecated fasta2nexus and raised version number to 1.0.9000 as this …
…is a breaking change in tbea 0.5.2 and older versions.
- Loading branch information
1 parent
9810c89
commit add5edb
Showing
6 changed files
with
24 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: tbea | ||
Title: Tools for Pre- and Post-processing in Bayesian Evolutionary Analyses | ||
Version: 0.5.2 | ||
Version: 1.0.9000 | ||
Authors@R: c(person("Gustavo A.", "Ballen", email = "[email protected]", role = c("aut", "cre")), | ||
person("Sandra", "Reinales", email = "[email protected]", role = c("aut"))) | ||
Description: Package for bayesian inference in phylogenetics and evolution. | ||
|
@@ -10,11 +10,9 @@ Description: Package for bayesian inference in phylogenetics and evolution. | |
platforms in evolutionary biology such as BEAST2. The package implements | ||
a way to measure similarity between probability density functions | ||
in the context of comparisons between prior and posterior bayesian | ||
densities. It also provides functions for concatenating molecular and | ||
morphological data for standard tree estimation (e.g., MrBayes) or total | ||
evidence FBD divergence time estimation (e.g., Beast or RevBayes). | ||
densities. | ||
Depends: R (>= 3.5.0) | ||
Imports: ape, apex, Rfit, Hmisc, boot | ||
Imports: ape, Rfit, Hmisc, boot | ||
License: file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,16 @@ | ||
#' fasta2nexus: Function for converting molecular alignments from fasta to nexus format | ||
#' fasta2nexus (deprecated): Function for converting molecular alignments from fasta to nexus format | ||
#' | ||
#' @param path A vector of type 'character' with the path to the fasta alignments. | ||
#' | ||
#' @param outpath A vector of type 'character' with the path to the nexus matrices. Defaults to NULL, so that the output files are written into the same directory declared in \code{path} | ||
#' | ||
#' @param pattern A vector of type 'character' with the string (also supports regular expressions) to be used as keyword for selecting the fasta files. The most basic case is to use ".fasta$" for a file ending with the extension ".fasta". | ||
#' | ||
#' @param wholeAlign Whether to fuse the fasta alignments into a concatenated molecular-only, continuous nexus matrix. Defaults to TRUE. | ||
#' @param ... A placeholder for any argument that used to be in this function. | ||
#' | ||
#' @return This function writes to the disk several files, at least one nexus originally from a fasta file, and potentially a concatenated file if several fasta are provided. | ||
#' @return This function returns an error because it has been deprecated. | ||
#' | ||
#' @author Gustavo A. Ballen | ||
#' | ||
#' @details This function will convert from fasta to nexus, and optionally concatenate a single nexus with the content of all fasta files. | ||
#' @details This function was deprecated from tbea v1.0.0 onwards. For using this function please install tbea v0.5.0. | ||
#' | ||
#' @examples | ||
#' # Convert all fasta alignments into nexus matrices in a given path, | ||
#' # with the output files in the same directory, for files | ||
#' # ending with the pattern 'trimmed.nex'. | ||
#' \dontrun{ | ||
#' fasta2nexus(path = "sequences", outpath = NULL, pattern = "trimmed.fasta$", wholeAlign = TRUE) | ||
#' } | ||
#' @export | ||
|
||
fasta2nexus <- function(path, outpath = NULL, pattern, wholeAlign = TRUE) { | ||
fastaFiles <- dir(path = path, pattern = pattern) | ||
if (!is.null(outpath)){ | ||
dir.create(outpath) | ||
} else { | ||
outpath <- path | ||
} | ||
# read all fastaFiles datasets | ||
markers <- apex::read.multiFASTA(paste(path, fastaFiles, sep = "/")) | ||
markers | ||
if (wholeAlign) { | ||
wholeAlignNexus <- apex::concatenate(markers) | ||
ape::write.nexus.data(x = wholeAlignNexus, file = paste(outpath, "wholeAlign.nex", sep = "/"), interleaved = FALSE) | ||
} | ||
for (i in seq_along(markers@dna)) { | ||
cat("Writing nexus dataset ", names(markers@dna[i]), "\n", sep = "") | ||
ape::write.nexus.data(x = markers@dna[[i]], | ||
file = paste(outpath, "/", names(markers@dna[i]), ".nex", sep = ""), | ||
interleaved = FALSE) | ||
} | ||
fasta2nexus <- function(...) { | ||
stop("The function fasta2nexus was deprecated from tbea v1.0.0 onwards. For using this function please install tbea v0.5.0\n") | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
test_that("fasta2nexus fails with a deprecation message", { | ||
expect_error(fasta2nexus(), | ||
regexp = "fasta2nexus was deprecated", | ||
ignore.case = TRUE) | ||
}) |