R/read_hmmer.R

#' Read a HMMER .tbl/tsv file
#'
#' Read a HMMER tblout file from a protein search. The tbl file is converted to
#' tab-separated file using `hmmer-tbl2tsv`. Can also read tsv generated by
#' `hmmer-tbl2tsv` directly.
#'
#' @inheritParams readr::read_tsv
#' @importFrom readr read_tsv
#' @export
#' @return tibble
read_hmmer <- function (file){
  peek <- readChar(file, 1)
  print(peek)
  if(peek == "#"){
    file <- pipe(paste0("hmmer-tbl2tsv ", file))
  }
  read_tsv(file)
}
thackl/thacklr documentation built on Oct. 16, 2023, 9:15 p.m.