Skip to contents

Aligns FastQ files to a reference genome using Bowtie2, converts the output to BAM, sorts it according to genomic position and indexes the final BAM file.

Usage

alignmentBowtie2(
  file,
  out_name = NULL,
  type = "SE",
  cores = 6,
  index = "/vault/refs/indexes/hg38",
  path_bam = "bam/",
  path_logs = "logs/",
  extra_bowtie2 = "",
  run = TRUE
)

Arguments

file

Character string (single-end) or character vector of length 2 (paired-end) with the file names of the samples to be analysed.

out_name

Character vector, with the same length as fastq_files, indicating the output filenames.

type

Sequence type, one of "SE" (single end) or "PE" (paired end).

cores

Number of threads to use for the analysis.

index

Character indicating the location and basename for the Bowtie2 index.

path_bam

Character indicating the output directory for the bam files.

path_logs

Character indicating the output directory for the logs.

extra_bowtie2

Character containing additional arguments to be passed to bowtie2 alignment call.

run

Logical indicating whether to run the alignment (for testing purposes). Default: TRUE

Value

Writes out_name.raw.bam in path_bam. Also generates a log for the alignment (sample.alignment.log) in your path_logs.

Examples

if (FALSE) {
alignmentBowtie2(file=paste0(path, "fastq/NL1_h3k27ac_sample.fastq.gz"),
                 suffix_fastq=".fastq.gz",
                 type="SE",
                 index="/vault/refs/indexes/hg38",
                 path_bam=paste0(path, "bam/"),
                 path_logs=paste0(path, "logs/"),
                 cores=6,
                 run=FALSE)
}