Context dependent DNA methylation :: miRNA regulation of gene expression

Contra
e5
coral
Author
Affiliation

Steven Roberts

Published

December 1, 2025

Read in Cross-Species Methylation miRNA Comparison Data

# Read CSV from remote URL
biomin_data <- read_csv("https://gannet.fish.washington.edu/v1_web/owlshell/bu-github/ConTra/output/biomin_comparison_20251130_052506/cross_species_methylation_mirna_comparison.csv")
Rows: 611 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (1): og_id
dbl (11): n_species, apul_context_strength, apul_improvement, apul_r2, peve_...
lgl  (3): apul_context_dependent, peve_context_dependent, ptua_context_depen...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Display structure of the data
glimpse(biomin_data)
Rows: 611
Columns: 15
$ og_id                  <chr> "OG_01155", "OG_02619", "OG_06119", "OG_08793",…
$ n_species              <dbl> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,…
$ apul_context_strength  <dbl> 1.5210053, 1.4686122, 0.9717545, 0.8087638, 0.9…
$ apul_context_dependent <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE…
$ apul_improvement       <dbl> 4.542280e-02, 4.080240e-04, 6.730879e-03, 7.044…
$ apul_r2                <dbl> 0.5495437, 0.5965734, 0.5632711, 0.6156382, 0.5…
$ peve_context_strength  <dbl> 0.9962671, 1.0244916, 1.2526347, 1.4507635, 1.1…
$ peve_context_dependent <lgl> FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE,…
$ peve_improvement       <dbl> 2.785907e-02, 4.279548e-02, 6.041180e-02, 3.231…
$ peve_r2                <dbl> 0.5239709, 0.4887706, 0.7519803, 0.5892956, 0.6…
$ ptua_context_strength  <dbl> 1.4149060, 1.3928000, 1.4860590, 1.4495109, 1.4…
$ ptua_context_dependent <lgl> FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, F…
$ ptua_improvement       <dbl> 3.367814e-02, 6.301667e-02, 1.140166e-01, 4.800…
$ ptua_r2                <dbl> 0.5576365, 0.4958976, 0.5536735, 0.6081574, 0.4…
$ mean_context_strength  <dbl> 1.310726, 1.295301, 1.236816, 1.236346, 1.19955…
# View column names to identify context dependent columns
colnames(biomin_data)
 [1] "og_id"                  "n_species"              "apul_context_strength" 
 [4] "apul_context_dependent" "apul_improvement"       "apul_r2"               
 [7] "peve_context_strength"  "peve_context_dependent" "peve_improvement"      
[10] "peve_r2"                "ptua_context_strength"  "ptua_context_dependent"
[13] "ptua_improvement"       "ptua_r2"                "mean_context_strength" 

Summary of Context Dependent Groups

# Identify columns that contain "context" in their name (case insensitive)
context_cols <- grep("context", names(biomin_data), ignore.case = TRUE, value = TRUE)
cat("Context-related columns found:\n")
Context-related columns found:
print(context_cols)
[1] "apul_context_strength"  "apul_context_dependent" "peve_context_strength" 
[4] "peve_context_dependent" "ptua_context_strength"  "ptua_context_dependent"
[7] "mean_context_strength" 
# Filter for rows where any context dependent column is TRUE
# First, let's see unique values in context columns
if (length(context_cols) > 0) {
  for (col in context_cols) {
    cat("\nUnique values in", col, ":\n")
    print(unique(biomin_data[[col]]))
  }
}

Unique values in apul_context_strength :
  [1] 1.5210053 1.4686122 0.9717545 0.8087638 0.9392760 1.1867517 1.1661343
  [8] 1.5266324 0.9790248 1.6806886 1.1407917 0.9352201 1.0162652 1.0759084
 [15] 1.0906613 0.7956819 1.2331926 1.0647917 1.3480270 1.0065100 0.6788373
 [22] 1.7699775 0.9817814 0.6953154 0.9697093 0.9795832 1.1846948 0.8948526
 [29] 0.8376585 0.7537790 0.9734574 1.2986062 1.3042339 1.2566377 1.2073803
 [36] 1.1719138 0.4838400 0.9116153 1.0712626 1.0302731 0.7004548 1.1107593
 [43] 0.6135444 0.9840409 0.8025398 0.8977149 0.9465684 0.3889291 0.8141095
 [50] 0.6951846 0.6790790 1.0387031 1.0217601 0.8537525 0.6037977 0.7654756
 [57] 0.9779878 1.2961206 0.7238753 0.7272980 0.9720048 0.5653736 0.9874203
 [64] 0.9261418 0.6736686 0.8024550 1.2647949 0.9824010 0.6881109 0.3984062
 [71] 0.8853583 0.9122248 1.0299710 0.9420400 0.8114961 1.1269004 0.8736419
 [78] 0.8922733 0.2592512 1.0534686 0.6377086 0.7193908 0.9016007 0.8919931
 [85] 0.5131795 1.0572084 0.9190864 0.6425073 0.9476628 0.9079487 0.9888151
 [92] 0.6163162 0.7210294 0.5506604 0.3311742 0.7299102 0.6722439 0.4242897
 [99] 0.3994733 0.5870028 1.2700770        NA 1.3787355 1.5612844 1.5826942
