R/wrapperSalmon.R

Defines functions wrapperSalmon

Documented in wrapperSalmon

#' @title A function to estimate counts using Salmon quasi-alignment
#' @description This function executes a docker that produces as output the transcripts count file generated by Salmon quasi-alignment and convert it  the same format of isoforms.result of  RSEM
#' @param group, a character string. Two options: sudo or docker, depending to which group the user belongs
#' @param scratch.folder, a character string indicating the path of the scratch folder
#' @param fastq.folder, a character string indicating the folder where input data are located and where output will be written
#' @param threads, a number indicating the number of cores to be used from the application
#' @param seq.type, a character string indicating the type of reads to be generated by the sequencer. Two options: \code{"se"} or \code{"pe"} respectively for single end and pair end sequencing. Strandness is inferred by salmon.
#' @param index.folder, a character string indicating the folder where transcriptome index was created with salmonIndex.
#' @param adapter5, a character string indicating the fwd adapter
#' @param adapter3, a character string indicating the rev adapter
#' @param min.length, a number indicating minimal length required to return a trimmed read
#' @param strandness, a character string indicating the type ofsequencing protocol used for the analysis. Three options: \code{"none"}, \code{"forward"}, \code{"reverse"} respectively for non strand selection, reverse for Illumina strandness protocols, reverse for ACCESS Illumina protocol

#' @author Raffaele Calogero, raffaele.calogero [at] unito [dot] it, Bioinformatics and Genomics unit, University of Torino Italy
#' @examples
#' \dontrun{
#' system("wget http://130.192.119.59/public/test_R1.fastq.gz")
#' system("wget http://130.192.119.59/public/test_R2.fastq.gz")
#' library(docker4seq)
#' #running salmonCounts
#' wrapperSalmon(group="docker", scratch.folder="/scratch/users/rcaloger/",
#'         fastq.folder=getwd(), index.folder="/archive/home/rcaloger/data/seqbox/salmonIndex.R",
#'         threads=24, seq.type="pe", adapter5="AGATCGGAAGAGCACACGTCTGAACTCCAGTCA",
#'         adapter3="AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT", min.length=40, strandness="none")
#' }
#'
#'
#' @export
#'
wrapperSalmon <- function(group=c("sudo", "docker"), scratch.folder, fastq.folder, index.folder,
         threads=24, seq.type=c("se", "pe"), adapter5, adapter3, min.length, strandness=c("none", "forward", "reverse")){

  #FastQC
  fastqc(group="docker", data.folder=fastq.folder)
  setwd(fastq.folder)

  #trimming adapter
  skewer(group=group,fastq.folder=fastq.folder, scratch.folder=scratch.folder,adapter5=adapter5, adapter3=adapter3, seq.type=seq.type, threads=threads,  min.length=min.length)
  #running salmon
  salmonCounts(group=group, scratch.folder=scratch.folder,
                   fastq.folder=fastq.folder, index.folder=index.folder,
                   threads=threads, seq.type=seq.type, strandness=strandness)
  #anntating salmon output
  salmonAnnotation(group=group, fastq.folder=fastq.folder, index.folder=index.folder)

}
kendomaniac/docker4seq documentation built on Oct. 16, 2023, 2:30 a.m.