From a15fd5d6d2922ff83b20d084454d6b7feeb03465 Mon Sep 17 00:00:00 2001 From: Karthik Guruvayurappan Date: Mon, 21 Mar 2022 11:36:25 -0700 Subject: [PATCH 1/7] fixed random typos in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 097511f..640882d 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ relics.parameters$FS0_label <- 'CD69_promoter' # use all sgRNAs that overlap the # relics.parameters$background_label <- c('chr', 'exon') # specify what sgRNAs to use to initially train the background parameters ``` -6. Specify the number of functional sequences to look for and the number of functional sequences you expect to find. RELICS will look for a total of `max_fs_nr` functional sequences and eight their signal according to the prior which is specified by the `expected_fs_nr`. We recommned setting the `max_fs_nr` to at least `expected_fs_nr` + 3. For larger `expected_fs_nr` we recommend setting `max_fs_nr` to 4/3*`expected_fs_nr`. +6. Specify the number of functional sequences to look for and the number of functional sequences you expect to find. RELICS will look for a total of `max_fs_nr` functional sequences and weight their signal according to the prior which is specified by the `expected_fs_nr`. We recommned setting the `max_fs_nr` to at least `expected_fs_nr` + 3. For larger `expected_fs_nr` we recommend setting `max_fs_nr` to 4/3*`expected_fs_nr`. ```r # specify the expected number of functional sequences and how many to look for in total relics.parameters$max_fs_nr <- 15 @@ -153,7 +153,7 @@ relics.parameters$expected_fs_nr <- 5 # expected based on previous findings by S relics.parameters$crisprSystem <- 'CRISPRa' # other options: CRISPRcas9, CRISPRi, dualCRISPR ``` -8. Give the location of the output directory by setting the `out_dir` flag. Either reference to full path or the path from the current working directory. In this example we will do the latter and assume you are in the `RELICS_tutorial` folder. We recommend you create a new file in which the results are saved. Note, RELICS will NOT create non-existent files for you. In this example, first create the `CD69_tutorial_output` folder, then set the flag: +8. Give the location of the output directory by setting the `out_dir` flag. Either reference to full path or the path from the current working directory. In this example we will do the latter and assume you are in the `RELICS_tutorial` folder. We recommend you create a new directory in which the results are saved. Note, RELICS will NOT create non-existent directories for you. In this example, first create the `CD69_tutorial_output` folder, then set the flag: ```r relics.parameters$out_dir <- 'CD69_tutorial_output' ``` From 0a1bbc60bc06dd2f803edec461ae5a8f96212a38 Mon Sep 17 00:00:00 2001 From: Karthik Guruvayurappan Date: Mon, 21 Mar 2022 11:37:28 -0700 Subject: [PATCH 2/7] fixed more typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 640882d..30f0240 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ relics.parameters$crisprSystem <- 'CRISPRa' # other options: CRISPRcas9, CRISPRi relics.parameters$out_dir <- 'CD69_tutorial_output' ``` -9. RELICS now explicityl models the count-dispersion relationship. This drastically imporves performance and helps reduce the number of false positives. See the section `Count-Dispersion modeling` below for details on how to best estimate `nr_disp_bins` and `repl_spline_df`: +9. RELICS now explicitly models the count-dispersion relationship. This drastically improves performance and helps reduce the number of false positives. See the section `Count-Dispersion modeling` below for details on how to best estimate `nr_disp_bins` and `repl_spline_df`: ```r # specify the number of bins to group the guide counts into and the degrees of freedom of the spline function for each replicate relics.parameters$nr_disp_bins <- 15 From a9b373e7642df353849a64333bc556c5b8ffe9a0 Mon Sep 17 00:00:00 2001 From: somet3000 Date: Tue, 22 Mar 2022 12:40:46 -0700 Subject: [PATCH 3/7] Implemented Slab and Spike AoE for dualCRISPR --- Code/RELICS.v2.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Code/RELICS.v2.R b/Code/RELICS.v2.R index 657c098..c8ae4b0 100644 --- a/Code/RELICS.v2.R +++ b/Code/RELICS.v2.R @@ -2902,6 +2902,25 @@ set_up_RELICS_data <- function(input.parameter.list, data.file.split, guide.offs x$dist_to_seg <- min.dist + x + }) + } else if (input.parameter.list$areaOfEffect_type == 'slab_and_spike'){ + + # apply slab and spike area of effect for each guide in guide.to.seg.lst + guide.to.seg.lst <- lapply(guide.to.seg.lst, function(x){ + + # set baseline AoE of 0 + min.dist <- rep(0, length(x$dist_to_seg)) + + # set segments that guide overlaps to 1 + min.dist[x$sg_overl_idx] <- 1 + + # seg segments within flanking distance of 500bp to slab AoE + min.dist[x$dist_to_seg < 500] <- 0.25 + + # return modified dist_to_seg vector accounting for AoE + x$dist_to_seg <- min.dist + x }) } From 22e879dd60073e3c329dfabdcf867be1ad749f75 Mon Sep 17 00:00:00 2001 From: somet3000 Date: Tue, 22 Mar 2022 13:14:51 -0700 Subject: [PATCH 4/7] Made Slab and Spike AoE configurable and implemented for single guide --- Code/RELICS.v2.R | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/Code/RELICS.v2.R b/Code/RELICS.v2.R index c8ae4b0..a11f09e 100644 --- a/Code/RELICS.v2.R +++ b/Code/RELICS.v2.R @@ -527,7 +527,7 @@ check_parameter_list <- function(input.parameter.list, data.file.split){ } } - # type of area of effect. options are 'normal' (default), 'uniform', 'logistic' (need to implement) + # type of area of effect. options are 'normal' (default), 'uniform', 'slab_and_spike' if(! 'areaOfEffect_type' %in% par.given){ out.parameter.list$areaOfEffect_type <- 'normal' } @@ -632,6 +632,21 @@ check_parameter_list <- function(input.parameter.list, data.file.split){ } } } + + # set default parameters for slab and spike AoE + if (out.parameter.list$areaOfEffect_type == "slab_and_spike") { + + # set default flanking distance to 500bp + if (! 'flanking.distance' %in% par.given) { + out.parameter.list$flanking.distance <- 500 + } + + # set default slab AoE to 0.1 + if (! 'slab.aoe' %in% par.given) { + out.parameter.list$slab.aoe <- 0.1 + } + } + # if(out.parameter.list$areaOfEffect_type == 'normal'){ # if(! 'normal_areaOfEffect_sd' %in% par.given){ @@ -2866,6 +2881,27 @@ set_up_RELICS_data <- function(input.parameter.list, data.file.split, guide.offs dnorm(0, mean = 0, sd = input.parameter.list$normal_areaOfEffect_sd) x$dist_to_seg[which(x$dist_to_seg == max(x$dist_to_seg))] <- 1 + x + }) + } else if(input.parameter.list$areaOfEffect_type == 'slab_and_spike'){ + + # create variables to hold flanking distance and slab area of effect + flanking.distance <- input.parameter.list$flanking.distance + slab.aoe <- input.parameter.list$slab.aoe + + # iterate through every guide in guide.to.seg.lst + guide.to.seg.lst <- lapply(guide.to.seg.lst, function(x){ + + # set all segments to have a default AoE of 0 + x$dist_to_seg <- rep(0, length(x$dist_to_seg)) + + # set AoE to slab value if within flanking distance + within.flank <- x$dist_to_seg < flanking.distance + x$dist_to_seg[within.flank] <- input.parameter.list$slab.aoe + + # set closest segment to have an AoE of 1 (spike) + x$dist_to_seg[which(x$dist_to_seg == min(x$dist_to_seg))] <- 1 + x }) } @@ -2906,6 +2942,10 @@ set_up_RELICS_data <- function(input.parameter.list, data.file.split, guide.offs }) } else if (input.parameter.list$areaOfEffect_type == 'slab_and_spike'){ + # create variables to hold flanking distance and slab area of effect + flanking.distance <- input.parameter.list$flanking.distance + slab.aoe <- input.parameter.list$slab.aoe + # apply slab and spike area of effect for each guide in guide.to.seg.lst guide.to.seg.lst <- lapply(guide.to.seg.lst, function(x){ @@ -2916,7 +2956,7 @@ set_up_RELICS_data <- function(input.parameter.list, data.file.split, guide.offs min.dist[x$sg_overl_idx] <- 1 # seg segments within flanking distance of 500bp to slab AoE - min.dist[x$dist_to_seg < 500] <- 0.25 + min.dist[x$dist_to_seg < flanking.distance] <- slab.aoe # return modified dist_to_seg vector accounting for AoE x$dist_to_seg <- min.dist From d872081a51d1d0f272a832ea6966135513622678 Mon Sep 17 00:00:00 2001 From: somet3000 Date: Tue, 22 Mar 2022 13:29:22 -0700 Subject: [PATCH 5/7] set default CRISPR effect range for slab and spike --- Code/RELICS.v2.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Code/RELICS.v2.R b/Code/RELICS.v2.R index a11f09e..6e816ba 100644 --- a/Code/RELICS.v2.R +++ b/Code/RELICS.v2.R @@ -645,6 +645,11 @@ check_parameter_list <- function(input.parameter.list, data.file.split){ if (! 'slab.aoe' %in% par.given) { out.parameter.list$slab.aoe <- 0.1 } + + # set default CRISPR effect range to zero if not provided + if (! 'crisprEffectRange' %in% par.given) { + out.parameter.crisprEffectRange <- 0 + } } From e0393cfcd208a92fc40b42834cc32a0d8d3aa02f Mon Sep 17 00:00:00 2001 From: Karthik Guruvayurappan Date: Tue, 22 Mar 2022 13:38:24 -0700 Subject: [PATCH 6/7] Update README.md to include slab and spike AoE --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30f0240..8438e03 100644 --- a/README.md +++ b/README.md @@ -355,11 +355,18 @@ relics.parameters$normal_areaOfEffect_sd <- 170 relics.parameters$crisprEffectRange <- 415 ``` -It is also possible to nor model the AoE and assume a uniform parturbation instead where it's equally likely for any base pair to be perturbed +It is also possible to not model the AoE and assume a uniform perturbation instead where it's equally likely for any base pair to be perturbed ```r relics.parameters$areaOfEffect_type <- 'uniform' ``` +A third area of effect approach that can be used with RELICS is a "slab-and-spike" area of effect. In the slab and spike implementation, the genomic regions that overlap the guides are set to a "spike" area of effect of 1, while the base pairs flanking the guide are set to a "slab" area of effect. By default, RELICS uses a flanking distance of 500 base pairs and a "slab" of 0.1, but these parameters can be manually configured as well. +```r +relics.parameters$areaOfEffect_type <- 'slab_and_spike' +relics.parameters$flanking.distance <- 500 +relics.parameters$slab.aoe <- 0.1 +``` + ## Input data format contd. (for backward compatibility) Instead of providing one joint file containing both coordinates and counts it is also possible to supply them separately. In this case the format is the following: From c3ae764c58158d56883361f1ac6e13fe4688e8b0 Mon Sep 17 00:00:00 2001 From: somet3000 Date: Tue, 22 Mar 2022 16:11:51 -0700 Subject: [PATCH 7/7] Fixed Bug in Slab and Spike AoE --- Code/RELICS.v2.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/RELICS.v2.R b/Code/RELICS.v2.R index 6e816ba..5d28be7 100644 --- a/Code/RELICS.v2.R +++ b/Code/RELICS.v2.R @@ -2956,13 +2956,13 @@ set_up_RELICS_data <- function(input.parameter.list, data.file.split, guide.offs # set baseline AoE of 0 min.dist <- rep(0, length(x$dist_to_seg)) - - # set segments that guide overlaps to 1 - min.dist[x$sg_overl_idx] <- 1 # seg segments within flanking distance of 500bp to slab AoE min.dist[x$dist_to_seg < flanking.distance] <- slab.aoe + # set segments that guide overlaps to 1 + min.dist[x$sg_overl_idx] <- 1 + # return modified dist_to_seg vector accounting for AoE x$dist_to_seg <- min.dist