[106] 1.1830914 0.9200262 1.4490784 1.8053371 1.0123960 1.1363415 1.1501350
[113] 1.3385444 1.2854709 1.1493544 1.0207283 1.3098951 1.1911210 0.8752388
[120] 1.0066910 1.3683771 1.1880021 1.5110779 0.8778843 1.1780774 1.1268855
[127] 1.2006001 1.2360252 1.0489726 0.8279252 1.1145611 0.8548954 0.9624495
[134] 1.1860685 1.4929435 1.1703841 1.0182194 1.5617765 1.2675733 1.2915712
[141] 1.0185594 0.8157635 1.1920148 1.2129086 1.3030838 0.7302221 1.0549104
[148] 1.1700095 1.4198918 1.1943181 1.0296594 1.1618123 0.9681725 1.0928932
[155] 0.8833417 1.1268010 1.0813868 0.9619526 0.8739806 0.8528617 1.3603219
[162] 1.1271233 1.2460202 0.9868753 1.0457793 0.9559422 1.1463036 0.9443693
[169] 1.2890331 0.8460410 0.8616859 0.6904839 1.6004786 0.5267972 0.7319011
[176] 1.0486275 1.1499568 1.1971106 0.9933572 0.9060864 0.8549193 0.8589213
[183] 0.6600287 1.1974981 0.7560685 0.6584202 1.0042000 0.8793598 0.8490334
[190] 1.2014146 1.2491064 1.1129278 1.1947807 1.0846427 1.2458097 1.3920571
[197] 0.9489826 0.9241358 0.6221756 0.8703770 0.7863923 0.5062372 0.7492466
[204] 0.7512697 0.9140403 0.5068823 1.0500980 0.6439405 0.6937298 0.7409128
[211] 0.9435256 0.5997723 0.8153285 0.6686174 0.7933766 0.5650183 0.6202492
[218] 1.0458144 0.8489848 0.9733974 0.9932778 0.8413606 1.1129022 0.9068886
[225] 0.9338849 0.5399323 1.2580175 0.5728934 1.3942634 0.5776230 0.6070259
[232] 1.2590693 0.7783844 0.9332572 0.4554141 0.9844705 0.9177532 0.4897440
[239] 0.4974171 0.8884588 0.9048206 0.7620361 0.7492338 0.6355758 0.7745086
[246] 0.8988785 0.7004502 0.7701659 0.9155693 0.4622773 0.6532438 1.0345924
[253] 0.6919324 0.5744296 0.4194247 0.5983485 0.8423933 0.7309599 0.2878046
[260] 0.6489733 0.7660981 0.4850826 0.7223149 0.5451732 0.6056769 0.4190426
[267] 0.3951051 0.5736550 0.5338322 0.1005362 0.9479788 1.4806336 1.4733946
[274] 1.4417109 1.3969251 1.3673747 1.3036000 1.2796473 1.2419111 1.2410928
[281] 1.2339513 1.2262897 1.2107255 1.2102872 1.2102189 1.1984038 1.1869192
[288] 1.1853484 1.1771592 1.1646136 1.1600195 1.1433012 1.1420694 1.1319728
[295] 1.1250897 1.1080518 1.0994019 1.0897755 1.0816391 1.0244446 1.0119372
[302] 1.0113012 1.0095001 1.0067032 1.0064652 0.9722323 0.9688839 0.9648068
[309] 0.9609933 0.9596259 0.9585918 0.9546278 0.9426111 0.9397804 0.9299949
[316] 0.9189571 0.8796054 0.8327863 0.8110399 0.8104258 0.7959653 0.7249008
[323] 0.6964786 0.6559203 0.6386183 0.6123647 0.5120528 0.5110356 0.5070016
[330] 0.4752355 0.3181766 0.2744171 0.1409422

Unique values in apul_context_dependent :
[1] FALSE  TRUE    NA

Unique values in peve_context_strength :
  [1] 0.99626714 1.02449159 1.25263469 1.45076355 1.17445040 0.79956930
  [7] 1.16510795 0.92273479 1.35808525 0.77568342 1.09745363 1.24733457
 [13] 1.07489313 1.25458754 0.87769840 1.33917127 1.20400162 1.24427411
 [19] 0.61937307 1.04919890 0.93278295 0.93198699 1.07988651 1.00249447
 [25] 1.29297367 0.93128838 0.78095832 1.34095802 1.25945467 1.19836273
 [31] 0.70124053 1.01679781 1.00517251 1.13061201 0.64697208 0.95017198
 [37] 1.33873175 0.89646465 1.01422941 0.75206418 0.88021142 1.10525164
 [43] 0.94023458 1.29674550 0.73313502 0.97744503 0.84015171 1.33396632
 [49] 0.81615519 1.00176957 1.12296541 1.10928382 0.92776134 0.79022895
 [55] 1.17919774 0.86244003 0.85383851 0.38895441 0.92787545 0.61539113
 [61] 0.51660061 0.63759431 0.90798424 0.72352975 1.36931858 0.79297426
 [67] 0.48431794 0.72755745 0.76759946 1.14478775 0.44074229 0.45448232
 [73] 0.73371139 0.81632356 1.23352198 0.59271857 0.63161818 0.76520911
 [79] 1.08674775 0.46008801 1.17159121 0.64517903 0.84730111 0.27030874
 [85] 0.89826827 1.02940774 0.95378680 1.01525253 0.38930413 0.50313221
 [91] 0.67849890 1.08643819 1.08033786 0.75081575 0.74514370 0.30482527
 [97] 0.58757002 0.47010759 0.37384242 0.72698326         NA 1.52327334
[103] 1.38779722 1.33735922 1.31594426 1.16301358 1.27933673 1.22445709
[109] 1.22013655 1.19809717 1.10602494 1.24314076 1.06092097 1.22094345
[115] 1.19359519 1.24877790 1.19118337 1.20011511 1.10721771 1.07113952
[121] 0.91395409 0.90805196 1.17632432 1.20223857 1.29750449 1.13479927
[127] 0.85198973 1.23852454 0.97377659 1.05347390 1.19476862 1.17813712
[133] 1.21270746 1.13712496 1.02584020 1.14947264 1.28881281 1.03964051
[139] 0.84447591 1.06537942 1.08042306 1.17404962 0.89536276 1.03849217
[145] 1.32079036 1.04241187 1.19897496 1.12289152 0.88784861 1.13240293
[151] 0.31409834 0.76999260 0.92365284 1.20821553 0.86846732 1.14594258
[157] 1.12835920 1.12291005 0.44898009 0.88670657 0.96652306 1.20150543
[163] 1.17125385 0.64861834 0.92402810 1.05785827 0.91983090 0.79384044
[169] 0.64095444 0.61112882 0.67460424 0.41996047 0.76706124 0.80462681
[175] 0.80153122 0.53556279 1.02517709 1.11973541 1.08438686 0.54867661
[181] 0.83104740 0.69284560 1.15435790 1.23223587 0.32925325 0.66026316
[187] 1.15137039 0.57799979 0.86261148 0.91949035 0.73340498 1.00568694
[193] 0.78265509 1.13139543 0.68032691 0.60741037 0.50068704 0.77549221
[199] 0.25473459 0.37474014 0.89462849 0.64713383 0.53955424 0.29403184
[205] 0.37745822 0.44378433 0.52771055 0.48640639 0.60730233 0.84793002
[211] 0.71088690 0.55831453 0.99148566 0.79172468 0.49443793 0.79051981
[217] 0.61984580 0.67883407 0.53192178 0.16135035 0.50700535 0.47912362
[223] 0.39924622 0.64033772 0.53235119 0.42657142 0.50673299 0.06620029
[229] 0.58141529 1.34479192 1.31225025 1.24395644 1.24282007 1.22892159
[235] 1.19110334 1.15038711 1.14711174 1.14213707 1.11389655 1.05795908
[241] 1.04979512 1.03626541 1.01126897 0.99623873 0.92415085 0.92063887
[247] 0.91901129 0.91372043 0.89994438 0.89638919 0.89577838 0.84654246
[253] 0.83941076 0.80537758 0.75470095 0.75441620 0.73421825 0.64879956
[259] 0.60480241 0.59284432 0.54205873 0.50998914 0.48995108 0.48257571
[265] 0.31923068

Unique values in peve_context_dependent :
[1] FALSE  TRUE    NA

Unique values in ptua_context_strength :
  [1] 1.4149060 1.3928000 1.4860590 1.4495109 1.4849456 1.6114782 1.2455426
  [8] 1.1240720 1.1872014 1.0285770 1.2442072 1.2326676 1.3082528 1.0337898
 [15] 1.3727795 1.1966488 0.8942806 0.9918106 1.2619950 1.1633376 1.6073742
 [22] 0.5018816 1.1419919 1.5033297 0.9287888 1.2682021 1.2094349 0.9333425
 [29] 1.0695879 1.1997492 1.4397979 0.7956825 0.7937776 0.6864053 1.1802553
 [36] 0.9042285 1.1948569 1.1845484 0.8775869 1.1772377 1.3748497 0.7305533
 [43] 1.3469763 0.6150367 1.3548418 1.0083482 1.0963346 1.1526755 1.2417909
 [50] 1.1469886 1.0300454 0.6769978 0.8731906 1.1647562 1.0227259 1.1600103
 [57] 0.9502591 1.0905180 1.1079630 1.4151532 1.2664312 1.5436651 0.8465310
 [64] 1.0704609 0.6677958 1.1009586 0.9394141 0.9586694 1.1811509 1.0611002
 [71] 1.2700171 1.2162969 0.8191365 0.8195657 0.5305453 0.8098849 1.0241982
 [78] 0.8716133 1.1802553 1.0054205 0.7055174 1.0735794 0.6855617 1.2361614
 [85] 0.9842197 0.2731507 0.4617118 0.6375427 0.9505097 0.8526424 0.5741643
 [92] 0.5104113 0.3566194 0.8207341 1.0022485 1.0396646 0.8003053 0.9795584
 [99] 1.0833567 0.4288373 1.8332432 1.4989439 1.6018084 1.4029527 1.5130299
[106] 1.5486827 1.2597869 1.6304029 1.8811998 1.4730021 1.3153204 0.8883912
[113] 1.6724209 1.4900577 1.4325508 1.4445305 1.2442424        NA 1.3861076
[120] 1.3080677 1.5035696 1.2805398 1.1879140 1.3052371 1.2845079 1.3723581
[127] 1.2062798 1.5655934 1.4311872 1.2105032 0.8815807 1.1432456 1.5131892
[134] 1.1943152 1.2405243 1.1729523 1.1617436 1.1578730 1.2881734 1.5065581
[141] 1.2186678 1.4741894 1.3589648 1.2464541 1.3989783 1.4011298 1.1291728
[148] 1.1007402 1.0049497 1.1136929 0.7834103 1.1371853 1.1005468 1.4062393
[155] 0.6913917 0.9854329 0.9585385 1.2314569 1.4332412 1.2723484 1.0460129
[162] 1.0256640 0.9341771 1.5030831 1.0606414 0.8056531 1.0300096 1.0043698
[169] 1.1869582 1.0776977 1.1729453 1.0368704 1.2268789 1.0875312 1.0269248
[176] 1.3171084 1.0623263 1.2373284 1.0837157 1.2465059 1.2633611 0.7940659
[183] 0.7536408 0.9724537 0.8533388 1.1031084 0.8811798 0.9314258 1.1896435
[190] 0.7836523 1.2257648 1.7561475 1.2019104 1.3669221 0.4475605 1.2632253
[197] 1.5031122 1.0934763 0.8070476 1.2832160 0.9608722 1.1367811 0.8583550
[204] 0.8486230 0.7984237 1.0007019 0.8576449 1.0794262 1.5264451 1.1116005
[211] 1.0808658 0.9990668 1.2928985 0.7541299 0.7406954 1.2611974 1.2674468
[218] 0.9115597 1.0360718 0.9888021 0.9841479 1.1083526 0.6953924 0.7653758
[225] 0.6829402 0.7794138 0.4589443 0.9015460 0.9119556 1.2133065 0.9639233
[232] 1.0473459 1.3220820 1.1531126 1.0784330 1.0661141 1.3955691 1.0443655
[239] 0.9918902 0.9944223 0.8800967 1.2855380 0.7392336 1.1405782 1.2454831
[246] 0.7536202 0.6584946 1.0363671 1.2199974 0.8220159 0.9270068 1.0628450
[253] 0.9334491 1.0796553 0.9545088 0.5140624 1.4111704 1.0768536 1.0956281
[260] 0.6693501 1.1363274 0.7884408 0.7095188 0.8542455 0.6879702 0.5803579
[267] 0.9105391 0.7722967 0.7433553 0.9902182 0.4058612 1.0883539 1.0483941
[274] 1.1532600 0.8783116 1.0688953 0.8515742 0.7344220 0.6938705 1.1687729
[281] 0.9742204 1.0761619 0.6247228 0.6848879 1.3058337 1.1038883 1.0957076
[288] 0.6881710 0.6691165 0.8105987 1.1947330 0.8127902 1.0995842 1.0011162
[295] 0.8912026 1.0295142 0.7394939 0.6536069 0.7969532 0.4101780 0.7492877
[302] 0.9428848 0.8484580 0.9992072 0.5428510 1.0611807 0.6427285 0.6699944
[309] 0.7863228 1.1471034 0.7792173 0.8016012 0.5692416 0.7493976 0.7280138
[316] 0.6462151 0.9366575 0.3917691 1.8752375 1.8748981 1.8365720 1.6251565
[323] 1.5902256 1.5281611 1.5260327 1.5075041 1.4832541 1.4350747 1.4316854
[330] 1.3798743 1.3786324 1.3760189 1.3749854 1.3748288 1.3623577 1.3594297
[337] 1.3561613 1.3526470 1.3468568 1.3437551 1.3395873 1.3339894 1.3315317
[344] 1.3268290 1.3216576 1.3196924 1.3163854 1.3141797 1.3133541 1.3120328
[351] 1.2996034 1.2992670 1.2893918 1.2825196 1.2751756 1.2732174 1.2690494
[358] 1.2613364 1.2549526 1.2408649 1.2370585 1.2145719 1.2143128 1.2102717
[365] 1.2080838 1.2000141 1.1997900 1.1995144 1.1980875 1.1965785 1.1952378
[372] 1.1856142 1.1759676 1.1737987 1.1684083 1.1625975 1.1562130 1.1473461
[379] 1.1464274 1.1425534 1.1289598 1.1285714 1.1275336 1.1239780 1.1205354
[386] 1.1147864 1.1067151 1.1058399 1.0903008 1.0861473 1.0824998 1.0803419
[393] 1.0745229 1.0727695 1.0677412 1.0667246 1.0643131 1.0607802 1.0586900
[400] 1.0586081 1.0583729 1.0569797 1.0506318 1.0501887 1.0459287 1.0324508
[407] 1.0302358 1.0276669 1.0271985 1.0260012 1.0245751 1.0232299 1.0192004
[414] 1.0057687 1.0032600 1.0021127 0.9994402 0.9991554 0.9966063 0.9914873
[421] 0.9885497 0.9882614 0.9848329 0.9768307 0.9630503 0.9614221 0.9592008
[428] 0.9541078 0.9514773 0.9331183 0.9317241 0.9167096 0.8934545 0.8848535
[435] 0.8644039 0.8538326 0.8471971 0.8468868 0.8239513 0.8237795 0.8213319
[442] 0.8162255 0.7626210 0.7588087 0.7408166 0.7196337 0.7107158 0.6993804
[449] 0.6781055 0.6699571 0.6558806 0.6309829 0.6210306 0.6086447 0.6068133
[456] 0.5896320 0.5792348 0.5451309 0.5327403 0.4726444 0.3275282

