run_bwa: Run the BWA aligner

Description Usage Arguments Value Examples

View source: R/run_bwa.R

Description

Runs the BWA aligner

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
run_bwa(
  command = NULL,
  mate1 = NULL,
  mate2 = NULL,
  index = NULL,
  sample.name = NULL,
  out.dir = NULL,
  threads = 10,
  seed.length = NULL,
  parallel = FALSE,
  cores = 4,
  bwa = NULL,
  version = FALSE
)

Arguments

command

BWA command to run, at present can choose 'mem', which is most useful fo Illumina, PacBio and Nanopore reads, required

mate1

List of the paths to files containing to the forward reads, required

mate2

List of the paths to files containing to the reverse reads, required for paired end sequence data

index

Path to the indexed reference genome, required

sample.name

List of sample names, required

out.dir

Name of the directory from the BWA output

threads

Number of threads for BWA to use, default set to 10

seed.length

Minimum seed length

parallel

Run in parallel, default set to FALSE

cores

Number of cores/threads to use for parallel processing, default set to 4

bwa

Path to the bwa program, required

version

Returns the version number

Value

A list with the BWA commands

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 ## Not run: 
 path <- "/software/bwa/bwa"

# Get version number
bwa.version <- run_bwa(bwa = path,
                       version = TRUE)
bwa.version[3] # print the line with version number

reads.path <- "/path/to/fastqs"
reads.patt.1 <- "*_R1_001.fastq.gz$"
reads.patt.2 <- "*_R2_001.fastq.gz$"

# Organise the samples
sample.dataframe <- prepare_samples(reads.path, c(reads.patt.1,reads.patt.2),trimmed.reads.dir)

mate1 <- as.character(sample.dataframe$reads.path.1)
mate1.trim <- as.character(sample.dataframe$trimmed.reads.path.1)
# Paired end only
 mate2 <- as.character(sample.dataframe$reads.path.2)
 mate2.trim <- as.character(sample.dataframe$trimmed.reads.path.2)

sample.names <- as.character(sample.dataframe$sample.names)

genome <- "/path/to/reference/genome"

command <- "mem"
out.dir <- "bwa_alignments"

# Paired end
pe <- run_bwa(command = command,
              mate1 = mate1.trim,
              mate2 = mate2.trim,
              index = genome,
              threads = 20,
              out.dir = out.dir,
              sample.name = sample.names,
              seed.length = 21,
              bwa = path)

# Single end
se <- run_bwa(command = command,
              mate1 = mate1.trim,
              index = genome,
              threads = 20,
              out.dir = out.dir,
              sample.name = sample.names,
              seed.length = 21,
              bwa = path)

## End(Not run)

GrahamHamilton/pipelineTools documentation built on June 19, 2021, 1:08 p.m.