R/util-fastq.R

Defines functions trimFastq

## if the outFile is not specified, the inFile will be overwritten
trimFastq <- function(inFile, outFile=NULL, length=NULL){
  stopifnot(!is.null(length))
  fqTmp <- tempfile(pattern = "trimmed", tmpdir = ".", fileext = ".fastq.gz")
  cmd = paste("seqtk seq -L", length, inFile, "| pigz --fast -p1 >", fqTmp)
  ezSystem(cmd)
  if (is.null(outFile)){
    outFile <- inFile
  }
  ezSystem(paste("mv", fqTmp, outFile))
  return(invisible(outFile))
}
uzh/ezRun documentation built on Dec. 26, 2024, 9:53 a.m.