Unique values in ptua_context_dependent :
[1] FALSE  TRUE    NA

Unique values in mean_context_strength :
  [1] 1.3107262 1.2953013 1.2368161 1.2363461 1.1995573 1.1992664 1.1922616
  [8] 1.1911464 1.1747705 1.1616497 1.1608175 1.1384074 1.1331370 1.1214286
 [15] 1.1137131 1.1105006 1.1104916 1.1002921 1.0764650 1.0730155 1.0729981
 [22] 1.0679487 1.0678866 1.0670465 1.0638239 1.0596912 1.0583627 1.0563844
 [29] 1.0555670 1.0506303 1.0381653 1.0370288 1.0343947 1.0245517 1.0115359
 [36] 1.0087714 1.0058096 0.9975428 0.9876930 0.9865250 0.9851720 0.9821881
 [43] 0.9669184 0.9652744 0.9635055 0.9611694 0.9610182 0.9585236 0.9573519
 [50] 0.9479809 0.9440299 0.9416616 0.9409040 0.9362459 0.9352405 0.9293086
 [57] 0.9273618 0.9251977 0.9199046 0.9192808 0.9183455 0.9155444 0.9139785
 [64] 0.9067108 0.9035943 0.8987960 0.8961757 0.8895426 0.8789537 0.8680981
 [71] 0.8653726 0.8610013 0.8609396 0.8593097 0.8585211 0.8431680 0.8431528
 [78] 0.8430319 0.8420848 0.8396590 0.8382724 0.8127164 0.8114878 0.7994878
 [85] 0.7985558 0.7865890 0.7781950 0.7651009 0.7624922 0.7545745 0.7471594
 [92] 0.7377219 0.7193289 0.7074034 0.6928555 0.6914667 0.6867064 0.6246519
 [99] 0.6188908 0.5809411 1.5516601 1.5111086 1.4902720 1.4821186 1.4504135
