Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
loosolab
software
multicrispr
Commits
5f5566c5
Commit
5f5566c5
authored
Oct 13, 2020
by
aditya.bhagwat
Browse files
add_genome_matches / add_target_matches: export & optionalize
parent
fa6fa1b9
Pipeline
#154327
passed with stages
in 35 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
5f5566c5
Package: multicrispr
Title: Multi-locus multi-purpose Crispr/Cas design
Version: 0.99.
29
Version: 0.99.
30
Authors@R: c(person("Aditya", "Bhagwat", NULL, "aditya.bhagwat@mpi-bn.mpg.de", c("aut", "cre")),
person( "Johannes", "Graumann", NULL, 'johannes.graumann@mpi-bn.mpg.de',c("sad", "ctb")),
person( "Mette", "Bentsen", NULL, "mette.bentsen@mpi-bn.mpg.de", "ctb"),
...
...
NAMESPACE
View file @
5f5566c5
# Generated by roxygen2: do not edit by hand
export(add_genome_matches)
export(add_inverse_strand)
export(add_seq)
export(add_target_matches)
export(bed_to_granges)
export(char_to_granges)
export(double_flank)
...
...
R/06_find_spacers.R
View file @
5f5566c5
...
...
@@ -189,8 +189,8 @@ extract_matchranges <- function(gr, bsgenome, pattern, plot = FALSE){
#' @param spacer string: spacer pattern in extended IUPAC alphabet
#' @param pam string: pam pattern in extended IUPAC alphabet
#' @param complement TRUE (default) or FALSE: also search in compl ranges?
#' @param ontargetmethod 'Doench2016'
or
'Doench2016'
:
on-target scor
ing method
#' @param offtargetmethod 'bowtie'
(default) or 'pdict'
#' @param ontargetmethod 'Doench2016'
,
'Doench2016'
or NULL (no
on-target scor
e)
#' @param offtargetmethod 'bowtie'
, 'pdict', or NULL (no offtarget analysis)
#' @param offtargetfilterby filter for best off-target counts by this variable
#' @param subtract_targets TRUE or FALSE (default): whether to subtract target
#' (mis)matches from offtarget counts
...
...
R/07_count_offtargets.R
View file @
5f5566c5
...
...
@@ -507,6 +507,23 @@ count_spacer_matches <- function(
#==============================================================================
#' Add target matches
#' @param spacers GRanges
#' @param targets GRanges
#' @param bsgenome BSgenome
#' @param mismatches number
#' @param pam string
#' @param outdir bowtie output directory
#' @param verbose TRUE (default) or FALSE
#' @examples
#' file <- system.file('extdata/SRF.bed', package='multicrispr')
#' bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
#' targets0 <- bed_to_granges(file, 'mm10')
#' targets <- extend(targets0)
#' spacers <- find_spacers(targets, bsgenome, complement = FALSE,
#' ontargetmethod = NULL, offtargetmethod = NULL)
#' spacers %<>% add_target_matches(targets, bsgenome)
#' @export
add_target_matches
<-
function
(
spacers
,
targets
,
bsgenome
,
mismatches
=
2
,
pam
=
'NGG'
,
outdir
=
OUTDIR
,
verbose
=
TRUE
...
...
@@ -542,6 +559,25 @@ add_target_matches <- function(
}
#' Add genome matches
#' @param spacers GRanges
#' @param bsgenome BSgenome
#' @param mismatches number
#' @param pam string
#' @param offtargetmethod 'bowtie' or 'pdict'
#' @param outdir bowtie output directory
#' @param indexedgenomesdir directory with indexed genomes
#' @param verbose TRUE (default) or FALSE
#' @examples
#' file <- system.file('extdata/SRF.bed', package='multicrispr')
#' bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
#' targets0 <- bed_to_granges(file, 'mm10')
#' targets <- extend(targets0)
#' spacers <- find_spacers(targets, bsgenome, complement = FALSE,
#' ontargetmethod = NULL, offtargetmethod = NULL)
#' spacers %<>% extract(1:100)
#' spacers %<>% add_genome_matches(bsgenome)
#' @export
add_genome_matches
<-
function
(
spacers
,
bsgenome
=
getBSgenome
(
genome
(
spacers
)[
1
]),
...
...
@@ -745,6 +781,7 @@ count_offtargets <- function(spacers, bsgenome, targets = NULL, mismatches = 2,
indexedgenomesdir
=
INDEXEDGENOMESDIR
,
verbose
=
TRUE
,
plot
=
TRUE
,
...
){
# First clear
if
(
is.null
(
offtargetmethod
))
return
(
spacers
)
if
(
!
has_been_indexed
(
bsgenome
,
indexedgenomesdir
))
return
(
spacers
)
if
(
mismatches
==
-1
)
return
(
spacers
)
offcols
<-
c
(
paste0
(
'G'
,
0
:
3
),
paste0
(
'T'
,
0
:
3
),
paste0
(
'off'
,
0
:
3
),
'off'
)
...
...
R/08_score_ontargets.R
View file @
5f5566c5
...
...
@@ -197,6 +197,7 @@ score_ontargets <- function(
# Assert
crisprcontext
<-
NULL
assert_is_all_of
(
spacers
,
'GRanges'
)
if
(
is.null
(
ontargetmethod
))
return
(
spacers
)
assert_is_a_string
(
ontargetmethod
)
assert_is_subset
(
ontargetmethod
,
c
(
'Doench2014'
,
'Doench2016'
))
if
(
ontargetmethod
%in%
names
(
mcols
(
spacers
))){
...
...
man/add_genome_matches.Rd
0 → 100644
View file @
5f5566c5
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/07_count_offtargets.R
\name{add_genome_matches}
\alias{add_genome_matches}
\title{Add genome matches}
\usage{
add_genome_matches(
spacers,
bsgenome = getBSgenome(genome(spacers)[1]),
mismatches = 2,
pam = "NGG",
offtargetmethod = c("bowtie", "pdict")[1],
outdir = OUTDIR,
indexedgenomesdir = INDEXEDGENOMESDIR,
verbose = TRUE
)
}
\arguments{
\item{spacers}{GRanges}
\item{bsgenome}{BSgenome}
\item{mismatches}{number}
\item{pam}{string}
\item{offtargetmethod}{'bowtie' or 'pdict'}
\item{outdir}{bowtie output directory}
\item{indexedgenomesdir}{directory with indexed genomes}
\item{verbose}{TRUE (default) or FALSE}
}
\description{
Add genome matches
}
\examples{
file <- system.file('extdata/SRF.bed', package='multicrispr')
bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
targets0 <- bed_to_granges(file, 'mm10')
targets <- extend(targets0)
spacers <- find_spacers(targets, bsgenome, complement = FALSE,
ontargetmethod = NULL, offtargetmethod = NULL)
spacers \%<>\% extract(1:100)
spacers \%<>\% add_genome_matches(bsgenome)
}
man/add_target_matches.Rd
0 → 100644
View file @
5f5566c5
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/07_count_offtargets.R
\name{add_target_matches}
\alias{add_target_matches}
\title{Add target matches}
\usage{
add_target_matches(
spacers,
targets,
bsgenome,
mismatches = 2,
pam = "NGG",
outdir = OUTDIR,
verbose = TRUE
)
}
\arguments{
\item{spacers}{GRanges}
\item{targets}{GRanges}
\item{bsgenome}{BSgenome}
\item{mismatches}{number}
\item{pam}{string}
\item{outdir}{bowtie output directory}
\item{verbose}{TRUE (default) or FALSE}
}
\description{
Add target matches
}
\examples{
file <- system.file('extdata/SRF.bed', package='multicrispr')
bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
targets0 <- bed_to_granges(file, 'mm10')
targets <- extend(targets0)
spacers <- find_spacers(targets, bsgenome, complement = FALSE,
ontargetmethod = NULL, offtargetmethod = NULL)
spacers \%<>\% add_target_matches(targets, bsgenome)
}
man/find_spacers.Rd
View file @
5f5566c5
...
...
@@ -33,9 +33,9 @@ find_spacers(
\item{complement}{TRUE (default) or FALSE: also search in compl ranges?}
\item{ontargetmethod}{'Doench2016'
or
'Doench2016'
:
on-target scor
ing method
}
\item{ontargetmethod}{'Doench2016'
,
'Doench2016'
or NULL (no
on-target scor
e)
}
\item{offtargetmethod}{'bowtie'
(default) or 'pdict'
}
\item{offtargetmethod}{'bowtie'
, 'pdict', or NULL (no offtarget analysis)
}
\item{offtargetfilterby}{filter for best off-target counts by this variable}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment