cmatkhan commited on
Commit
feff754
·
1 Parent(s): 5d600d3

adding responsive column. see readme

Browse files
README.md CHANGED
@@ -564,6 +564,12 @@ configs:
564
  dtype: float64
565
  description: Benjamini-Hochberg adjusted p-value (DESeq2 output)
566
  role: quantitative_measure
 
 
 
 
 
 
567
 
568
  - config_name: degron_counts_meta
569
  description: Sample-level metadata for auxin-inducible degron perturbation experiments with HTSeq count statistics
 
564
  dtype: float64
565
  description: Benjamini-Hochberg adjusted p-value (DESeq2 output)
566
  role: quantitative_measure
567
+ - name: responsive
568
+ dtype: bool
569
+ description: >-
570
+ TRUE/FALSE labeling based on authors recommended threshold on
571
+ responsiveness where TRUE means that
572
+ padj < 0.1 & abs(log2FoldChange) >= log2(1.3)
573
 
574
  - config_name: degron_counts_meta
575
  description: Sample-level metadata for auxin-inducible degron perturbation experiments with HTSeq count statistics
rnaseq_reprocessed.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:66a53db51bfadb326f663f90a9da4a64d8e4724da679ad17851a530541ea3fb4
3
- size 43776387
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2233d75235f0309d8c03ef92e73ecc1c4e3fdb9cc622bd5b7b910cbf12766e69
3
+ size 41622007
scripts/evaluating_zscore_vs_enrichment_vs_peaks_vs_perturbation.R ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library(tidyverse)
2
+ library(here)
3
+ library(ggExtra)
4
+ library(patchwork)
5
+ library(pROC)
6
+
7
+ promoters = read_csv("~/code/hf/yeast_genome_resources/mindel_promoters.csv.gz")
8
+ chec_promoter_sums_raw = read_csv("~/projects/ChEC_Target_Selection/data/chec_sumprom.csv")
9
+ chec_promoter_zscores = chec_promoter_sums_raw %>%
10
+ dplyr::rename(mindel_name = name) %>%
11
+ # removed because these two loci are merged and considered a -1 frameshift
12
+ # of the same locus. confusingly labeled promoters in original mindel data
13
+ filter(!mindel_name %in% c("AAD6", "AAD16", "YAR061W", "YAR062W")) %>%
14
+ pivot_longer(-mindel_name, names_to = 'mindel_regulator', values_to = 'promoter_score') %>%
15
+ left_join(promoters %>%
16
+ select(mindel_name, target_locus_tag, target_symbol)) %>%
17
+ select(-mindel_name) %>%
18
+ left_join(
19
+ promoters %>%
20
+ select(mindel_name, target_locus_tag, target_symbol) %>%
21
+ dplyr::rename(mindel_regulator = mindel_name,
22
+ regulator_locus_tag = target_locus_tag,
23
+ regulator_symbol = target_symbol) %>%
24
+ bind_rows(
25
+ tibble(mindel_regulator = c("COM2", "SDD4"),
26
+ regulator_locus_tag = c("YER130C", "YPR022C"),
27
+ regulator_symbol = c("COM2", "SDD4")))) %>%
28
+ select(-mindel_regulator) %>%
29
+ dplyr::relocate(regulator_locus_tag, regulator_symbol, target_locus_tag, target_symbol) %>%
30
+ group_by(regulator_locus_tag) %>%
31
+ mutate(zscore = as.numeric(scale(promoter_score))) %>%
32
+ ungroup()
33
+
34
+ chec_enrichment = arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined.parquet") %>%
35
+ left_join(arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined_meta.parquet")) %>%
36
+ filter(condition == "standard")
37
+
38
+ mahendrawada_rnaseq = arrow::read_parquet("~/code/hf/mahendrawada_2025/rnaseq_reprocessed.parquet") %>%
39
+ filter(env_condition == "standard_30C") %>%
40
+ replace_na(list(log2FoldChange = 0, padj = 1)) %>%
41
+ mutate(responsive = abs(log2FoldChange) > 0.5 & padj < 0.05)
42
+
43
+ comp_df = chec_promoter_zscores %>%
44
+ select(-c(promoter_score)) %>%
45
+ left_join(select(chec_enrichment, regulator_locus_tag,
46
+ target_locus_tag,
47
+ log_poisson_pval)) %>%
48
+ left_join(select(mahendrawada_rnaseq, regulator_locus_tag, target_locus_tag,
49
+ log2FoldChange, padj, responsive)) %>%
50
+ filter(complete.cases(.)) %>%
51
+ arrange(regulator_locus_tag, target_locus_tag)
52
+
53
+
54
+ comp_plot = function(rsym){
55
+ p1 = comp_df %>%
56
+ filter(regulator_symbol == rsym) %>%
57
+ ggplot(aes(zscore, -log_poisson_pval, color = responsive)) +
58
+ geom_point(alpha = 0.8) +
59
+ geom_smooth(aes(group = 1), color = "blue") +
60
+ geom_vline(xintercept = 3.5) +
61
+ geom_hline(yintercept = -log(0.05/5331))
62
+
63
+ df_reg <- comp_df %>% filter(regulator_symbol == rsym)
64
+
65
+ roc_z <- roc(df_reg$responsive, df_reg$zscore, direction = "<")
66
+ roc_p <- roc(df_reg$responsive, -df_reg$log_poisson_pval, direction = "<")
67
+
68
+ roc_plot = ggroc(list(zscore = roc_z, poisson = roc_p)) +
69
+ geom_abline(slope = 1, intercept = 1, linetype = "dashed") +
70
+ scale_color_manual(values = c(zscore = "darkgreen", poisson = "purple")) +
71
+ labs(color = "Method")
72
+
73
+ p2 = comp_df %>%
74
+ filter(regulator_symbol == rsym) %>%
75
+ ggplot(aes(zscore, color = responsive)) +
76
+ stat_ecdf() +
77
+ geom_vline(xintercept = 3.5, linetype = "dashed") +
78
+ labs(y = "Cumulative fraction")
79
+
80
+ p3 = comp_df %>%
81
+ filter(regulator_symbol == rsym) %>%
82
+ ggplot(aes(-log_poisson_pval, color = responsive)) +
83
+ stat_ecdf() +
84
+ geom_vline(xintercept = -log(0.05/5331), linetype = "dashed") +
85
+ labs(y = "Cumulative fraction")
86
+
87
+ (p1 + roc_plot) / (p2 + p3) + plot_layout(guides = "collect") +
88
+ plot_annotation(title = paste0("Regulator: ", rsym))
89
+ }
90
+
91
+ comp_plot("FKH1")
92
+
93
+ comp_auc = comp_df %>%
94
+ filter(!regulator_symbol %in% c("STB5", "USV1")) %>%
95
+ group_by(regulator_symbol) %>%
96
+ reframe(
97
+ auc_zscore = as.numeric(auc(responsive, zscore, direction = "<")),
98
+ auc_poisson = as.numeric(auc(responsive, -log_poisson_pval, direction = "<"))
99
+ )
100
+
101
+
102
+ # summary
103
+ comp_auc %>%
104
+ reframe(
105
+ mean_auc_z = mean(auc_zscore),
106
+ mean_auc_p = mean(auc_poisson),
107
+ z_wins = sum(auc_zscore > auc_poisson),
108
+ p_wins = sum(auc_zscore < auc_poisson)
109
+ )
110
+
111
+ comp_df_ranked_by_binding = comp_df %>%
112
+ group_by(regulator_locus_tag) %>%
113
+ mutate(zscore_rank = rank(-zscore, ties.method = "min"),
114
+ enrichment_rank = rank(log_poisson_pval, ties.method = "min")) %>%
115
+ ungroup()
116
+
117
+ rr_25_summary = comp_df_ranked_by_binding %>%
118
+ group_by(regulator_locus_tag) %>%
119
+ reframe(
120
+ zscore_rr_25 = sum(responsive[zscore_rank <= 25]),
121
+ zscore_n = length(responsive[zscore_rank <= 25]),
122
+ enrichment_rr_25 = sum(responsive[enrichment_rank <= 25]),
123
+ enrichment_n = length(responsive[enrichment_rank <= 25])) %>%
124
+ pivot_longer(-regulator_locus_tag)