[106] 1.4430209 1.4212406 1.4067472 1.4006130 1.3944732 1.3821994 1.3468641
[113] 1.3424084 1.3131996 1.2977822 1.2973328 1.2913934 1.2824038 1.2677310
[120] 1.2662624 1.2621489 1.2503382 1.2489046 1.2481791 1.2413025 1.2391915
[127] 1.2247103 1.2204161 1.2189391 1.2146491 1.2044728 1.2020492 1.1963293
[134] 1.1960117 1.1955367 1.1861963 1.1837049 1.1820678 1.1809294 1.1792365
[141] 1.1716215 1.1685730 1.1672416 1.1666144 1.1645424 1.1607072 1.1587968
[148] 1.1564662 1.1545909 1.1527486 1.1514894 1.1512271 1.1498807 1.1381769
[155] 1.1359923 1.1354655 1.1291145 1.1283720 1.1265841 1.1265031 1.1250548
[162] 1.1250082 1.1245023 1.1230625 1.1227443 1.1203908 1.1192863 1.1186305
[169] 1.1166526 1.1165237 1.1153254 1.1127725 1.1121639 1.1085386 1.1083088
[176] 1.1074113 1.0993928 1.0993413 1.0975257 1.0902122 1.0881987 1.0860772
[183] 1.0832208 1.0807921 1.0733831 1.0713747 1.0680011 1.0663456 1.0611039
[190] 1.0602433 1.0581114 1.0574282 1.0569814 1.0497885 1.0496795 1.0449918
[197] 1.0440956 1.0400774 1.0394169 1.0388647 1.0387461 1.0383861 1.0363427
[204] 1.0359029 1.0351229 1.0317982 1.0287030 1.0240196 1.0166089 1.0149547
[211] 1.0085646 1.0076316 1.0075586 1.0047499 1.0026242 1.0021488 0.9992899
[218] 0.9977671 0.9970296 0.9930020 0.9927563 0.9889147 0.9877126 0.9852609
[225] 0.9837862 0.9827949 0.9764636 0.9758140 0.9711004 0.9636612 0.9598088
[232] 0.9580326 0.9578798 0.9577158 0.9564151 0.9534458 0.9519894 0.9510965
[239] 0.9484035 0.9450304 0.9391518 0.9388605 0.9320283 0.9284693 0.9255007
[246] 0.9252643 0.9180457 0.9177410 0.9171502 0.9168691 0.9141596 0.9138584
[253] 0.9138398 0.9086919 0.9077648 0.9057134 0.8982585 0.8979768 0.8970685
[260] 0.8962102 0.8946658 0.8922594 0.8905229 0.8893986 0.8891150 0.8890583
[267] 0.8886400 0.8843370 0.8827708 0.8790271 0.8778453 0.8770651 0.8743888
[274] 0.8741363 0.8739427 0.8731491 0.8702118 0.8685584 0.8581943 0.8579386
[281] 0.8575822 0.8571636 0.8557982 0.8539656 0.8534012 0.8513983 0.8478031
[288] 0.8468286 0.8466301 0.8465971 0.8395926 0.8386201 0.8356639 0.8352726
[295] 0.8319393 0.8306236 0.8279022 0.8269735 0.8269019 0.8244990 0.8232592
[302] 0.8215489 0.8169047 0.8149793 0.8145252 0.8135638 0.8120935 0.8106771
[309] 0.8078581 0.8045967 0.8013205 0.7999328 0.7968161 0.7965623 0.7883149
[316] 0.7869686 0.7863174 0.7860956 0.7810120 0.7716843 0.7644134 0.7633892
[323] 0.7579603 0.7570013 0.7530904 0.7507685 0.7487017 0.7405264 0.7369419
[330] 0.7268815 0.7224842 0.7223852 0.7206101 0.7186614 0.7114438 0.7093159
[337] 0.6944341 0.6926221 0.6754028 0.6744927 0.6607813 0.6594838 0.6591223
[344] 0.6542269 0.6365517 0.6321500 0.6007192 0.6004237 0.5927555 0.5874592
[351] 0.5842201 0.5615595 0.5530031 0.5363933 0.5202826 0.5185969 0.5070896
[358] 0.4865922 1.8752375 1.8748981 1.8365720 1.6251565 1.5902256 1.5281611
[365] 1.5260327 1.5075041 1.4832541 1.4806336 1.4733946 1.4417109 1.4350747
[372] 1.4316854 1.3969251 1.3861076 1.3798743 1.3786324 1.3760189 1.3749854
[379] 1.3748288 1.3673747 1.3623577 1.3594297 1.3561613 1.3526470 1.3468568
[386] 1.3447919 1.3437551 1.3395873 1.3339894 1.3315317 1.3268290 1.3216576
[393] 1.3196924 1.3163854 1.3141797 1.3133541 1.3122502 1.3120328 1.3036000
[400] 1.2996034 1.2992670 1.2893918 1.2825196 1.2796473 1.2751756 1.2732174
[407] 1.2690494 1.2613364 1.2549526 1.2439564 1.2428201 1.2419111 1.2410928
[414] 1.2408649 1.2370585 1.2339513 1.2289216 1.2262897 1.2145719 1.2143128
[421] 1.2107255 1.2102872 1.2102717 1.2102189 1.2080838 1.2000141 1.1997900
[428] 1.1995144 1.1984038 1.1980875 1.1965785 1.1952378 1.1911033 1.1869192
[435] 1.1856142 1.1853484 1.1771592 1.1759676 1.1737987 1.1729523 1.1684083
[442] 1.1646136 1.1625975 1.1600195 1.1562130 1.1503871 1.1473461 1.1471117
[449] 1.1464274 1.1433012 1.1425534 1.1421371 1.1420694 1.1319728 1.1289598
[456] 1.1285714 1.1275336 1.1250897 1.1239780 1.1205354 1.1147864 1.1138965
[463] 1.1080518 1.1067151 1.1058399 1.1005468 1.0994019 1.0903008 1.0897755
[470] 1.0861473 1.0824998 1.0816391 1.0803419 1.0745229 1.0727695 1.0677412
[477] 1.0667246 1.0643131 1.0607802 1.0586900 1.0586081 1.0583729 1.0579591
[484] 1.0569797 1.0506318 1.0501887 1.0497951 1.0459287 1.0368704 1.0362654
[491] 1.0324508 1.0302358 1.0276669 1.0271985 1.0260012 1.0245751 1.0244446
[498] 1.0232299 1.0192004 1.0119372 1.0113012 1.0112690 1.0095001 1.0067032
[505] 1.0064652 1.0057687 1.0032600 1.0021127 0.9994402 0.9991554 0.9966063
[512] 0.9962387 0.9914873 0.9885497 0.9882614 0.9854329 0.9848329 0.9768307
[519] 0.9724537 0.9722323 0.9688839 0.9648068 0.9630503 0.9614221 0.9609933
[526] 0.9596259 0.9592008 0.9585918 0.9585385 0.9546278 0.9541078 0.9514773
[533] 0.9428848 0.9426111 0.9397804 0.9331183 0.9317241 0.9299949 0.9241509
[540] 0.9206389 0.9190113 0.9189571 0.9167096 0.9137204 0.9105391 0.8999444
[547] 0.8963892 0.8957784 0.8934545 0.8848535 0.8796054 0.8644039 0.8538326
[554] 0.8471971 0.8468868 0.8465425 0.8394108 0.8327863 0.8239513 0.8237795
[561] 0.8213319 0.8162255 0.8110399 0.8104258 0.8053776 0.7959653 0.7626210
[568] 0.7588087 0.7547009 0.7544162 0.7408166 0.7342183 0.7249008 0.7196337
[575] 0.7107158 0.6993804 0.6964786 0.6781055 0.6699571 0.6559203 0.6558806
[582] 0.6487996 0.6386183 0.6309829 0.6210306 0.6123647 0.6086447 0.6068133
[589] 0.6048024 0.5928443 0.5896320 0.5792348 0.5451309 0.5420587 0.5327403
[596] 0.5120528 0.5110356 0.5099891 0.5070016 0.4899511 0.4825757 0.4752355
[603] 0.4726444 0.4589443 0.3275282 0.3192307 0.3181766 0.2744171 0.1409422
# Filter and summarize data where context dependent columns have TRUE values
if (length(context_cols) > 0) {
  # Create filter for rows where any context dependent column is TRUE
  context_true_data <- biomin_data %>%
    filter(if_any(all_of(context_cols), ~ . == TRUE | . == "TRUE" | . == "true"))
  
  cat("Number of rows with context dependent = TRUE:", nrow(context_true_data), "\n\n")
  
  # Summarize by og_id
  if ("og_id" %in% names(context_true_data)) {
    context_summary <- context_true_data %>%
      group_by(og_id) %>%
      summarise(
        n_records = n(),
        across(where(is.numeric), ~ mean(.x, na.rm = TRUE), .names = "mean_{.col}"),
        .groups = "drop"
      )
    
    print(context_summary)
  } else {
    cat("Column 'og_id' not found in data\n")
    print(head(context_true_data))
  }
}
Number of rows with context dependent = TRUE: 239 

