Commit 832c0136 authored by aditya.bhagwat's avatar aditya.bhagwat
Browse files

find_primespacers: allow for ontargetmethod/offtargetmethod == NULL

parent 5f5566c5
......@@ -146,20 +146,22 @@ add_nickspacers <- function(primespacers, bsgenome,
mismatches = nickmatches, indexedgenomesdir = indexedgenomesdir,
outdir = outdir, plot=FALSE)
nickspacers$type <- 'nickspacer'
mcols(nickspacers)[[ontargetmethod]] %<>% round(digits = 2)
#mcols(nickspacers)[[ontargetmethod]] %<>% round(digits = 2)
# Merge
nickdt <- gr2dt(nickspacers) %>%
extract( , .(
pename = pename,
nickrange = as.character(granges(nickspacers)),
nickspacer = crisprspacer,
nickpam = crisprpam,
nickoff = off))
for (i in seq(0, nickmatches)){
nickdt[, (paste0('nickoff',i)) := mcols(nickspacers)[[paste0('off',i)]]]
}
method <- ontargetmethod
nickdt[, (paste0('nick', method)) := mcols(nickspacers)[[method]]]
nickpam = crisprpam))
if (!is.null(offtargetmethod)){
nickdt[, nickoff := nickspacers$off]
for (i in seq(0, nickmatches)){
offvalues <- mcols(nickspacers)[[paste0('off',i)]]
nickdt[, (paste0('nickoff',i)) := offvalues]}}
if (!is.null(ontargetmethod)){
method <- ontargetmethod
nickdt[, (paste0('nick', method)) := mcols(nickspacers)[[method]]]}
nickdt %<>% extract( , lapply(.SD, pastelapse), by = 'pename')
pedt <- gr2dt(primespacers)
......
......@@ -569,6 +569,7 @@ add_target_matches <- function(
#' @param indexedgenomesdir directory with indexed genomes
#' @param verbose TRUE (default) or FALSE
#' @examples
#' require(magrittr)
#' file <- system.file('extdata/SRF.bed', package='multicrispr')
#' bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
#' targets0 <- bed_to_granges(file, 'mm10')
......
......@@ -36,6 +36,7 @@ add_genome_matches(
Add genome matches
}
\examples{
require(magrittr)
file <- system.file('extdata/SRF.bed', package='multicrispr')
bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10
targets0 <- bed_to_granges(file, 'mm10')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment