Added SAM/BAM support (closes #18)

This commit is contained in:
Waldir Leoncio 2021-09-03 12:50:11 +02:00
parent 15f2cbcf08
commit 0cfd13b006
4 changed files with 27 additions and 6 deletions

View file

@ -1,9 +1,11 @@
#' @title Clustering of individuals
#' @param data data file
#' @param format Format of the data c("FASTA", "VCF" ,"SAM", or "GenePop")
#' @param format Format of the data c("FASTA", "VCF" ,"BAM", or "GenePop")
#' @param verbose if \code{TRUE}, prints extra output information
#' @importFrom utils read.delim
#' @importFrom vcfR read.vcfR
#' @references Samtools: a suite of programs for interacting
#' with high-throughput sequencing data. <http://www.htslib.org/>
#' @export
greedyMix <- function(data, format, verbose = TRUE) {
format <- tolower(format)
@ -12,8 +14,14 @@ greedyMix <- function(data, format, verbose = TRUE) {
} else if (format == "vcf") {
out <- vcfR::read.vcfR(data, verbose = verbose)
} else if (format == "sam") {
stop("SAM files not yet supported." )
# TODO #18: implement load_sam()
stop(
"SAM files not directly supported. ",
"Install the samtools software and execute ",
"'samtools view -b in_file.sam > out_file.bam' to convert to BAM ",
"and try running this function again with 'format=BAM'"
)
} else if (format == "bam") {
out <- Rsamtools::scanBam(data)
} else if (format == "genepop") {
# TODO #19: implement load_genepop()
stop("GenePop files not yet supported." )