#' Check Coverage
#'
#' Check the percentage of genotyped loci with coverage. \cr
#' Returns list of samples under specified percentage.
#'
#' @param DB RSQLite database generated by `make_database`
#' @param females Sample IDs of the female to compare to a male. The Sample ID
#' must match the ones found in the `DB`.
#' @param males Sample IDs of the males to compare to a female. The Sample ID
#' must match the ones found in the `DB`.
#' @param GT percent of genotypes you want to
#' @return dataframe or message
#' @export
#' @examples
#' \dontrun{
#' check_coverage(DBs, females, males, 40)
#' }
#' @export
#' @import dplyr
#' @import tibble
#' @import tidyr
#' @import tidyverse
check_coverage <- function(DB, females, males, GT=40){
df <- RSQLite::dbReadTable(DB, "original_df")
low.cov <- df %>%
dplyr::select(Sample, X.GT) %>%
dplyr::filter(Sample %in% females | Sample %in% males) %>%
dplyr::filter(X.GT < GT)
if(nrow(low.cov) > 0){
return(low.cov)
} else if (nrow(low.cov) == 0){
message(paste0("No samples with GT < ", GT, "% with coverage."))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.