Datasets:
major update to dto results across most of the binding/perturbation datasets
Browse files- .gitignore +1 -0
- dto/{binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=Hackett_2020-hackett_2020 → binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hackett_2020-hackett_2020}/part-0.parquet +2 -2
- dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet +2 -2
- dto/binding_repo_dataset=callingcards-annotated_features/{perturbation_repo_dataset=Hackett_2020-hackett_2020 → perturbation_repo_dataset=hughes_2006-knockout}/part-0.parquet +2 -2
- dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet +2 -2
- dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet +3 -0
- dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet +3 -0
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet +3 -0
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet +2 -2
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet +3 -0
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet +3 -0
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet +2 -2
- dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet +3 -0
- dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet +3 -0
- dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet +3 -0
- scripts/dto_preparation.R +62 -216
- scripts/parse_dto_results.R +147 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
deprecated/
|
dto/{binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=Hackett_2020-hackett_2020 → binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hackett_2020-hackett_2020}/part-0.parquet
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7547978ed87b84515aa1219caffd971328bf04b10da4235b55edfb4b8aca14ff
|
| 3 |
+
size 84613
|
dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a130ba45decf17b498d11fa76a3c88c230db4a77c78c90b5b9678d268ae9c48
|
| 3 |
+
size 26096
|
dto/binding_repo_dataset=callingcards-annotated_features/{perturbation_repo_dataset=Hackett_2020-hackett_2020 → perturbation_repo_dataset=hughes_2006-knockout}/part-0.parquet
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0897b010c5f334598d6ab4b3bd8b378cc7310b2152f5b12370078787c8937600
|
| 3 |
+
size 8374
|
dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:18c3251b1f8a29fb61b0ff12c2a43c2741c00f7a6350ca51bd6a293036006c54
|
| 3 |
+
size 8684
|
dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7a016cf8f8fb04515ba0aaadd873de1d84817d75667f2347c149d03b9eb5ded9
|
| 3 |
+
size 26674
|
dto/binding_repo_dataset=callingcards-annotated_features/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8135d4fb8b264b7663d817e42588e818eec10598c43245f412fd396d39060cdc
|
| 3 |
+
size 19407
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9fab65e2d65fdee831fdbae55a40b7d55380e5408ff908dfb8563ca5f14cdf5f
|
| 3 |
+
size 15008
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9617d3b34299cd81da145e2b89f6660a0058882e3eb07a59a4443ed745345fc4
|
| 3 |
+
size 6986
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de8764393eec10bf46d4c131b59018e75dd934ad12681ac5aa00d3ae4dc3ccb8
|
| 3 |
+
size 4379
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42e313ee5338b60024c90c66331d396362e20d34edaf302c37e4adb3cbfe42bf
|
| 3 |
+
size 4466
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f1a76ad1e92ec73deb0c5843c5bc93a8cf3182e695dc48db1c3991015a2b36e
|
| 3 |
+
size 7086
|
dto/binding_repo_dataset=callingcards-annotated_features_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d90de41ab5c5484499201bbbcba963ea925305431adbadf6b4e8d6ae8ffd2339
|
| 3 |
+
size 6261
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2df3500001e3acecc09f6b709e45b1a81829567e39462a523ee30e6b5eae8087
|
| 3 |
+
size 40383
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb159390c67714929dd268f3cb5e37c78bad83cf4a622593fbf486c406cf49f0
|
| 3 |
+
size 16566
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89afa67b6af14377592fac443bf35719bed684080daaef5ef33f6d9af716e460
|
| 3 |
+
size 6376
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95ca56abd4a3d1d1c50f87443d79c0c287bd5959c9398bd40ea64cddbd93eaa8
|
| 3 |
+
size 6486
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:82a9d1441b6d0f29420f8333727134d04a6f16bc68c67cad8eb12b153580e823
|
| 3 |
+
size 15706
|
dto/binding_repo_dataset=harbison_2004-harbison_2004/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26eb8f4b28b96be4c7294130c389ad88b79ce9595021502cae8dddb8a3d45f48
|
| 3 |
+
size 12118
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bbc9c134e85010143410be28ef708d8ea94294fe2db229e389398a23c7ea55e3
|
| 3 |
+
size 27012
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1038f3ce2856fabfbfaefa73870919705a9183f680ac0adb77446fbf12b6cc36
|
| 3 |
+
size 9709
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24762488202537dd69c14a648ac2f1441805e14b3c498bb78032cd61997a7942
|
| 3 |
+
size 5574
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7d6f88c49bdc6d670abe31126d5598c0bc3751b98b5c5bacb633084c07126832
|
| 3 |
+
size 5670
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7a69b77c5eccbedb5c2d6123b6104c991d3ab9a75f1fab66213d89f1dd27789e
|
| 3 |
+
size 9865
|
dto/binding_repo_dataset=mahendrawada_2025-chec_mahendrawada_m2025_af_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d20a2924544221ece962714764b7dc72c55292bebe14749083dab7f6f2767f1
|
| 3 |
+
size 8994
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hackett_2020-hackett_2020/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c75df40039e4860551147dc05a2b3eb1914ae93371f15e3f8404db461237272c
|
| 3 |
+
size 29922
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hu_2007_reimand_2010-hu_2007_reimand_2010/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:590f72b994b06366d9e335692277bf73f8ba4d2029d4163fb0c0abb8a19c4b37
|
| 3 |
+
size 12390
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hughes_2006-knockout/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d86df764dfaa224d55313d64b5b11137fcef422d12ca6fe39bb8d34f929613ba
|
| 3 |
+
size 4865
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=hughes_2006-overexpression/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c17630324930af99b5284393ac41306f7574277137ceec5e5909616d015293e5
|
| 3 |
+
size 5134
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=kemmeren_2014-kemmeren_2014/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f0ec73f2508a380dde4671dafe7f02630c524f1d443c8444530b51e00e22762
|
| 3 |
+
size 23099
|
dto/binding_repo_dataset=rossi_2021-rossi_2021_af_combined/perturbation_repo_dataset=mahendrawada_2025-rnaseq_reprocessed/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4dbcf439877a4e64733ba477c5e72c0e4e2e918849de478a4c442efdafe415d
|
| 3 |
+
size 8062
|
scripts/dto_preparation.R
CHANGED
|
@@ -88,100 +88,26 @@ single_cc = arrow::open_dataset("~/code/hf/callingcards/annotated_features") %>%
|
|
| 88 |
left_join(single_cc_meta) %>%
|
| 89 |
mutate(id = as.character(id))
|
| 90 |
|
|
|
|
|
|
|
| 91 |
binding_data = list(
|
| 92 |
cc = single_cc %>%
|
| 93 |
select(intersect(colnames(.), colnames(composite_cc))) %>%
|
| 94 |
bind_rows(composite_cc %>%
|
| 95 |
-
select(intersect(colnames(.), colnames(single_cc))))
|
|
|
|
| 96 |
harbison = arrow::read_parquet("~/code/hf/harbison_2004/harbison_2004.parquet") %>%
|
| 97 |
replace_na(list(effect = 0, pvalue = 1)) %>%
|
| 98 |
group_by(sample_id, target_locus_tag) %>%
|
| 99 |
slice_max(abs(effect), n = 1, with_ties = FALSE) %>%
|
| 100 |
-
ungroup()
|
|
|
|
| 101 |
chipexo = arrow::read_parquet("~/code/hf/rossi_2021/rossi_2021_af_combined.parquet") %>%
|
| 102 |
-
left_join(arrow::read_parquet("~/code/hf/rossi_2021/rossi_2021_metadata_sample.parquet"))
|
|
|
|
| 103 |
mahendrawada_chec = arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined.parquet") %>%
|
| 104 |
-
left_join(arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined_meta.parquet"))
|
| 105 |
-
)
|
| 106 |
-
|
| 107 |
-
mahendrawada_rnaseq_dto_background = map(binding_data, ~{
|
| 108 |
-
.x %>%
|
| 109 |
-
ungroup() %>%
|
| 110 |
-
select(target_locus_tag) %>%
|
| 111 |
-
distinct() %>%
|
| 112 |
-
filter(target_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$target_locus_tag))
|
| 113 |
-
})
|
| 114 |
-
|
| 115 |
-
mahendrawada_rnaseq_dto = list(
|
| 116 |
-
cc = list(
|
| 117 |
-
binding = binding_data$cc %>%
|
| 118 |
-
filter(poisson_pval <= 0.1) %>%
|
| 119 |
-
filter(regulator_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$regulator_locus_tag),
|
| 120 |
-
target_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$target_locus_tag)) %>%
|
| 121 |
-
group_by(id) %>%
|
| 122 |
-
arrange(desc(callingcards_enrichment)) %>%
|
| 123 |
-
mutate(pvalue_rank = rank(poisson_pval, ties.method = 'min')) %>%
|
| 124 |
-
dplyr::rename(sample_id = id) %>%
|
| 125 |
-
group_by(sample_id),
|
| 126 |
-
pr = perturbation_response_data$mahendrawada_rnaseq %>%
|
| 127 |
-
filter(pvalue <= 0.1) %>%
|
| 128 |
-
filter(regulator_locus_tag %in% unique(binding_data$cc$regulator_locus_tag),
|
| 129 |
-
target_locus_tag %in% unique(binding_data$cc$target_locus_tag)) %>%
|
| 130 |
-
group_by(sample_id) %>%
|
| 131 |
-
mutate(abs_log2fc_rank = rank(-abs_log2fc, ties.method = 'min'),
|
| 132 |
-
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 133 |
-
group_by(sample_id)),
|
| 134 |
-
harbison = list(
|
| 135 |
-
binding = binding_data$harbison %>%
|
| 136 |
-
filter(pvalue <= 0.1) %>%
|
| 137 |
-
filter(regulator_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$regulator_locus_tag),
|
| 138 |
-
target_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$target_locus_tag)) %>%
|
| 139 |
-
group_by(sample_id) %>%
|
| 140 |
-
arrange(desc(effect)) %>%
|
| 141 |
-
mutate(pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 142 |
-
group_by(sample_id),
|
| 143 |
-
pr = perturbation_response_data$mahendrawada_rnaseq %>%
|
| 144 |
-
filter(pvalue <= 0.1) %>%
|
| 145 |
-
filter(regulator_locus_tag %in% unique(binding_data$harbison$regulator_locus_tag),
|
| 146 |
-
target_locus_tag %in% unique(binding_data$harbison$target_locus_tag)) %>%
|
| 147 |
-
group_by(sample_id) %>%
|
| 148 |
-
mutate(abs_log2fc_rank = rank(-abs_log2fc, ties.method = 'min'),
|
| 149 |
-
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 150 |
-
group_by(sample_id)),
|
| 151 |
-
chipexo = list(
|
| 152 |
-
binding = binding_data$chipexo %>%
|
| 153 |
-
filter(log_poisson_pval <= log(0.1)) %>%
|
| 154 |
-
filter(regulator_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$regulator_locus_tag),
|
| 155 |
-
target_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$target_locus_tag)) %>%
|
| 156 |
-
group_by(sample_id) %>%
|
| 157 |
-
arrange(desc(enrichment)) %>%
|
| 158 |
-
mutate(pvalue_rank = rank(log_poisson_pval, ties.method = 'min')) %>%
|
| 159 |
-
group_by(sample_id),
|
| 160 |
-
pr = perturbation_response_data$mahendrawada_rnaseq %>%
|
| 161 |
-
filter(pvalue <= 0.1) %>%
|
| 162 |
-
filter(regulator_locus_tag %in% unique(binding_data$chipexo$regulator_locus_tag),
|
| 163 |
-
target_locus_tag %in% unique(binding_data$chipexo$target_locus_tag)) %>%
|
| 164 |
-
group_by(sample_id) %>%
|
| 165 |
-
mutate(abs_log2fc_rank = rank(-abs_log2fc, ties.method = 'min'),
|
| 166 |
-
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 167 |
-
group_by(sample_id)),
|
| 168 |
-
mahendrawada_chec = list(
|
| 169 |
-
binding = binding_data$mahendrawada_chec %>%
|
| 170 |
-
filter(log_poisson_pval <= log(0.1)) %>%
|
| 171 |
-
filter(regulator_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$regulator_locus_tag),
|
| 172 |
-
target_locus_tag %in% unique(perturbation_response_data$mahendrawada_rnaseq$target_locus_tag)) %>%
|
| 173 |
-
group_by(sample_id) %>%
|
| 174 |
-
arrange(desc(enrichment)) %>%
|
| 175 |
-
mutate(pvalue_rank = rank(log_poisson_pval, ties.method = 'min')) %>%
|
| 176 |
-
group_by(sample_id),
|
| 177 |
-
pr = perturbation_response_data$mahendrawada_rnaseq %>%
|
| 178 |
-
filter(pvalue <= 0.1) %>%
|
| 179 |
-
filter(regulator_locus_tag %in% unique(binding_data$mahendrawada_chec$regulator_locus_tag),
|
| 180 |
-
target_locus_tag %in% unique(binding_data$mahendrawada_chec$target_locus_tag)) %>%
|
| 181 |
-
group_by(sample_id) %>%
|
| 182 |
-
mutate(abs_log2fc_rank = rank(-abs_log2fc, ties.method = 'min'),
|
| 183 |
-
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 184 |
-
group_by(sample_id))
|
| 185 |
)
|
| 186 |
|
| 187 |
# Function to create DTO for a given PR dataset
|
|
@@ -232,7 +158,12 @@ create_pr_dto = function(pr_data, pr_effect_col, pr_pval_col, binding_data_list)
|
|
| 232 |
group_by(sample_id) %>%
|
| 233 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 234 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 235 |
-
group_by(sample_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
| 237 |
harbison = list(
|
| 238 |
binding = binding_data_list$harbison %>%
|
|
@@ -251,7 +182,12 @@ create_pr_dto = function(pr_data, pr_effect_col, pr_pval_col, binding_data_list)
|
|
| 251 |
group_by(sample_id) %>%
|
| 252 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 253 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 254 |
-
group_by(sample_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
chipexo = list(
|
| 257 |
binding = binding_data_list$chipexo %>%
|
|
@@ -270,7 +206,12 @@ create_pr_dto = function(pr_data, pr_effect_col, pr_pval_col, binding_data_list)
|
|
| 270 |
group_by(sample_id) %>%
|
| 271 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 272 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 273 |
-
group_by(sample_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
mahendrawada_chec = list(
|
| 276 |
binding = binding_data_list$mahendrawada_chec %>%
|
|
@@ -289,7 +230,12 @@ create_pr_dto = function(pr_data, pr_effect_col, pr_pval_col, binding_data_list)
|
|
| 289 |
group_by(sample_id) %>%
|
| 290 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 291 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 292 |
-
group_by(sample_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
)
|
| 294 |
|
| 295 |
return(dto_list)
|
|
@@ -341,7 +287,7 @@ all_pr_dtos = list(
|
|
| 341 |
)
|
| 342 |
|
| 343 |
# Write out DTO ranked lists
|
| 344 |
-
|
| 345 |
write_out_pr_dto_lists = function(pr_dataset_name,
|
| 346 |
binding_pr_set_name,
|
| 347 |
all_pr_dtos_list,
|
|
@@ -393,16 +339,9 @@ write_out_pr_dto_lists = function(pr_dataset_name,
|
|
| 393 |
write_csv(file.path(curr_output_path$pr_pvalue, paste0(.x, ".csv")),
|
| 394 |
col_names = FALSE)
|
| 395 |
})
|
| 396 |
-
}
|
| 397 |
|
| 398 |
-
#
|
| 399 |
-
|
| 400 |
-
binding_pr_set_name,
|
| 401 |
-
background_list,
|
| 402 |
-
base_outdir = here("results/dto")) {
|
| 403 |
-
output_path = file.path(base_outdir, pr_dataset_name)
|
| 404 |
-
|
| 405 |
-
background_list[[binding_pr_set_name]] %>%
|
| 406 |
write_csv(file.path(output_path, binding_pr_set_name, "background.csv"),
|
| 407 |
col_names = FALSE)
|
| 408 |
}
|
|
@@ -464,44 +403,32 @@ create_pr_lookups = function(pr_dataset_name, binding_pr_set_name,
|
|
| 464 |
incomplete_after_filtering = incomplete_after_filtering
|
| 465 |
))
|
| 466 |
}
|
| 467 |
-
# Create background lists for all PR datasets (if not already created)
|
| 468 |
-
all_pr_backgrounds = map(names(all_pr_dtos), ~{
|
| 469 |
-
map(binding_data, function(bd) {
|
| 470 |
-
bd %>%
|
| 471 |
-
ungroup() %>%
|
| 472 |
-
select(target_locus_tag) %>%
|
| 473 |
-
distinct() %>%
|
| 474 |
-
filter(target_locus_tag %in% unique(all_pr_dtos[[.x]][[1]]$pr$target_locus_tag))
|
| 475 |
-
})
|
| 476 |
-
})
|
| 477 |
-
names(all_pr_backgrounds) = names(all_pr_dtos)
|
| 478 |
-
|
| 479 |
-
# Write out all DTOs for all PR datasets
|
| 480 |
-
lookup_results = list()
|
| 481 |
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
}
|
|
|
|
|
|
|
| 505 |
|
| 506 |
# Summary of incomplete cases across all datasets
|
| 507 |
incomplete_summary = map_dfr(names(lookup_results), ~{
|
|
@@ -512,84 +439,3 @@ incomplete_summary = map_dfr(names(lookup_results), ~{
|
|
| 512 |
})
|
| 513 |
|
| 514 |
print(incomplete_summary %>% count(pr_dataset, binding_dataset, missing_type))
|
| 515 |
-
|
| 516 |
-
dto_results_path_list = list.files(base_outdir,
|
| 517 |
-
"*.json",
|
| 518 |
-
recursive = TRUE)
|
| 519 |
-
|
| 520 |
-
## Parse the results -- note that this needs to be adjusted for the
|
| 521 |
-
## expanded set of perturbation response
|
| 522 |
-
|
| 523 |
-
dto_results_frames_list = map(file.path(base_outdir, dto_results_path_list),
|
| 524 |
-
~as_tibble(jsonlite::read_json(.x)))
|
| 525 |
-
names(dto_results_frames_list) = dto_results_path_list
|
| 526 |
-
dto_results_frame = bind_rows(dto_results_frames_list, .id = 'path')
|
| 527 |
-
|
| 528 |
-
curr_dto_res = arrow::open_dataset("~/code/hf/yeast_comparative_analysis/dto") %>%
|
| 529 |
-
collect()
|
| 530 |
-
|
| 531 |
-
results_df = tibble(
|
| 532 |
-
combined_id = str_remove(basename(dto_results_list), ".json"),
|
| 533 |
-
binding_source = dirname(dirname(dirname(dirname(dto_results_list)))),
|
| 534 |
-
pr_scoring = basename(dirname(dto_results_list)),
|
| 535 |
-
path = dto_results_path_list) %>%
|
| 536 |
-
separate_wider_delim(combined_id,
|
| 537 |
-
names = c('binding_sampleid', 'pr_sampleid'),
|
| 538 |
-
delim = '-_-') %>%
|
| 539 |
-
left_join(dto_results_frame) %>%
|
| 540 |
-
select(-path) %>%
|
| 541 |
-
mutate(
|
| 542 |
-
binding_id = case_when(
|
| 543 |
-
binding_source == "cc" & str_detect(binding_sampleid, "-")
|
| 544 |
-
~ paste0("BrentLab/callingcards;annotated_features_combined",
|
| 545 |
-
binding_sampleid),
|
| 546 |
-
binding_source == "cc" & str_detect(binding_sampleid, "-", negate=TRUE)
|
| 547 |
-
~ paste0("BrentLab/callingcards;annotated_features",
|
| 548 |
-
binding_sampleid),
|
| 549 |
-
binding_source == "chipexo"
|
| 550 |
-
~ paste0("BrentLab/rossi_2021;rossi_2021_af_combined",
|
| 551 |
-
binding_sampleid),
|
| 552 |
-
binding_source == "harbison"
|
| 553 |
-
~ paste0("BrentLab/harbison_2004;harbison_2004",
|
| 554 |
-
binding_sampleid),
|
| 555 |
-
binding_source == "mahendrawada_chec"
|
| 556 |
-
~ paste0("BrentLab/mahendrawada_2025;chec_mahendrawada_m2025_af_combined",
|
| 557 |
-
binding_sampleid)),
|
| 558 |
-
perturbation_id = paste0("BrentLab/mahendrawada_2025/rnaseq_reprocessed", pr_sampleid),
|
| 559 |
-
binding_repo_dataset = case_when(
|
| 560 |
-
binding_source == "cc" & str_detect(binding_sampleid, "-")
|
| 561 |
-
~ "callingcards-annotated_features_combined",
|
| 562 |
-
binding_source == "cc" & str_detect(binding_sampleid, "-", negate=TRUE)
|
| 563 |
-
~ "callingcards-annotated_features",
|
| 564 |
-
binding_source == "chipexo"
|
| 565 |
-
~ "rossi_2021-rossi_2021_af_combined",
|
| 566 |
-
binding_source == "harbison"
|
| 567 |
-
~ paste0("harbison_2004-harbison_2004"),
|
| 568 |
-
binding_source == "mahendrawada_chec"
|
| 569 |
-
~ "mahendrawada_2025-chec_mahendrawada_m2025_af_combined"),
|
| 570 |
-
perturbation_repo_dataset = "mahendrawada_2025-rnaseq_reprocessed") %>%
|
| 571 |
-
dplyr::rename(binding_rank_threshold = rank1,
|
| 572 |
-
perturbation_rank_threshold = rank2,
|
| 573 |
-
binding_set_size = set1_len,
|
| 574 |
-
perturbation_set_size = set2_len,
|
| 575 |
-
dto_fdr = fdr,
|
| 576 |
-
dto_empirical_pvalue = empirical_pvalue) %>%
|
| 577 |
-
select(binding_id, perturbation_id,
|
| 578 |
-
binding_rank_threshold, perturbation_rank_threshold,
|
| 579 |
-
binding_set_size, perturbation_set_size,
|
| 580 |
-
dto_fdr, dto_empirical_pvalue,
|
| 581 |
-
binding_repo_dataset, perturbation_repo_dataset)
|
| 582 |
-
|
| 583 |
-
# arrow::write_dataset(
|
| 584 |
-
# results_df,
|
| 585 |
-
# path = "/home/chase/code/hf/yeast_comparative_analysis/dto",
|
| 586 |
-
# format = "parquet",
|
| 587 |
-
# partitioning = c("binding_repo_dataset", "perturbation_repo_dataset"),
|
| 588 |
-
# existing_data_behavior = "overwrite",
|
| 589 |
-
# compression = "zstd",
|
| 590 |
-
# write_statistics = TRUE,
|
| 591 |
-
# use_dictionary = c(
|
| 592 |
-
# binding_id = TRUE,
|
| 593 |
-
# perturbation_id = TRUE
|
| 594 |
-
# )
|
| 595 |
-
# )
|
|
|
|
| 88 |
left_join(single_cc_meta) %>%
|
| 89 |
mutate(id = as.character(id))
|
| 90 |
|
| 91 |
+
# note: filter these for the mahendrawada features, too. Restricts analysis
|
| 92 |
+
# to only non dubious genomic loci
|
| 93 |
binding_data = list(
|
| 94 |
cc = single_cc %>%
|
| 95 |
select(intersect(colnames(.), colnames(composite_cc))) %>%
|
| 96 |
bind_rows(composite_cc %>%
|
| 97 |
+
select(intersect(colnames(.), colnames(single_cc)))) %>%
|
| 98 |
+
filter(target_locus_tag %in% mahendrawada_features$locus_tag),
|
| 99 |
harbison = arrow::read_parquet("~/code/hf/harbison_2004/harbison_2004.parquet") %>%
|
| 100 |
replace_na(list(effect = 0, pvalue = 1)) %>%
|
| 101 |
group_by(sample_id, target_locus_tag) %>%
|
| 102 |
slice_max(abs(effect), n = 1, with_ties = FALSE) %>%
|
| 103 |
+
ungroup() %>%
|
| 104 |
+
filter(target_locus_tag %in% mahendrawada_features$locus_tag),
|
| 105 |
chipexo = arrow::read_parquet("~/code/hf/rossi_2021/rossi_2021_af_combined.parquet") %>%
|
| 106 |
+
left_join(arrow::read_parquet("~/code/hf/rossi_2021/rossi_2021_metadata_sample.parquet")) %>%
|
| 107 |
+
filter(target_locus_tag %in% mahendrawada_features$locus_tag),
|
| 108 |
mahendrawada_chec = arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined.parquet") %>%
|
| 109 |
+
left_join(arrow::read_parquet("~/code/hf/mahendrawada_2025/chec_mahendrawada_m2025_af_combined_meta.parquet")) %>%
|
| 110 |
+
filter(target_locus_tag %in% mahendrawada_features$locus_tag)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
)
|
| 112 |
|
| 113 |
# Function to create DTO for a given PR dataset
|
|
|
|
| 158 |
group_by(sample_id) %>%
|
| 159 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 160 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 161 |
+
group_by(sample_id),
|
| 162 |
+
background = pr_standardized %>%
|
| 163 |
+
filter(regulator_locus_tag %in% unique(binding_data_list$cc$regulator_locus_tag),
|
| 164 |
+
target_locus_tag %in% unique(binding_data_list$cc$target_locus_tag)) %>%
|
| 165 |
+
pull(target_locus_tag) %>%
|
| 166 |
+
unique()),
|
| 167 |
|
| 168 |
harbison = list(
|
| 169 |
binding = binding_data_list$harbison %>%
|
|
|
|
| 182 |
group_by(sample_id) %>%
|
| 183 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 184 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 185 |
+
group_by(sample_id),
|
| 186 |
+
background = pr_standardized %>%
|
| 187 |
+
filter(regulator_locus_tag %in% unique(binding_data_list$harbison$regulator_locus_tag),
|
| 188 |
+
target_locus_tag %in% unique(binding_data_list$harbison$target_locus_tag)) %>%
|
| 189 |
+
pull(target_locus_tag) %>%
|
| 190 |
+
unique()),
|
| 191 |
|
| 192 |
chipexo = list(
|
| 193 |
binding = binding_data_list$chipexo %>%
|
|
|
|
| 206 |
group_by(sample_id) %>%
|
| 207 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 208 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 209 |
+
group_by(sample_id),
|
| 210 |
+
background = pr_standardized %>%
|
| 211 |
+
filter(regulator_locus_tag %in% unique(binding_data_list$chipexo$regulator_locus_tag),
|
| 212 |
+
target_locus_tag %in% unique(binding_data_list$chipexo$target_locus_tag)) %>%
|
| 213 |
+
pull(target_locus_tag) %>%
|
| 214 |
+
unique()),
|
| 215 |
|
| 216 |
mahendrawada_chec = list(
|
| 217 |
binding = binding_data_list$mahendrawada_chec %>%
|
|
|
|
| 230 |
group_by(sample_id) %>%
|
| 231 |
mutate(abs_effect_rank = rank(-abs(effect), ties.method = 'min'),
|
| 232 |
pvalue_rank = rank(pvalue, ties.method = 'min')) %>%
|
| 233 |
+
group_by(sample_id),
|
| 234 |
+
background = pr_standardized %>%
|
| 235 |
+
filter(regulator_locus_tag %in% unique(binding_data_list$mahendrawada_chec$regulator_locus_tag),
|
| 236 |
+
target_locus_tag %in% unique(binding_data_list$mahendrawada_chec$target_locus_tag)) %>%
|
| 237 |
+
pull(target_locus_tag) %>%
|
| 238 |
+
unique())
|
| 239 |
)
|
| 240 |
|
| 241 |
return(dto_list)
|
|
|
|
| 287 |
)
|
| 288 |
|
| 289 |
# Write out DTO ranked lists
|
| 290 |
+
# Write out DTO ranked lists
|
| 291 |
write_out_pr_dto_lists = function(pr_dataset_name,
|
| 292 |
binding_pr_set_name,
|
| 293 |
all_pr_dtos_list,
|
|
|
|
| 339 |
write_csv(file.path(curr_output_path$pr_pvalue, paste0(.x, ".csv")),
|
| 340 |
col_names = FALSE)
|
| 341 |
})
|
|
|
|
| 342 |
|
| 343 |
+
# Write out background
|
| 344 |
+
tibble(target_locus_tag = binding_pr_set$background) %>%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
write_csv(file.path(output_path, binding_pr_set_name, "background.csv"),
|
| 346 |
col_names = FALSE)
|
| 347 |
}
|
|
|
|
| 403 |
incomplete_after_filtering = incomplete_after_filtering
|
| 404 |
))
|
| 405 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
|
| 407 |
+
# # Write out all DTOs for all PR datasets
|
| 408 |
+
# lookup_results = list()
|
| 409 |
+
#
|
| 410 |
+
# dto_input_outdir = here("results/dto")
|
| 411 |
+
# for (pr_name in names(all_pr_dtos)) {
|
| 412 |
+
# lookup_results[[pr_name]] = list()
|
| 413 |
+
#
|
| 414 |
+
# for (binding_name in names(all_pr_dtos[[pr_name]])) {
|
| 415 |
+
# write_out_pr_dto_lists(pr_name, binding_name, all_pr_dtos)
|
| 416 |
+
#
|
| 417 |
+
# lookup_result = create_pr_lookups(pr_name, binding_name, all_pr_dtos)
|
| 418 |
+
# lookup_results[[pr_name]][[binding_name]] = lookup_result
|
| 419 |
+
#
|
| 420 |
+
# # Write complete lookups only
|
| 421 |
+
# lookup_result$lookup %>%
|
| 422 |
+
# write_tsv(file.path(dto_input_outdir, pr_name, binding_name, "lookup.txt"),
|
| 423 |
+
# col_names = FALSE)
|
| 424 |
+
#
|
| 425 |
+
# # Write incomplete cases for reference
|
| 426 |
+
# if (nrow(lookup_result$incomplete_after_filtering) > 0) {
|
| 427 |
+
# lookup_result$incomplete_after_filtering %>%
|
| 428 |
+
# write_csv(file.path(dto_input_outdir, pr_name, binding_name, "incomplete.csv"))
|
| 429 |
+
# }
|
| 430 |
+
# }
|
| 431 |
+
# }
|
| 432 |
|
| 433 |
# Summary of incomplete cases across all datasets
|
| 434 |
incomplete_summary = map_dfr(names(lookup_results), ~{
|
|
|
|
| 439 |
})
|
| 440 |
|
| 441 |
print(incomplete_summary %>% count(pr_dataset, binding_dataset, missing_type))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/parse_dto_results.R
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(furrr)
|
| 3 |
+
library(here)
|
| 4 |
+
|
| 5 |
+
dto_results_lookup = expand_grid(
|
| 6 |
+
pr_source = c("hackett", "hughes_oe", "hughes_ko", "hu_reimand", "kemmeren", "mahendrawada_rnaseq"),
|
| 7 |
+
binding_source = c("cc", "chipexo", "harbison", "mahendrawada_chec"),
|
| 8 |
+
pr_ranking_column = c("log2fc", "pvalue")) %>%
|
| 9 |
+
mutate(
|
| 10 |
+
result_file = map(file.path(here("results/dto"),
|
| 11 |
+
pr_source,
|
| 12 |
+
binding_source, "results",
|
| 13 |
+
pr_ranking_column),
|
| 14 |
+
~list.files(.x, full.names = TRUE))) %>%
|
| 15 |
+
unnest(result_file) %>%
|
| 16 |
+
mutate(tmp = str_remove(basename(result_file), ".json")) %>%
|
| 17 |
+
separate_wider_delim(tmp,
|
| 18 |
+
names = c('binding_id', 'perturbation_id'),
|
| 19 |
+
delim = "-_-")
|
| 20 |
+
|
| 21 |
+
plan(multisession, workers = 20)
|
| 22 |
+
|
| 23 |
+
# Function with retry logic
|
| 24 |
+
read_json_with_retry = function(filepath, max_retries = 1) {
|
| 25 |
+
for (attempt in 1:max_retries) {
|
| 26 |
+
result = tryCatch({
|
| 27 |
+
pivot_wider(enframe(as_vector(jsonlite::read_json(filepath))))
|
| 28 |
+
}, error = function(e) {
|
| 29 |
+
if (attempt < max_retries) {
|
| 30 |
+
message(sprintf("Attempt %d/%d failed for %s: %s. Retrying...",
|
| 31 |
+
attempt, max_retries, filepath, e$message))
|
| 32 |
+
Sys.sleep(2^(attempt - 1)) # Exponential backoff: 1s, 2s, 4s, 8s, 16s
|
| 33 |
+
NULL
|
| 34 |
+
} else {
|
| 35 |
+
stop(sprintf("Failed after %d attempts for file: %s\nError: %s",
|
| 36 |
+
max_retries, filepath, e$message))
|
| 37 |
+
}
|
| 38 |
+
})
|
| 39 |
+
|
| 40 |
+
if (!is.null(result)) {
|
| 41 |
+
return(result)
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
dto_results_list = future_imap(dto_results_lookup$result_file, ~{
|
| 47 |
+
tryCatch({
|
| 48 |
+
# Check if file is empty
|
| 49 |
+
if (file.size(.x) == 0) {
|
| 50 |
+
return(tibble(
|
| 51 |
+
empirical_pvalue = NA_real_,
|
| 52 |
+
fdr = NA_real_,
|
| 53 |
+
population_size = NA_real_,
|
| 54 |
+
rank1 = NA_real_,
|
| 55 |
+
rank2 = NA_real_,
|
| 56 |
+
set1_len = NA_real_,
|
| 57 |
+
set2_len = NA_real_,
|
| 58 |
+
unpermuted_intersection_size = NA_real_,
|
| 59 |
+
unpermuted_pvalue = NA_real_
|
| 60 |
+
))
|
| 61 |
+
}
|
| 62 |
+
read_json_with_retry(.x)
|
| 63 |
+
}, error = function(e) {
|
| 64 |
+
stop(sprintf("Index %d failed:\nFile: %s\nError: %s",
|
| 65 |
+
.y, .x, e$message))
|
| 66 |
+
})
|
| 67 |
+
}, .progress = TRUE, .options = furrr_options(seed = TRUE))
|
| 68 |
+
|
| 69 |
+
dto_results_df = bind_cols(dto_results_lookup, bind_rows(dto_results_list))
|
| 70 |
+
|
| 71 |
+
hf_results_df = dto_results_df %>%
|
| 72 |
+
mutate(
|
| 73 |
+
binding_id = case_when(
|
| 74 |
+
binding_source == "cc" & str_detect(binding_id, "-")
|
| 75 |
+
~ paste0("BrentLab/callingcards;annotated_features_combined;",
|
| 76 |
+
binding_id),
|
| 77 |
+
binding_source == "cc" & str_detect(binding_id, "-", negate=TRUE)
|
| 78 |
+
~ paste0("BrentLab/callingcards;annotated_features;",
|
| 79 |
+
binding_id),
|
| 80 |
+
binding_source == "chipexo"
|
| 81 |
+
~ paste0("BrentLab/rossi_2021;rossi_2021_af_combined;",
|
| 82 |
+
binding_id),
|
| 83 |
+
binding_source == "harbison"
|
| 84 |
+
~ paste0("BrentLab/harbison_2004;harbison_2004;",
|
| 85 |
+
binding_id),
|
| 86 |
+
binding_source == "mahendrawada_chec"
|
| 87 |
+
~ paste0("BrentLab/mahendrawada_2025;chec_mahendrawada_m2025_af_combined;",
|
| 88 |
+
binding_id)),
|
| 89 |
+
perturbation_id = case_when(
|
| 90 |
+
pr_source == "hackett" ~ paste0("BrentLab/hackett_2020;hackett_2020;", perturbation_id),
|
| 91 |
+
pr_source == "hughes_oe" ~ paste0("BrentLab/hughes_2006;overexpression;", perturbation_id),
|
| 92 |
+
pr_source == "hughes_ko" ~ paste0("BrentLab/hughes_2006;knockout;", perturbation_id),
|
| 93 |
+
pr_source == "hu_reimand" ~ paste0("BrentLab/hu_2007_reimand_2010;hu_2007_reimand_2010;", perturbation_id),
|
| 94 |
+
pr_source == "kemmeren" ~ paste0("BrentLab/kemmeren_2014;kemmeren_2014;", perturbation_id),
|
| 95 |
+
pr_source == "mahendrawada_rnaseq" ~ paste0("BrentLab/mahendrawada_2025;rnaseq_reprocessed;", perturbation_id),
|
| 96 |
+
.default = "ERROR"),
|
| 97 |
+
binding_repo_dataset = case_when(
|
| 98 |
+
binding_source == "cc" & str_detect(binding_id, "-")
|
| 99 |
+
~ "callingcards-annotated_features_combined",
|
| 100 |
+
binding_source == "cc" & str_detect(binding_id, "-", negate=TRUE)
|
| 101 |
+
~ "callingcards-annotated_features",
|
| 102 |
+
binding_source == "chipexo"
|
| 103 |
+
~ "rossi_2021-rossi_2021_af_combined",
|
| 104 |
+
binding_source == "harbison"
|
| 105 |
+
~ paste0("harbison_2004-harbison_2004"),
|
| 106 |
+
binding_source == "mahendrawada_chec"
|
| 107 |
+
~ "mahendrawada_2025-chec_mahendrawada_m2025_af_combined"),
|
| 108 |
+
perturbation_repo_dataset = case_when(
|
| 109 |
+
pr_source == "hackett" ~ paste0("hackett_2020-hackett_2020"),
|
| 110 |
+
pr_source == "hughes_oe" ~ paste0("hughes_2006-overexpression"),
|
| 111 |
+
pr_source == "hughes_ko" ~ paste0("hughes_2006-knockout"),
|
| 112 |
+
pr_source == "hu_reimand" ~ paste0("hu_2007_reimand_2010-hu_2007_reimand_2010"),
|
| 113 |
+
pr_source == "kemmeren" ~ paste0("kemmeren_2014-kemmeren_2014"),
|
| 114 |
+
pr_source == "mahendrawada_rnaseq" ~ paste0("mahendrawada_2025-rnaseq_reprocessed"),
|
| 115 |
+
.default = "ERROR")) %>%
|
| 116 |
+
dplyr::rename(binding_rank_threshold = rank1,
|
| 117 |
+
perturbation_rank_threshold = rank2,
|
| 118 |
+
binding_set_size = set1_len,
|
| 119 |
+
perturbation_set_size = set2_len,
|
| 120 |
+
dto_fdr = fdr,
|
| 121 |
+
dto_empirical_pvalue = empirical_pvalue) %>%
|
| 122 |
+
select(binding_id, perturbation_id,
|
| 123 |
+
binding_rank_threshold, perturbation_rank_threshold,
|
| 124 |
+
binding_set_size, perturbation_set_size,
|
| 125 |
+
dto_fdr, dto_empirical_pvalue,
|
| 126 |
+
binding_repo_dataset, perturbation_repo_dataset)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
# note that the deprecated directory is ignored in yeast_comparative_analysis.
|
| 130 |
+
# this exists on my computer and could exist on yours, too, if you wanted to
|
| 131 |
+
# put old results in a subdir called deprecated that would be ignored by huggingface/git
|
| 132 |
+
# old_db_dto_res = arrow::open_dataset("~/code/hf/yeast_comparative_analysis/deprecated/dto") %>%
|
| 133 |
+
# collect()
|
| 134 |
+
|
| 135 |
+
# arrow::write_dataset(
|
| 136 |
+
# hf_results_df,
|
| 137 |
+
# path = "/home/chase/code/hf/yeast_comparative_analysis/dto",
|
| 138 |
+
# format = "parquet",
|
| 139 |
+
# partitioning = c("binding_repo_dataset", "perturbation_repo_dataset"),
|
| 140 |
+
# existing_data_behavior = "overwrite",
|
| 141 |
+
# compression = "zstd",
|
| 142 |
+
# write_statistics = TRUE,
|
| 143 |
+
# use_dictionary = c(
|
| 144 |
+
# binding_id = TRUE,
|
| 145 |
+
# perturbation_id = TRUE
|
| 146 |
+
# )
|
| 147 |
+
# )
|