R/read_exstra_db_txt_guesser.R

Defines functions read_exstra_db_txt_guesser

# Guess the type of data inside a txt file by its header
#
# @param file File path to check.
# @param ... Additional arguments to read_exstra_db_known()
read_exstra_db_txt_guesser <- function(file, ...) {
  # Scan the header
  filefirst <- read.delim(file, nrows = 1, comment.char = "#") 
  
  if("locus" %in% names(filefirst)) {
    # Using a known database format
    read_exstra_db_known(file, ...)
  } else {
    # otherwise default to UCSC style
    read_exstra_db_ucsc(file, ...)
  }
}
bahlolab/exSTRa documentation built on Sept. 17, 2022, 5:08 p.m.