# A tibble: 239 × 14
   og_id   n_records mean_n_species mean_apul_context_st…¹ mean_apul_improvement
   <chr>       <int>          <dbl>                  <dbl>                 <dbl>
 1 OG_000…         1              2                NaN                NaN       
 2 OG_001…         1              3                  0.259              0.000355
 3 OG_003…         1              1                NaN                NaN       
 4 OG_004…         1              3                  0.719              0.0805  
 5 OG_004…         1              3                  0.331              0.00357 
 6 OG_006…         1              2                  0.497              0.00731 
 7 OG_006…         1              2                  1.19               0.00175 
 8 OG_008…         1              2                NaN                NaN       
 9 OG_008…         1              1                NaN                NaN       
10 OG_011…         1              2                  1.51               0.0157  
# ℹ 229 more rows
# ℹ abbreviated name: ¹​mean_apul_context_strength
# ℹ 9 more variables: mean_apul_r2 <dbl>, mean_peve_context_strength <dbl>,
#   mean_peve_improvement <dbl>, mean_peve_r2 <dbl>,
#   mean_ptua_context_strength <dbl>, mean_ptua_improvement <dbl>,
#   mean_ptua_r2 <dbl>, mean_mean_context_strength <dbl>, mean_n_records <dbl>
# Display detailed view of context-dependent records
if (exists("context_true_data") && nrow(context_true_data) > 0) {

  cat("\nDetailed view of context-dependent records:\n")
  print(context_true_data)
}

Detailed view of context-dependent records:
# A tibble: 239 × 15
   og_id n_species apul_context_strength apul_context_dependent apul_improvement
   <chr>     <dbl>                 <dbl> <lgl>                             <dbl>
 1 OG_0…         3                 1.47  FALSE                          0.000408
 2 OG_0…         3                 0.972 FALSE                          0.00673 
 3 OG_0…         3                 1.17  FALSE                          0.00495 
 4 OG_0…         3                 1.53  TRUE                           0.265   
 5 OG_0…         3                 0.979 FALSE                          0.000131
 6 OG_0…         3                 1.68  FALSE                          0.0154  
 7 OG_0…         3                 1.14  FALSE                          0.0257  
 8 OG_0…         3                 0.935 FALSE                          0.00783 
 9 OG_0…         3                 1.02  FALSE                          0.00689 
10 OG_0…         3                 1.08  FALSE                          0.000887
# ℹ 229 more rows
# ℹ 10 more variables: apul_r2 <dbl>, peve_context_strength <dbl>,
#   peve_context_dependent <lgl>, peve_improvement <dbl>, peve_r2 <dbl>,
#   ptua_context_strength <dbl>, ptua_context_dependent <lgl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, mean_context_strength <dbl>

Species-Specific and Shared Context-Dependent OGs

# Identify species-specific context dependent columns
species_context_cols <- context_cols[!grepl("shared|common", context_cols, ignore.case = TRUE)]

# Create summary of which OGs are TRUE for each species
species_summary <- biomin_data %>%
  select(og_id, all_of(context_cols), everything())

# Count how many species have TRUE for each OG
if (length(context_cols) > 0) {
  og_species_count <- biomin_data %>%
    rowwise() %>%
    mutate(
      species_true_count = sum(c_across(all_of(context_cols)) == TRUE | 
                               c_across(all_of(context_cols)) == "TRUE" | 
                               c_across(all_of(context_cols)) == "true", na.rm = TRUE)
    ) %>%
    ungroup()
  
  # OGs with TRUE in exactly one species (species-specific)
  single_species_ogs <- og_species_count %>%
    filter(species_true_count == 1)
  
  # OGs shared across two species
  two_species_ogs <- og_species_count %>%
    filter(species_true_count == 2)
  
  # OGs shared across three species
  three_species_ogs <- og_species_count %>%
    filter(species_true_count == 3)
  
  cat("OGs with context-dependent = TRUE in exactly 1 species:", nrow(single_species_ogs), "\n")
  cat("OGs with context-dependent = TRUE in exactly 2 species:", nrow(two_species_ogs), "\n")
  cat("OGs with context-dependent = TRUE in all 3 species:", nrow(three_species_ogs), "\n")
}
OGs with context-dependent = TRUE in exactly 1 species: 205 
OGs with context-dependent = TRUE in exactly 2 species: 32 
OGs with context-dependent = TRUE in all 3 species: 2 
# Detailed breakdown by species
for (col in context_cols) {
  species_name <- gsub("_context.*|context_dependent_|_methylation.*", "", col, ignore.case = TRUE)
  true_count <- sum(biomin_data[[col]] == TRUE | biomin_data[[col]] == "TRUE" | biomin_data[[col]] == "true", na.rm = TRUE)
  cat("\n", species_name, "- OGs with context-dependent = TRUE:", true_count, "\n")
  
  species_ogs <- biomin_data %>%
    filter(.data[[col]] == TRUE | .data[[col]] == "TRUE" | .data[[col]] == "true") %>%
    select(og_id, all_of(col), where(is.numeric))
  
  if (nrow(species_ogs) > 0) {
    print(species_ogs)
  }
}

 apul - OGs with context-dependent = TRUE: 0 

 apul - OGs with context-dependent = TRUE: 47 
