Skip to content

Commit

Permalink
Merge branch 'main' into addMainPlots
Browse files Browse the repository at this point in the history
  • Loading branch information
kweav authored Dec 19, 2024
2 parents 7219640 + aa869bf commit 7698ed0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions R/06-calculate_gi.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ calc_gi <- function(.data = NULL,
dplyr::group_by(rep,
pgRNA_target) %>%
dplyr::summarize(mean_expected_cs = mean(expected_double_crispr, na.rm = TRUE),
mean_observed_cs = mean(double_crispr, na.rm = TRUE),
mean_gi_score = mean(double_gi_score, na.rm = TRUE)) %>%
# Collapse to just stats and don't care about pg_ids anymore
dplyr::select(rep,
pgRNA_target,
mean_expected_cs,
mean_observed_cs,
mean_gi_score) %>%
dplyr::mutate(target_type = "gene_gene") %>%
dplyr::distinct()
Expand All @@ -135,6 +137,7 @@ calc_gi <- function(.data = NULL,
dplyr::group_by(rep,
pgRNA_target) %>%
dplyr::summarize(mean_expected_cs = mean(expected_single_crispr, na.rm = TRUE),
mean_observed_cs = mean(single_crispr, na.rm = TRUE),
mean_gi_score = mean(single_gi_score, na.rm = TRUE)) %>%
dplyr::mutate(target_type = dplyr::case_when(
grepl("^ctrl_*", pgRNA_target) ~"ctrl_gene",
Expand All @@ -144,6 +147,7 @@ calc_gi <- function(.data = NULL,
target_type,
pgRNA_target,
mean_expected_cs,
mean_observed_cs,
mean_gi_score) %>%
dplyr::distinct()

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ log2((counts / total counts for sample)) * 1 million) + 1)
```
log2FC = log2CPM for each sample - pretreament log2CPM
```
3. `Normalize by negative and positive controls` - Calculate a negative control median for each sample and a positive control median for each sample and divide each log2FC by this value.

3. `Normalize by negative and positive controls` - Calculate a negative control median for each sample and a positive control median for each sample and divide each log2FC by this value. In this version then we are normalizing by the median difference of the negative and positive controls.
```
log2FC adjusted = log2FC / (median negative control for a sample - median positive control for a sample)
# FOR EACH SAMPLE:
log2FC adjusted =
(log2FC - log2FC median negative control) /
(log2FC median negative control - median log2FC positive control)
```

### CRISPR scores
Expand Down

0 comments on commit 7698ed0

Please sign in to comment.