R/systemGATK.R

###########################################################################/**
# @RdocDefault systemGATK
#
# @title "Calls the GATK executable"
#
# \description{
#  @get "title".
# }
#
# @synopsis
#
# \arguments{
#   \item{...}{Arguments specifying GATK command line switches.}
#   \item{verbose}{See @see "R.utils::Verbose".}
# }
#
# \examples{\dontrun{
#   pathnameBAM <- "bwaData/LambdaVirusExample,bwa,is/Lambda_phage/reads_1.bam"
#   res <- systemGATK(T="CountReads", ..., stderr=FALSE)
# }}
#
#
# @author "HB"
#
# @keyword internal
#*/###########################################################################
setMethodS3("systemGATK", "default", function(..., verbose=FALSE) {
  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  # Validate arguments
  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  # Arguments '...':
  args <- list(...)

  # Argument 'verbose':
  verbose <- Arguments$getVerbose(verbose)
  if (verbose) {
    pushState(verbose)
    on.exit(popState(verbose))
  }

  verbose && enter(verbose, "Calling GATK executable")

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  # Locate executable
  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  pathname <- findGATK(verbose=less(verbose, 50))
  verbose && cat(verbose, "GATK jar file:")
  verbose && print(verbose, pathname)
  pathname <- Arguments$getReadablePathname(pathname)


  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  # Call GATK java jar
  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  .fmtArg <- c("--.*"="%s %s", ".*"="-%s %s")
  res <- systemJavaJar(pathname, ..., .fmtArg=.fmtArg, verbose=less(verbose, 5))

  verbose && exit(verbose)

  res
}) # systemGATK()
HenrikBengtsson/aroma.seq documentation built on Feb. 15, 2021, 2:21 a.m.