# A tibble: 47 × 13
   og_id apul_context_dependent n_species apul_context_strength apul_improvement
   <chr> <lgl>                      <dbl>                 <dbl>            <dbl>
 1 OG_0… TRUE                           3                 1.53            0.265 
 2 OG_0… TRUE                           3                 1.23            0.0558
 3 OG_0… TRUE                           3                 0.695           0.170 
 4 OG_0… TRUE                           3                 0.973           0.0433
 5 OG_1… TRUE                           3                 1.30            0.0848
 6 OG_1… TRUE                           3                 1.17            0.0586
 7 OG_0… TRUE                           3                 0.389           0.0725
 8 OG_0… TRUE                           3                 1.04            0.111 
 9 OG_0… TRUE                           3                 0.982           0.0635
10 OG_0… TRUE                           3                 0.885           0.0849
# ℹ 37 more rows
# ℹ 8 more variables: apul_r2 <dbl>, peve_context_strength <dbl>,
#   peve_improvement <dbl>, peve_r2 <dbl>, ptua_context_strength <dbl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, mean_context_strength <dbl>

 peve - OGs with context-dependent = TRUE: 0 

 peve - OGs with context-dependent = TRUE: 69 
# A tibble: 69 × 13
   og_id peve_context_dependent n_species apul_context_strength apul_improvement
   <chr> <lgl>                      <dbl>                 <dbl>            <dbl>
 1 OG_0… TRUE                           3                 0.972        0.00673  
 2 OG_0… TRUE                           3                 0.979        0.000131 
 3 OG_0… TRUE                           3                 1.14         0.0257   
 4 OG_0… TRUE                           3                 1.08         0.000887 
 5 OG_0… TRUE                           3                 0.796        0.00436  
 6 OG_0… TRUE                           3                 1.35         0.0291   
 7 OG_0… TRUE                           3                 1.01         0.000222 
 8 OG_0… TRUE                           3                 0.970        0.0000296
 9 OG_0… TRUE                           3                 0.895        0.00291  
10 OG_0… TRUE                           3                 0.838        0.00305  
# ℹ 59 more rows
# ℹ 8 more variables: apul_r2 <dbl>, peve_context_strength <dbl>,
#   peve_improvement <dbl>, peve_r2 <dbl>, ptua_context_strength <dbl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, mean_context_strength <dbl>

 ptua - OGs with context-dependent = TRUE: 0 

 ptua - OGs with context-dependent = TRUE: 159 
# A tibble: 159 × 13
   og_id ptua_context_dependent n_species apul_context_strength apul_improvement
   <chr> <lgl>                      <dbl>                 <dbl>            <dbl>
 1 OG_0… TRUE                           3                 1.47          0.000408
 2 OG_0… TRUE                           3                 0.972         0.00673 
 3 OG_0… TRUE                           3                 1.17          0.00495 
 4 OG_0… TRUE                           3                 0.979         0.000131
 5 OG_0… TRUE                           3                 1.68          0.0154  
 6 OG_0… TRUE                           3                 0.935         0.00783 
 7 OG_0… TRUE                           3                 1.02          0.00689 
 8 OG_0… TRUE                           3                 1.08          0.000887
 9 OG_0… TRUE                           3                 0.796         0.00436 
10 OG_0… TRUE                           3                 1.23          0.0558  
# ℹ 149 more rows
# ℹ 8 more variables: apul_r2 <dbl>, peve_context_strength <dbl>,
#   peve_improvement <dbl>, peve_r2 <dbl>, ptua_context_strength <dbl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, mean_context_strength <dbl>

 mean - OGs with context-dependent = TRUE: 0 
# Summary of shared OGs with quantitative metrics
if (exists("two_species_ogs") && nrow(two_species_ogs) > 0) {
  cat("\n=== OGs Shared Across Two Species ===\n")
  two_species_summary <- two_species_ogs %>%
    select(og_id, all_of(context_cols), where(is.numeric))
  print(two_species_summary)
}

=== OGs Shared Across Two Species ===
# A tibble: 32 × 16
   og_id    apul_context_strength apul_context_dependent peve_context_strength
   <chr>                    <dbl> <lgl>                                  <dbl>
 1 OG_06119                 0.972 FALSE                                   1.25
 2 OG_07153                 0.979 FALSE                                   1.36
 3 OG_04467                 1.08  FALSE                                   1.25
 4 OG_07150                 0.796 FALSE                                   1.34
 5 OG_02190                 1.23  TRUE                                    1.20
 6 OG_08849                 1.01  FALSE                                   1.05
 7 OG_06616                 0.695 TRUE                                    1.00
 8 OG_01611                 1.26  FALSE                                   1.13
 9 OG_02666                 0.389 TRUE                                    1.33
10 OG_05666                 0.695 FALSE                                   1.00
# ℹ 22 more rows
# ℹ 12 more variables: peve_context_dependent <lgl>,
#   ptua_context_strength <dbl>, ptua_context_dependent <lgl>,
#   mean_context_strength <dbl>, n_species <dbl>, apul_improvement <dbl>,
#   apul_r2 <dbl>, peve_improvement <dbl>, peve_r2 <dbl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, species_true_count <int>
if (exists("three_species_ogs") && nrow(three_species_ogs) > 0) {
  cat("\n=== OGs Shared Across All Three Species ===\n")
  three_species_summary <- three_species_ogs %>%
    select(og_id, all_of(context_cols), where(is.numeric))
  print(three_species_summary)
}

=== OGs Shared Across All Three Species ===
# A tibble: 2 × 16
  og_id    apul_context_strength apul_context_dependent peve_context_strength
  <chr>                    <dbl> <lgl>                                  <dbl>
