crisprBwa provides two main functions to align short DNA sequences to
a reference genome using the short read aligner BWA-backtrack (Li and
Durbin 2009) and return the alignments as R objects: runBwa and
runCrisprBwa. It utilizes the Bioconductor package Rbwa to access
the BWA program in a platform-independent manner. This means that users
do not need to install BWA prior to using crisprBwa.
The latter function (runCrisprBwa) is specifically designed to map and
annotate CRISPR guide RNA (gRNA) spacer sequences using CRISPR nuclease
objects and CRISPR genomic arithmetics defined in the Bioconductor
package crisprBase. This
enables a fast and accurate on-target and off-target search of gRNA
spacer sequences for virtually any type of CRISPR nucleases. It also
provides an off-target search engine for our main gRNA design package
crisprDesign of the
crisprVerse ecosystem. See the
addSpacerAlignments function in crisprDesign for more details.
Installation and getting started
Software requirements
OS Requirements
This package is supported for macOS and Linux only. Package was
developed and tested on R version 4.2.1.
Installation from Bioconductor
crisprBwa can be installed from from the Bioconductor devel branch
using the following commands in a fresh R session:
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version="devel")
BiocManager::install("crisprBwa")
Building a bwa index
To use runBwa or runCrisprBwa, users need to first build a BWA
genome index. For a given genome, this step has to be done only once.
The Rbwa package conveniently provides the function bwa_build_index
to build a BWA index from any custom genome from a FASTA file.
As an example, we build a BWA index for a small portion of the human
chromosome 12 (chr12.fa file provided in the crisprBwa package) and
save the index file as myIndex to a temporary directory:
library(Rbwa)
fasta <- system.file(package="crisprBwa", "example/chr12.fa")
outdir <- tempdir()
index <- file.path(outdir, "chr12")
Rbwa::bwa_build_index(fasta,
index_prefix=index)
To learn how to create a BWA index for a complete genome or
transcriptome, please visit our tutorial
page.
Alignment using runCrisprBwa
As an example, we align 5 spacer sequences (of length 20bp) to the
custom genome built above, allowing a maximum of 3 mismatches between
the spacer and protospacer sequences.
We specify that the search is for the wildtype Cas9 (SpCas9) nuclease by
providing the CrisprNuclease object SpCas9 available through the
crisprBase package. The argument canonical=FALSE specifies that
non-canonical PAM sequences are also considered (NAG and NGA for
SpCas9). The function getAvailableCrisprNucleases in crisprBase
returns a character vector of available crisprNuclease objects found
in crisprBase.
We also need to provide a BSgenome object corresponding to the
reference genome used for alignment to extract protospacer and PAM
sequences of the target sequences.
library(crisprBwa)
## Warning: multiple methods tables found for 'aperm'
## Warning: replacing previous import 'BiocGenerics::aperm' by
## 'DelayedArray::aperm' when loading 'SummarizedExperiment'
library(BSgenome.Hsapiens.UCSC.hg38)
## Loading required package: BSgenome
## Loading required package: BiocGenerics
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
## match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
## Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
## table, tapply, union, unique, unsplit, which.max, which.min
## Loading required package: S4Vectors
## Loading required package: stats4
##
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: GenomicRanges
## Loading required package: Biostrings
## Loading required package: XVector
##
## Attaching package: 'Biostrings'
## The following object is masked from 'package:base':
##
## strsplit
## Loading required package: rtracklayer
The function runBwa is similar to runCrisprBwa, but does not impose
constraints on PAM sequences. It can be used to search for any short
read sequence in a genome.
Example using RNAi (siRNA design)
Seed-related off-targets caused by mismatch tolerance outside of the
seed region is a well-studied and characterized problem observed in RNA
interference (RNAi) experiments. runBWa can be used to map shRNA/siRNA
seed sequences to reference genomes to predict putative off-targets:
crisprBwa: alignment of gRNA spacer sequences using BWA
runCrisprBwaAuthors: Jean-Philippe Fortin
Date: July 13, 2022
Overview of crisprBwa
crisprBwaprovides two main functions to align short DNA sequences to a reference genome using the short read aligner BWA-backtrack (Li and Durbin 2009) and return the alignments as R objects:runBwaandrunCrisprBwa. It utilizes the Bioconductor packageRbwato access the BWA program in a platform-independent manner. This means that users do not need to install BWA prior to usingcrisprBwa.The latter function (
runCrisprBwa) is specifically designed to map and annotate CRISPR guide RNA (gRNA) spacer sequences using CRISPR nuclease objects and CRISPR genomic arithmetics defined in the Bioconductor package crisprBase. This enables a fast and accurate on-target and off-target search of gRNA spacer sequences for virtually any type of CRISPR nucleases. It also provides an off-target search engine for our main gRNA design package crisprDesign of the crisprVerse ecosystem. See theaddSpacerAlignmentsfunction incrisprDesignfor more details.Installation and getting started
Software requirements
OS Requirements
This package is supported for macOS and Linux only. Package was developed and tested on R version 4.2.1.
Installation from Bioconductor
crisprBwacan be installed from from the Bioconductor devel branch using the following commands in a fresh R session:Building a bwa index
To use
runBwaorrunCrisprBwa, users need to first build a BWA genome index. For a given genome, this step has to be done only once. TheRbwapackage conveniently provides the functionbwa_build_indexto build a BWA index from any custom genome from a FASTA file.As an example, we build a BWA index for a small portion of the human chromosome 12 (
chr12.fafile provided in thecrisprBwapackage) and save the index file asmyIndexto a temporary directory:To learn how to create a BWA index for a complete genome or transcriptome, please visit our tutorial page.
Alignment using
runCrisprBwaAs an example, we align 5 spacer sequences (of length 20bp) to the custom genome built above, allowing a maximum of 3 mismatches between the spacer and protospacer sequences.
We specify that the search is for the wildtype Cas9 (SpCas9) nuclease by providing the
CrisprNucleaseobjectSpCas9available through thecrisprBasepackage. The argumentcanonical=FALSEspecifies that non-canonical PAM sequences are also considered (NAG and NGA for SpCas9). The functiongetAvailableCrisprNucleasesincrisprBasereturns a character vector of availablecrisprNucleaseobjects found incrisprBase.We also need to provide a
BSgenomeobject corresponding to the reference genome used for alignment to extract protospacer and PAM sequences of the target sequences.Applications beyond CRISPR
The function
runBwais similar torunCrisprBwa, but does not impose constraints on PAM sequences. It can be used to search for any short read sequence in a genome.Example using RNAi (siRNA design)
Seed-related off-targets caused by mismatch tolerance outside of the seed region is a well-studied and characterized problem observed in RNA interference (RNAi) experiments.
runBWacan be used to map shRNA/siRNA seed sequences to reference genomes to predict putative off-targets:Reproducibility
References
Li, Heng, and Richard Durbin. 2009. “Fast and Accurate Short Read Alignment with Burrows–Wheeler Transform.” Bioinformatics 25 (14): 1754–60.