diff --git a/R/greedyMix.R b/R/greedyMix.R index fa3a37f..4be9387 100644 --- a/R/greedyMix.R +++ b/R/greedyMix.R @@ -1,6 +1,6 @@ #' @title Clustering of individuals #' @param data data file -#' @param format Format of the data c("FASTA", "VCF" ,"BAM", or "GenePop") +#' @param format Data format. Format supported: "FASTA", "VCF" ,"BAM", "GenePop" #' @param verbose if \code{TRUE}, prints extra output information #' @importFrom utils read.delim #' @importFrom vcfR read.vcfR @@ -9,7 +9,16 @@ #' with high-throughput sequencing data. #' @export greedyMix <- function(data, format, verbose = TRUE) { + # Parsing data format ------------------------------------------------------ + + if (missing(format)) { + format <- gsub(".*\\.(.+)$", "\\1", data) + message("Format not provided. Guessing from file extension: ", format) + } format <- tolower(format) + + # Dispatching to proper loading function ----------------------------------- + if (format == "fasta") { out <- load_fasta(data) } else if (format == "vcf") { diff --git a/man/greedyMix.Rd b/man/greedyMix.Rd index b4d6bce..eb5eabf 100644 --- a/man/greedyMix.Rd +++ b/man/greedyMix.Rd @@ -9,7 +9,7 @@ greedyMix(data, format, verbose = TRUE) \arguments{ \item{data}{data file} -\item{format}{Format of the data c("FASTA", "VCF" ,"BAM", or "GenePop")} +\item{format}{Data format. Format supported: "FASTA", "VCF" ,"BAM", "GenePop"} \item{verbose}{if \code{TRUE}, prints extra output information} }