R/uniqueCombinations.R

Defines functions .uniqueCombinations

# unique location/chromosome combinations
#' @importFrom mgcv uniquecombs
.uniqueCombinations <- function(df, verbose) {

  if (!all(c("loc", "chr") %in% colnames(df))) stop("incorrect data provided")

  uniqueLoc <- mgcv::uniquecombs(x = df[,c('loc', 'chr')])
  uniqueLoc <- uniqueLoc[order(uniqueLoc$chr, uniqueLoc$loc),]
  r <- nrow(x = uniqueLoc)

  if (verbose) {
    cat("\tidentified", r, "unique chromosome/location combinations\n")
  }

  return( uniqueLoc )
}

Try the CONCUR package in your browser

Any scripts or data that you put into this service are public.

CONCUR documentation built on June 7, 2022, 5:07 p.m.