1 OG_06592                 0.973 TRUE                                   0.701
2 OG_04243                 0.638 TRUE                                   1.17 
# ℹ 12 more variables: peve_context_dependent <lgl>,
#   ptua_context_strength <dbl>, ptua_context_dependent <lgl>,
#   mean_context_strength <dbl>, n_species <dbl>, apul_improvement <dbl>,
#   apul_r2 <dbl>, peve_improvement <dbl>, peve_r2 <dbl>,
#   ptua_improvement <dbl>, ptua_r2 <dbl>, species_true_count <int>
# Generate quantitative summary statistics for context-dependent OGs
if (exists("context_true_data") && nrow(context_true_data) > 0) {
  numeric_cols <- names(context_true_data)[sapply(context_true_data, is.numeric)]
  
  if (length(numeric_cols) > 0) {
    cat("\n=== Quantitative Summary of Context-Dependent OGs ===\n")
    quant_summary <- context_true_data %>%
      summarise(across(all_of(numeric_cols), 
                       list(mean = ~mean(.x, na.rm = TRUE),
                            sd = ~sd(.x, na.rm = TRUE),
                            min = ~min(.x, na.rm = TRUE),
                            max = ~max(.x, na.rm = TRUE)),
                       .names = "{.col}_{.fn}"))
    
    # Transpose for better readability
    quant_summary_long <- quant_summary %>%
      pivot_longer(everything(), names_to = "metric", values_to = "value")
    print(quant_summary_long)
  }
}

=== Quantitative Summary of Context-Dependent OGs ===
# A tibble: 44 × 2
   metric                      value
   <chr>                       <dbl>
 1 n_species_mean             1.92  
 2 n_species_sd               0.738 
 3 n_species_min              1     
 4 n_species_max              3     
 5 apul_context_strength_mean 0.965 
 6 apul_context_strength_sd   0.313 
 7 apul_context_strength_min  0.141 
 8 apul_context_strength_max  1.81  
 9 apul_improvement_mean      0.0369
10 apul_improvement_sd        0.0440
# ℹ 34 more rows

Summary Paragraph

# Generate dynamic summary paragraph
if (exists("context_cols") && length(context_cols) > 0) {
  
  # Get counts per species
  species_counts <- sapply(context_cols, function(col) {
    sum(biomin_data[[col]] == TRUE | biomin_data[[col]] == "TRUE" | biomin_data[[col]] == "true", na.rm = TRUE)
  })
  
  # Get OG lists per species
  species_ogs_list <- lapply(context_cols, function(col) {
    biomin_data %>%
      filter(.data[[col]] == TRUE | .data[[col]] == "TRUE" | .data[[col]] == "true") %>%
      pull(og_id)
  })
  names(species_ogs_list) <- context_cols
  
  # Build paragraph
  cat("\n## Cross-Species Context-Dependent Methylation and miRNA Analysis\n\n")
  
  cat("This analysis examined orthogroup (OG) patterns across species for context-dependent methylation and miRNA associations. ")
  
  # Species-specific findings
  for (i in seq_along(context_cols)) {
    col <- context_cols[i]
    species_name <- gsub("_context.*|context_dependent_|_methylation.*", "", col, ignore.case = TRUE)
    ogs <- species_ogs_list[[col]]
    if (length(ogs) > 0) {
      cat("**", species_name, "** showed context-dependent patterns in ", length(ogs), " OGs (", 
          paste(head(ogs, 5), collapse = ", "), if(length(ogs) > 5) ", ..." else "", "). ", sep = "")
    }
  }
  
  # Shared patterns
  if (exists("two_species_ogs") && nrow(two_species_ogs) > 0) {
    cat("\n\nA total of **", nrow(two_species_ogs), " OGs** exhibited context-dependent patterns shared across exactly two species", sep = "")
    if (nrow(two_species_ogs) <= 10) {
      cat(" (", paste(two_species_ogs$og_id, collapse = ", "), ")", sep = "")
    }
    cat(". ")
  }
  
  if (exists("three_species_ogs") && nrow(three_species_ogs) > 0) {
    cat("Notably, **", nrow(three_species_ogs), " OGs** showed conserved context-dependent patterns across all three species", sep = "")
    if (nrow(three_species_ogs) <= 10) {
      cat(" (", paste(three_species_ogs$og_id, collapse = ", "), ")", sep = "")
    }
    cat(", suggesting evolutionary conservation of these regulatory mechanisms. ")
  }
  
  # Quantitative highlights
  if (exists("context_true_data") && nrow(context_true_data) > 0) {
    numeric_cols <- names(context_true_data)[sapply(context_true_data, is.numeric)]
    if (length(numeric_cols) > 0) {
      cat("\n\nQuantitatively, context-dependent OGs showed the following characteristics: ")
      for (nc in head(numeric_cols, 3)) {
        mean_val <- mean(context_true_data[[nc]], na.rm = TRUE)
        sd_val <- sd(context_true_data[[nc]], na.rm = TRUE)
        cat("**", nc, "** (mean ± SD: ", round(mean_val, 3), " ± ", round(sd_val, 3), "); ", sep = "")
      }
    }
  }
  
  cat("\n")
}

Cross-Species Context-Dependent Methylation and miRNA Analysis

This analysis examined orthogroup (OG) patterns across species for context-dependent methylation and miRNA associations. apul showed context-dependent patterns in 47 OGs (OG_01452, OG_02190, OG_06616, OG_06592, OG_10121, …). peve showed context-dependent patterns in 69 OGs (OG_06119, OG_07153, OG_01753, OG_04467, OG_07150, …). ptua showed context-dependent patterns in 159 OGs (OG_02619, OG_06119, OG_05637, OG_07153, OG_01414, …).

A total of 32 OGs exhibited context-dependent patterns shared across exactly two species. Notably, 2 OGs showed conserved context-dependent patterns across all three species (OG_06592, OG_04243), suggesting evolutionary conservation of these regulatory mechanisms.

Quantitatively, context-dependent OGs showed the following characteristics: n_species (mean ± SD: 1.921 ± 0.738); apul_context_strength (mean ± SD: 0.965 ± 0.313); apul_improvement (mean ± SD: 0.037 ± 0.044);