knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning = FALSE,
fig.width = 11,
fig.height = 7,
dpi = 160
)
suppressPackageStartupMessages({
library(data.table)
library(ggplot2)
})
candidate_project_dirs <- unique(normalizePath(
c(getwd(), file.path(getwd(), ".."), file.path(getwd(), "..", "..")),
mustWork = FALSE
))
project_dir <- candidate_project_dirs[
file.exists(file.path(candidate_project_dirs, "AGENTS.md")) &
dir.exists(file.path(candidate_project_dirs, "compartments_phased"))
][1]
if (is.na(project_dir)) {
stop("Could not locate the ThreeD project root from ", getwd())
}
analysis_dir <- file.path(project_dir, "analysis", "tissue-DEGs-vs-compartments")
output_dir <- file.path(analysis_dir, "output")
table_dir <- file.path(output_dir, "tables")
fig_dir <- file.path(output_dir, "figures")
dir.create(table_dir, recursive = TRUE, showWarnings = FALSE)
dir.create(fig_dir, recursive = TRUE, showWarnings = FALSE)
knitr::opts_chunk$set(fig.path = file.path("output", "figures", ""))
Overview
This analysis asks whether genes that change expression between
tissues also change their local phased A/B compartment signal between
the same tissues. For each species and tissue pair, the report:
- estimates tissue log2 fold-change from RNA-seq counts using log2
CPM,
- assigns each annotated gene TSS to the phased compartment bin in
each Hi-C tissue,
- computes
delta_E1 in the same direction as the
expression contrast, and
- compares DEGs with compartment switches and continuous E1
shifts.
Positive log2FC means higher expression in the first
tissue of the contrast. Positive delta_E1 means the gene is
more A-like in that same tissue.
The local R installation used for this report does not include
edgeR, limma, or DESeq2, so the
DEG calls are a self-contained screening analysis based on log2 CPM,
Welch tests, BH FDR, and an absolute log2FC threshold. For
publication-grade DEG calls, the same join and enrichment workflow can
be rerun with the preferred count model.
Run analysis
TSS compartment
assignment
| Eluc |
Br |
Brain |
25532 |
24708 |
96.8 |
18355 |
6353 |
| Eluc |
Gi |
Gill |
25532 |
24870 |
97.4 |
17660 |
7210 |
| Eluc |
Li |
Liver |
25532 |
24647 |
96.5 |
17448 |
7199 |
| Omyk |
Br |
Brain |
47152 |
43674 |
92.6 |
25670 |
18004 |
| Omyk |
Gi |
Gill |
47152 |
44220 |
93.8 |
30388 |
13832 |
| Omyk |
Li |
Liver |
47152 |
43796 |
92.9 |
27302 |
16494 |
| Salp |
Br |
Brain |
53864 |
50462 |
93.7 |
29848 |
20614 |
| Salp |
Gi |
Gill |
53864 |
51241 |
95.1 |
33278 |
17963 |
| Salp |
Li |
Liver |
53864 |
51683 |
96.0 |
30636 |
21047 |
| Ssal |
Br |
Brain |
44413 |
42193 |
95.0 |
27320 |
14873 |
| Ssal |
Gi |
Gill |
44413 |
42406 |
95.5 |
28973 |
13433 |
| Ssal |
Li |
Liver |
44413 |
42510 |
95.7 |
27153 |
15357 |
| Tthy |
Br |
Brain |
54402 |
52367 |
96.3 |
33472 |
18895 |
| Tthy |
Li |
Liver |
54402 |
52819 |
97.1 |
32362 |
20457 |
| Upyg |
Br |
Brain |
24391 |
24074 |
98.7 |
17393 |
6681 |
| Upyg |
Gi |
Gill |
24391 |
24085 |
98.7 |
18457 |
5628 |
| Upyg |
Li |
Liver |
24391 |
24033 |
98.5 |
15000 |
9033 |
Per-comparison
summary
| Eluc |
Brain vs Gill |
19886 |
8114 |
1483 |
714 |
0.129 |
0 |
0.563 |
0.597 |
| Eluc |
Brain vs Liver |
18774 |
12710 |
1753 |
1237 |
0.081 |
0 |
0.695 |
0.725 |
| Eluc |
Gill vs Liver |
17689 |
12758 |
1338 |
983 |
0.279 |
0 |
0.558 |
0.576 |
| Omyk |
Brain vs Gill |
29044 |
11090 |
8466 |
3457 |
0.257 |
0 |
0.541 |
0.615 |
| Omyk |
Brain vs Liver |
26831 |
18901 |
7617 |
5370 |
0.250 |
0 |
0.490 |
0.505 |
| Omyk |
Gill vs Liver |
24894 |
15465 |
5082 |
3212 |
0.245 |
0 |
0.613 |
0.639 |
| Salp |
Brain vs Gill |
31910 |
12822 |
7841 |
3540 |
0.263 |
0 |
0.572 |
0.637 |
| Salp |
Brain vs Liver |
29855 |
19486 |
8296 |
5422 |
0.282 |
0 |
0.558 |
0.591 |
| Salp |
Gill vs Liver |
28694 |
19217 |
5223 |
3662 |
0.254 |
0 |
0.661 |
0.689 |
| Ssal |
Brain vs Gill |
31324 |
12570 |
4590 |
1977 |
0.198 |
0 |
0.547 |
0.606 |
| Ssal |
Brain vs Liver |
29234 |
20454 |
4824 |
3457 |
0.229 |
0 |
0.580 |
0.604 |
| Ssal |
Gill vs Liver |
27617 |
17461 |
4202 |
2819 |
0.228 |
0 |
0.670 |
0.706 |
| Tthy |
Brain vs Liver |
30735 |
21356 |
7254 |
5136 |
0.240 |
0 |
0.579 |
0.605 |
| Upyg |
Brain vs Gill |
19344 |
5780 |
2977 |
1046 |
0.292 |
0 |
0.547 |
0.628 |
| Upyg |
Brain vs Liver |
18838 |
12141 |
4397 |
2978 |
0.245 |
0 |
0.642 |
0.683 |
| Upyg |
Gill vs Liver |
17212 |
6167 |
3575 |
1409 |
0.169 |
0 |
0.714 |
0.779 |
DEG enrichment in
compartment changes
| Eluc |
Brain vs Gill |
compartment_switch |
714 |
7400 |
1.380 |
1.240 |
1.537 |
0.00e+00 |
| Eluc |
Brain vs Liver |
compartment_switch |
1237 |
11473 |
1.159 |
1.040 |
1.294 |
9.73e-03 |
| Eluc |
Gill vs Liver |
compartment_switch |
983 |
11775 |
1.076 |
0.947 |
1.224 |
3.05e-01 |
| Omyk |
Brain vs Gill |
compartment_switch |
3457 |
7633 |
1.170 |
1.111 |
1.233 |
0.00e+00 |
| Omyk |
Brain vs Liver |
compartment_switch |
5370 |
13531 |
1.004 |
0.947 |
1.064 |
9.06e-01 |
| Omyk |
Gill vs Liver |
compartment_switch |
3212 |
12253 |
1.060 |
0.994 |
1.130 |
9.51e-02 |
| Salp |
Brain vs Gill |
compartment_switch |
3540 |
9282 |
1.311 |
1.245 |
1.381 |
0.00e+00 |
| Salp |
Brain vs Liver |
compartment_switch |
5422 |
14064 |
1.005 |
0.953 |
1.061 |
9.06e-01 |
| Salp |
Gill vs Liver |
compartment_switch |
3662 |
15555 |
1.194 |
1.118 |
1.275 |
2.00e-07 |
| Ssal |
Brain vs Gill |
compartment_switch |
1977 |
10593 |
1.153 |
1.081 |
1.229 |
2.06e-05 |
| Ssal |
Brain vs Liver |
compartment_switch |
3457 |
16997 |
1.103 |
1.030 |
1.182 |
7.72e-03 |
| Ssal |
Gill vs Liver |
compartment_switch |
2819 |
14642 |
1.221 |
1.139 |
1.310 |
0.00e+00 |
| Tthy |
Brain vs Liver |
compartment_switch |
5136 |
16220 |
1.086 |
1.024 |
1.151 |
7.76e-03 |
| Upyg |
Brain vs Gill |
compartment_switch |
1046 |
4734 |
1.331 |
1.224 |
1.447 |
0.00e+00 |
| Upyg |
Brain vs Liver |
compartment_switch |
2978 |
9163 |
1.209 |
1.125 |
1.300 |
5.00e-07 |
| Upyg |
Gill vs Liver |
compartment_switch |
1409 |
4758 |
1.214 |
1.124 |
1.310 |
1.30e-06 |
| Eluc |
Brain vs Gill |
substantial_e1_shift |
1400 |
6714 |
0.877 |
0.814 |
0.945 |
6.13e-04 |
| Eluc |
Brain vs Liver |
substantial_e1_shift |
3358 |
9352 |
1.185 |
1.103 |
1.274 |
4.60e-06 |
| Eluc |
Gill vs Liver |
substantial_e1_shift |
1166 |
11592 |
1.293 |
1.141 |
1.467 |
5.30e-05 |
| Omyk |
Brain vs Gill |
substantial_e1_shift |
5623 |
5467 |
1.180 |
1.125 |
1.238 |
0.00e+00 |
| Omyk |
Brain vs Liver |
substantial_e1_shift |
9314 |
9587 |
1.016 |
0.963 |
1.071 |
5.65e-01 |
| Omyk |
Gill vs Liver |
substantial_e1_shift |
5243 |
10222 |
1.122 |
1.061 |
1.185 |
5.49e-05 |
| Salp |
Brain vs Gill |
substantial_e1_shift |
6631 |
6191 |
1.272 |
1.216 |
1.331 |
0.00e+00 |
| Salp |
Brain vs Liver |
substantial_e1_shift |
9958 |
9528 |
1.029 |
0.980 |
1.079 |
2.65e-01 |
| Salp |
Gill vs Liver |
substantial_e1_shift |
6689 |
12528 |
1.300 |
1.232 |
1.372 |
0.00e+00 |
| Ssal |
Brain vs Gill |
substantial_e1_shift |
3528 |
9042 |
1.168 |
1.110 |
1.230 |
0.00e+00 |
| Ssal |
Brain vs Liver |
substantial_e1_shift |
6302 |
14152 |
1.181 |
1.117 |
1.249 |
0.00e+00 |
| Ssal |
Gill vs Liver |
substantial_e1_shift |
5449 |
12012 |
1.219 |
1.154 |
1.287 |
0.00e+00 |
| Tthy |
Brain vs Liver |
substantial_e1_shift |
9235 |
12121 |
1.127 |
1.072 |
1.184 |
3.60e-06 |
| Upyg |
Brain vs Gill |
substantial_e1_shift |
2024 |
3756 |
1.378 |
1.290 |
1.472 |
0.00e+00 |
| Upyg |
Brain vs Liver |
substantial_e1_shift |
5528 |
6613 |
1.189 |
1.119 |
1.264 |
0.00e+00 |
| Upyg |
Gill vs Liver |
substantial_e1_shift |
3059 |
3108 |
1.055 |
0.991 |
1.123 |
1.09e-01 |
Top switching DEGs
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG42641 |
protein_coding |
Tth17A |
9476295 |
8.224822 |
0.0e+00 |
0.3141024 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG11614 |
protein_coding |
Tth04A |
44795920 |
8.557913 |
0.0e+00 |
0.6794915 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG36766 |
protein_coding |
Tth14B |
9154168 |
7.175756 |
0.0e+00 |
0.4895467 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00276700 |
protein_coding |
CM082150.1 |
12355146 |
-13.992504 |
1.0e-07 |
-0.4420114 |
B |
A |
A_to_B |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000044291 |
protein_coding |
10 |
26132329 |
11.007355 |
1.0e-07 |
0.2789533 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00292570 |
protein_coding |
CM082150.1 |
95685630 |
7.884446 |
1.0e-07 |
0.8267299 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00315420 |
protein_coding |
CM082151.1 |
35257637 |
-8.141164 |
3.0e-07 |
0.8598143 |
A |
B |
B_to_A |
FALSE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00090670 |
protein_coding |
CM082143.1 |
199453642 |
7.291744 |
3.0e-07 |
-0.1181660 |
B |
A |
A_to_B |
FALSE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00337970 |
protein_coding |
CM082152.1 |
30666967 |
6.641833 |
3.0e-07 |
0.9154507 |
A |
B |
B_to_A |
TRUE |
| Eluc |
Northern pike |
Br_vs_Gi |
Brain vs Gill |
ENSELUG00000000549 |
protein_coding |
18 |
6822530 |
-8.478306 |
3.0e-07 |
-0.4099491 |
B |
A |
A_to_B |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000001248 |
protein_coding |
6 |
20911997 |
-12.822903 |
4.0e-07 |
-0.1922760 |
B |
A |
A_to_B |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00019240 |
protein_coding |
CM082142.1 |
81537055 |
7.384034 |
4.0e-07 |
0.8400057 |
A |
B |
B_to_A |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000019887 |
protein_coding |
21 |
22213502 |
5.129634 |
4.0e-07 |
0.0915599 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00345310 |
protein_coding |
CM082152.1 |
74424721 |
6.827877 |
4.0e-07 |
0.8680957 |
A |
B |
B_to_A |
TRUE |
| Ssal |
Atlantic salmon |
Br_vs_Li |
Brain vs Liver |
ENSSSAG00000054284 |
protein_coding |
16 |
67666574 |
7.775331 |
5.0e-07 |
0.4637794 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00178580 |
protein_coding |
CM082146.1 |
90230173 |
-11.880528 |
5.0e-07 |
-0.6537743 |
B |
A |
A_to_B |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00014900 |
protein_coding |
CM082142.1 |
58604244 |
8.058629 |
6.0e-07 |
0.9799394 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00171850 |
protein_coding |
CM082146.1 |
47750082 |
7.986204 |
6.0e-07 |
0.1165670 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00339780 |
protein_coding |
CM082152.1 |
36883235 |
7.733816 |
6.0e-07 |
1.0754737 |
A |
B |
B_to_A |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000004967 |
protein_coding |
24 |
2440880 |
-11.495967 |
7.0e-07 |
-0.2061881 |
B |
A |
A_to_B |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00202470 |
protein_coding |
CM082147.1 |
46559136 |
10.158864 |
8.0e-07 |
0.4077312 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00288680 |
protein_coding |
CM082150.1 |
74112240 |
-7.585044 |
8.0e-07 |
-0.8442155 |
B |
A |
A_to_B |
TRUE |
| Omyk |
Rainbow trout |
Br_vs_Li |
Brain vs Liver |
ENSOMYG00000010547 |
protein_coding |
4 |
32121259 |
-15.075152 |
8.0e-07 |
-0.9591619 |
B |
A |
A_to_B |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000000601 |
protein_coding |
5 |
20412339 |
1.939153 |
9.0e-07 |
0.2746076 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG10618 |
protein_coding |
Tth04A |
8836087 |
10.177440 |
9.0e-07 |
0.4833653 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG33373 |
protein_coding |
Tth13A |
7606452 |
8.065871 |
9.0e-07 |
1.0963018 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG50461 |
protein_coding |
Tth21A |
17290994 |
7.909541 |
9.0e-07 |
0.7729369 |
A |
B |
B_to_A |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG07497 |
protein_coding |
Tth02B |
37987840 |
5.892684 |
9.0e-07 |
-0.4554161 |
B |
A |
A_to_B |
FALSE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG31104 |
protein_coding |
Tth12A |
19842321 |
5.071271 |
9.0e-07 |
0.5937725 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00194250 |
protein_coding |
CM082147.1 |
10282777 |
6.906729 |
9.0e-07 |
0.7069619 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00172280 |
protein_coding |
CM082146.1 |
50220679 |
-12.947361 |
9.0e-07 |
-0.5938696 |
B |
A |
A_to_B |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00008110 |
protein_coding |
CM082142.1 |
31337489 |
9.665362 |
9.0e-07 |
0.9506332 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00165140 |
protein_coding |
CM082146.1 |
22590412 |
7.320715 |
1.0e-06 |
0.5061200 |
A |
B |
B_to_A |
TRUE |
| Ssal |
Atlantic salmon |
Br_vs_Li |
Brain vs Liver |
ENSSSAG00000073185 |
protein_coding |
26 |
522265 |
-10.400282 |
1.0e-06 |
-0.5371263 |
B |
A |
A_to_B |
TRUE |
| Tthy |
Grayling |
Br_vs_Li |
Brain vs Liver |
EPG56135 |
protein_coding |
Tth24A |
4769891 |
11.344633 |
1.0e-06 |
0.0601409 |
A |
B |
B_to_A |
TRUE |
| Eluc |
Northern pike |
Gi_vs_Li |
Gill vs Liver |
ENSELUG00000024539 |
protein_coding |
4 |
13745081 |
7.382778 |
1.1e-06 |
0.3590370 |
A |
B |
B_to_A |
TRUE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00176370 |
protein_coding |
CM082146.1 |
69456380 |
6.892884 |
1.1e-06 |
0.2206265 |
A |
B |
B_to_A |
TRUE |
| Omyk |
Rainbow trout |
Br_vs_Li |
Brain vs Liver |
ENSOMYG00000010955 |
protein_coding |
21 |
31948778 |
8.237739 |
1.1e-06 |
-0.1844466 |
B |
A |
A_to_B |
FALSE |
| Omyk |
Rainbow trout |
Br_vs_Li |
Brain vs Liver |
ENSOMYG00000026529 |
protein_coding |
30 |
2688661 |
4.366607 |
1.1e-06 |
-0.4352345 |
B |
A |
A_to_B |
FALSE |
| Upyg |
Eastern mudminnow |
Br_vs_Li |
Brain vs Liver |
UPYG_G00178160 |
protein_coding |
CM082146.1 |
87793767 |
4.119068 |
1.1e-06 |
-0.1993745 |
B |
A |
A_to_B |
FALSE |
Output files
| output/tables/input_summary.tsv |
| output/tables/annotation_biotype_summary.tsv |
| output/tables/gene_tss_compartment_assignment_summary.tsv |
| output/tables/gene_tss_phased_compartment_assignments.tsv |
| output/tables/gene_level_tissue_DE_vs_compartments.tsv |
| output/tables/comparison_summary.tsv |
| output/tables/deg_enrichment_in_compartment_changes.tsv |
| output/tables/transition_summary.tsv |
| output/tables/chromosome_spearman_summary.tsv |
| output/tables/top_switching_degs.tsv |
| output/figures/delta_E1_vs_log2FC_bin2d.png |
| output/figures/spearman_delta_E1_log2FC_heatmap.png |
| output/figures/chromosome_spearman_rho.png |
| output/figures/log2FC_by_compartment_transition.png |
| output/figures/deg_enrichment_compartment_switches.png |