Alignment using Rbowtie2

bowtie_align(
  fq,
  index,
  outbam = "fq",
  inputFormat = "fasta",
  keepSAM = T,
  mode = "genome_map",
  maxMismatches = 0,
  seedSubString = 18,
  threads = 1,
  report_k = NULL,
  keep_all = NULL,
  soft_clip = NULL,
  additional_Args = NULL,
  overwrite = FALSE
)

Arguments

fq

path to file to process (fasta or fastq).

index

bowtie2 index name without extension.

outbam

output bam name, not required if mode is set. If mode is set to "NULL", specify "fq" (default - name of file to process/reads) or "index" (name of index)

inputFormat

Format of reads, "fastq" or "fasta" (default).

keepSAM

keep bowtie2 SAM output file, TRUE (default) or FALSE.

mode

mapping mode, "genome_map" (default - 1 mismatch in seed alignment, seed substring of 18) or "reverse_map" (for mapping short sequences to reads, i.e. miRNAs or chimera analysis, 0 mismatches and a seed substring of 18); set mode=NULL to custom set bowtie2 options using arguments below or additional arguments.

maxMismatches

max mismatches in seed alignment, (default is 0).

seedSubString

length of seed substrings (default is 18).

threads

number of threads to use (default is 1).

report_k

number of alignments to report, default is NULL (the best alignment is reported), set to integer to specify.

keep_all

report all alignments, default is NULL (the best alignment is reported), set to TRUE to report all.

soft_clip

allow soft clipping, default is NULL (no soft clipping), set to TRUE to to soft clip.

additional_Args

any additional mapping arguments not set above, default is NULL, can be set by specifying a single character string with spaces between arguments (see example below); run "Rbowtie2::bowtie2_usage()" to see all options; please note that due to a Rbowtie2 bug, the "--no-1mm-upfront" is not available.

overwrite

overwrite existing output files, TRUE or FALSE (default).

Value

path to sorted BAM.

Author

Kathryn Rozen-Gagnon

Examples

testFasta <- system.file("extdata/hg19Small.fa",package="CLIPflexR")
myIndex <- suppressWarnings(bowtie2_index(testFasta, overwrite=TRUE))
testFQ <- system.file("extdata/Fox3_Std_small.fq.gz",package="CLIPflexR")
FqFile <- decompress(testFQ,overwrite=TRUE)
FqFile_FF <- ctk_fastqFilter(FqFile,qsFilter="mean:0-29:20",verbose=TRUE)
#> fastq_filter.pl command is /Users/runner/Library/r-miniconda/envs/CLIPflexR_0.1.20/bin/ctk/fastq_filter.pl
#> fastq_filter.pl arguments are /Users/runner/Library/r-miniconda/envs/CLIPflexR_0.1.20/bin/ctk/fastq_filter.pl  -if sanger  -of fastq  -f mean:0-29:20  /Users/runner/work/_temp/Library/CLIPflexR/extdata/Fox3_Std_small.fq  /Users/runner/work/_temp/Library/CLIPflexR/extdata/FF_Fox3_Std_small.fq 
FqFile_clipped <- fastx_clipper(FqFile_FF,length=20)
FqFile_QF <- fastq_quality_trimmer(FqFile_clipped)
FqFile_Col <- ctk_fastq2collapse(FqFile_QF,verbose=TRUE)
#> fastq_filter.pl command is /Users/runner/Library/r-miniconda/envs/CLIPflexR_0.1.20/bin/ctk/fastq2collapse.pl
#> fastq_filter.pl arguments are /Users/runner/Library/r-miniconda/envs/CLIPflexR_0.1.20/bin/ctk/fastq2collapse.pl  /Users/runner/work/_temp/Library/CLIPflexR/extdata/QT_FF_Fox3_Std_small_clip.fq  /Users/runner/work/_temp/Library/CLIPflexR/extdata/Collapsed_QT_FF_Fox3_Std_small_clip.fq 
FqFile_ColStrip <- ctk_stripBarcode(FqFile_Col,linkerlength=5, inputFormat="fastq")

##map reads to genome
suppressWarnings(bowtie_align(FqFile_ColStrip,myIndex,
inputFormat="fastq", overwrite=TRUE))
#> [1] "/Users/runner/work/_temp/Library/CLIPflexR/extdata/Collapsed_QT_FF_Fox3_Std_small_clip_rm5.bam"

##map reads to genome, custom mode
suppressWarnings(bowtie_align(FqFile_ColStrip,myIndex, mode=NULL, 
soft_clip=TRUE, additional_Args="--mp 15 -R 4", inputFormat="fastq", overwrite=TRUE)) 
#> [1] "/Users/runner/work/_temp/Library/CLIPflexR/extdata/Collapsed_QT_FF_Fox3_Std_small_clip_rm5.bam"

##map miRNAs to reads
miRNAs <- system.file("extdata/hsa_mature.fa",package="CLIPflexR")
FaFile_Fa <- fastx_qtoa(FqFile_ColStrip)
readIndex <- bowtie2_index(FaFile_Fa, overwrite=TRUE)
suppressWarnings(bowtie_align(miRNAs,readIndex, mode="reverse_map",overwrite=TRUE))
#> [1] "/Users/runner/work/_temp/Library/CLIPflexR/extdata/Collapsed_QT_FF_Fox3_Std_small_clip_rm5.bam"