Last updated: 2025-02-04
Checks: 5 2
Knit directory:
locust-comparative-genomics/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20221025) was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.
| absolute | relative |
|---|---|
| /Users/maevatecher/Documents/GitHub/locust-comparative-genomics/data | data |
| /Users/maevatecher/Documents/GitHub/locust-comparative-genomics/data/orthofinder/Schistocerca | data/orthofinder/Schistocerca |
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 1fddc47. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish or
wflow_git_commit). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: analysis/.DS_Store
Ignored: analysis/.Rhistory
Ignored: data/.DS_Store
Ignored: data/DEG-results/.DS_Store
Ignored: data/WGCNA_input/.DS_Store
Ignored: data/WGCNA_output/.DS_Store
Ignored: data/behavioral_data/.DS_Store
Ignored: data/behavioral_data/Raw_data/.DS_Store
Ignored: data/list/.DS_Store
Ignored: data/list/GO_Annotations/.DS_Store
Ignored: data/orthofinder/.DS_Store
Ignored: data/orthofinder/Polyneoptera/.DS_Store
Ignored: data/orthofinder/Polyneoptera/Orthogroups/.DS_Store
Ignored: data/orthofinder/Schistocerca/.DS_Store
Ignored: data/orthofinder/Schistocerca/Orthogroups/.DS_Store
Untracked files:
Untracked: VennDiagram.2025-02-04_15-47-28.72043.log
Untracked: VennDiagram.2025-02-04_15-47-29.413034.log
Untracked: VennDiagram.2025-02-04_15-47-29.997612.log
Untracked: VennDiagram.2025-02-04_15-47-30.64157.log
Untracked: VennDiagram.2025-02-04_15-47-31.353173.log
Untracked: VennDiagram.2025-02-04_15-47-31.88835.log
Untracked: VennDiagram.2025-02-04_15-47-32.58516.log
Untracked: VennDiagram.2025-02-04_15-47-32.684866.log
Untracked: VennDiagram.2025-02-04_15-47-32.793365.log
Untracked: VennDiagram.2025-02-04_15-47-33.803069.log
Untracked: VennDiagram.2025-02-04_15-47-33.885389.log
Untracked: VennDiagram.2025-02-04_15-47-33.969973.log
Untracked: VennDiagram.2025-02-04_15-47-35.009806.log
Untracked: VennDiagram.2025-02-04_15-47-35.056713.log
Untracked: VennDiagram.2025-02-04_15-47-35.138097.log
Untracked: VennDiagram.2025-02-04_15-47-35.911289.log
Untracked: VennDiagram.2025-02-04_15-47-35.95783.log
Untracked: VennDiagram.2025-02-04_15-47-36.04977.log
Untracked: VennDiagram.2025-02-04_15-47-36.981621.log
Untracked: VennDiagram.2025-02-04_15-47-37.115164.log
Untracked: VennDiagram.2025-02-04_15-47-37.241817.log
Untracked: VennDiagram.2025-02-04_15-47-38.371904.log
Untracked: VennDiagram.2025-02-04_15-47-38.493683.log
Untracked: VennDiagram.2025-02-04_15-47-38.611024.log
Untracked: VennDiagram.2025-02-04_15-47-39.869802.log
Untracked: VennDiagram.2025-02-04_15-47-40.001415.log
Untracked: VennDiagram.2025-02-04_15-47-40.12147.log
Untracked: VennDiagram.2025-02-04_15-47-40.476805.log
Untracked: VennDiagram.2025-02-04_15-47-40.65379.log
Untracked: VennDiagram.2025-02-04_15-47-40.775159.log
Untracked: VennDiagram.2025-02-04_15-47-45.241798.log
Untracked: VennDiagram.2025-02-04_15-47-45.880151.log
Untracked: VennDiagram.2025-02-04_15-47-46.485996.log
Untracked: VennDiagram.2025-02-04_15-47-47.119871.log
Untracked: VennDiagram.2025-02-04_15-47-47.761173.log
Untracked: VennDiagram.2025-02-04_15-47-48.473343.log
Untracked: VennDiagram.2025-02-04_15-47-49.483982.log
Untracked: VennDiagram.2025-02-04_15-47-49.543048.log
Untracked: VennDiagram.2025-02-04_15-47-50.928006.log
Untracked: VennDiagram.2025-02-04_15-47-50.988687.log
Untracked: VennDiagram.2025-02-04_15-47-51.082292.log
Untracked: VennDiagram.2025-02-04_15-47-52.346782.log
Untracked: VennDiagram.2025-02-04_15-47-52.393903.log
Untracked: VennDiagram.2025-02-04_15-47-52.48024.log
Untracked: VennDiagram.2025-02-04_15-47-53.776312.log
Untracked: VennDiagram.2025-02-04_15-47-53.815865.log
Untracked: VennDiagram.2025-02-04_15-47-53.897099.log
Untracked: VennDiagram.2025-02-04_15-47-55.276725.log
Untracked: VennDiagram.2025-02-04_15-47-55.50006.log
Untracked: VennDiagram.2025-02-04_15-47-55.61531.log
Untracked: VennDiagram.2025-02-04_15-47-57.109339.log
Untracked: VennDiagram.2025-02-04_15-47-57.22735.log
Untracked: VennDiagram.2025-02-04_15-47-57.380701.log
Untracked: VennDiagram.2025-02-04_15-47-59.086074.log
Untracked: VennDiagram.2025-02-04_15-47-59.266312.log
Untracked: VennDiagram.2025-02-04_15-47-59.397066.log
Untracked: VennDiagram.2025-02-04_15-47-59.551947.log
Untracked: VennDiagram.2025-02-04_15-47-59.706997.log
Untracked: VennDiagram.2025-02-04_15-47-59.832003.log
Untracked: VennDiagram.2025-02-04_15-48-34.206233.log
Untracked: VennDiagram.2025-02-04_15-48-34.900589.log
Untracked: VennDiagram.2025-02-04_15-48-35.487048.log
Untracked: VennDiagram.2025-02-04_15-48-36.135721.log
Untracked: VennDiagram.2025-02-04_15-48-36.853954.log
Untracked: VennDiagram.2025-02-04_15-48-37.387665.log
Untracked: VennDiagram.2025-02-04_15-48-38.09891.log
Untracked: VennDiagram.2025-02-04_15-48-38.195452.log
Untracked: VennDiagram.2025-02-04_15-48-38.300363.log
Untracked: VennDiagram.2025-02-04_15-48-39.267938.log
Untracked: VennDiagram.2025-02-04_15-48-39.347551.log
Untracked: VennDiagram.2025-02-04_15-48-39.430659.log
Untracked: VennDiagram.2025-02-04_15-48-40.475708.log
Untracked: VennDiagram.2025-02-04_15-48-40.52371.log
Untracked: VennDiagram.2025-02-04_15-48-40.602353.log
Untracked: VennDiagram.2025-02-04_15-48-41.384061.log
Untracked: VennDiagram.2025-02-04_15-48-41.432765.log
Untracked: VennDiagram.2025-02-04_15-48-41.521819.log
Untracked: VennDiagram.2025-02-04_15-48-42.47289.log
Untracked: VennDiagram.2025-02-04_15-48-42.610128.log
Untracked: VennDiagram.2025-02-04_15-48-42.735005.log
Untracked: VennDiagram.2025-02-04_15-48-43.867136.log
Untracked: VennDiagram.2025-02-04_15-48-43.98963.log
Untracked: VennDiagram.2025-02-04_15-48-44.108733.log
Untracked: VennDiagram.2025-02-04_15-48-45.378038.log
Untracked: VennDiagram.2025-02-04_15-48-45.510736.log
Untracked: VennDiagram.2025-02-04_15-48-45.632538.log
Untracked: VennDiagram.2025-02-04_15-48-45.985598.log
Untracked: VennDiagram.2025-02-04_15-48-46.164065.log
Untracked: VennDiagram.2025-02-04_15-48-46.284054.log
Untracked: VennDiagram.2025-02-04_15-48-50.780986.log
Untracked: VennDiagram.2025-02-04_15-48-51.37771.log
Untracked: VennDiagram.2025-02-04_15-48-51.983174.log
Untracked: VennDiagram.2025-02-04_15-48-52.634369.log
Untracked: VennDiagram.2025-02-04_15-48-53.286582.log
Untracked: VennDiagram.2025-02-04_15-48-54.01503.log
Untracked: VennDiagram.2025-02-04_15-48-55.005664.log
Untracked: VennDiagram.2025-02-04_15-48-55.099225.log
Untracked: VennDiagram.2025-02-04_15-48-56.498358.log
Untracked: VennDiagram.2025-02-04_15-48-56.559708.log
Untracked: VennDiagram.2025-02-04_15-48-56.633088.log
Untracked: VennDiagram.2025-02-04_15-48-57.954235.log
Untracked: VennDiagram.2025-02-04_15-48-58.000059.log
Untracked: VennDiagram.2025-02-04_15-48-58.066188.log
Untracked: VennDiagram.2025-02-04_15-48-59.296027.log
Untracked: VennDiagram.2025-02-04_15-48-59.336224.log
Untracked: VennDiagram.2025-02-04_15-48-59.380027.log
Untracked: VennDiagram.2025-02-04_15-49-00.756592.log
Untracked: VennDiagram.2025-02-04_15-49-00.962591.log
Untracked: VennDiagram.2025-02-04_15-49-01.100435.log
Untracked: VennDiagram.2025-02-04_15-49-02.604754.log
Untracked: VennDiagram.2025-02-04_15-49-02.721265.log
Untracked: VennDiagram.2025-02-04_15-49-02.873784.log
Untracked: VennDiagram.2025-02-04_15-49-04.570608.log
Untracked: VennDiagram.2025-02-04_15-49-04.755377.log
Untracked: VennDiagram.2025-02-04_15-49-04.882882.log
Untracked: VennDiagram.2025-02-04_15-49-05.038033.log
Untracked: VennDiagram.2025-02-04_15-49-05.164916.log
Untracked: VennDiagram.2025-02-04_15-49-05.317878.log
Untracked: VennDiagram.2025-02-04_15-50-41.87995.log
Untracked: VennDiagram.2025-02-04_15-50-42.566332.log
Untracked: VennDiagram.2025-02-04_15-50-43.163286.log
Untracked: VennDiagram.2025-02-04_15-50-43.805982.log
Untracked: VennDiagram.2025-02-04_15-50-44.513073.log
Untracked: VennDiagram.2025-02-04_15-50-45.050677.log
Untracked: VennDiagram.2025-02-04_15-50-45.748017.log
Untracked: VennDiagram.2025-02-04_15-50-45.841968.log
Untracked: VennDiagram.2025-02-04_15-50-45.95072.log
Untracked: VennDiagram.2025-02-04_15-50-46.969907.log
Untracked: VennDiagram.2025-02-04_15-50-47.045979.log
Untracked: VennDiagram.2025-02-04_15-50-47.123017.log
Untracked: VennDiagram.2025-02-04_15-50-48.141164.log
Untracked: VennDiagram.2025-02-04_15-51-02.395402.log
Untracked: VennDiagram.2025-02-04_15-51-03.054149.log
Untracked: VennDiagram.2025-02-04_15-51-03.627363.log
Untracked: VennDiagram.2025-02-04_15-51-04.267635.log
Untracked: VennDiagram.2025-02-04_15-51-04.980045.log
Untracked: VennDiagram.2025-02-04_15-51-05.512134.log
Untracked: VennDiagram.2025-02-04_15-51-06.210672.log
Untracked: VennDiagram.2025-02-04_15-51-06.306691.log
Untracked: VennDiagram.2025-02-04_15-51-06.415825.log
Untracked: VennDiagram.2025-02-04_15-51-07.425247.log
Untracked: VennDiagram.2025-02-04_15-51-07.508226.log
Untracked: VennDiagram.2025-02-04_15-51-07.580506.log
Untracked: VennDiagram.2025-02-04_15-51-08.580718.log
Untracked: VennDiagram.2025-02-04_15-51-08.652294.log
Untracked: VennDiagram.2025-02-04_15-51-08.715958.log
Untracked: VennDiagram.2025-02-04_15-51-09.479953.log
Untracked: VennDiagram.2025-02-04_15-51-09.524733.log
Untracked: VennDiagram.2025-02-04_15-51-09.61507.log
Untracked: VennDiagram.2025-02-04_15-51-10.549592.log
Untracked: VennDiagram.2025-02-04_15-51-10.666197.log
Untracked: VennDiagram.2025-02-04_15-51-10.792551.log
Untracked: VennDiagram.2025-02-04_15-51-11.85716.log
Untracked: VennDiagram.2025-02-04_15-51-12.011587.log
Untracked: VennDiagram.2025-02-04_15-51-12.164733.log
Untracked: VennDiagram.2025-02-04_15-51-13.398905.log
Untracked: VennDiagram.2025-02-04_15-51-13.55141.log
Untracked: VennDiagram.2025-02-04_15-51-13.699392.log
Untracked: VennDiagram.2025-02-04_15-51-14.087579.log
Untracked: VennDiagram.2025-02-04_15-51-14.260849.log
Untracked: VennDiagram.2025-02-04_15-51-14.416471.log
Untracked: VennDiagram.2025-02-04_15-51-18.910149.log
Untracked: VennDiagram.2025-02-04_15-51-19.532042.log
Untracked: VennDiagram.2025-02-04_15-51-20.163462.log
Untracked: VennDiagram.2025-02-04_15-51-20.811593.log
Untracked: VennDiagram.2025-02-04_15-51-21.558003.log
Untracked: VennDiagram.2025-02-04_15-51-22.100803.log
Untracked: VennDiagram.2025-02-04_15-51-23.0183.log
Untracked: VennDiagram.2025-02-04_15-51-23.077988.log
Untracked: VennDiagram.2025-02-04_15-51-24.425343.log
Untracked: VennDiagram.2025-02-04_15-51-24.510928.log
Untracked: VennDiagram.2025-02-04_15-51-24.580795.log
Untracked: VennDiagram.2025-02-04_15-51-26.015093.log
Untracked: VennDiagram.2025-02-04_15-51-26.095414.log
Untracked: VennDiagram.2025-02-04_15-51-26.161246.log
Untracked: VennDiagram.2025-02-04_15-51-27.418033.log
Untracked: VennDiagram.2025-02-04_15-51-27.458545.log
Untracked: VennDiagram.2025-02-04_15-51-27.546915.log
Untracked: VennDiagram.2025-02-04_15-51-28.98634.log
Untracked: VennDiagram.2025-02-04_15-51-29.267321.log
Untracked: VennDiagram.2025-02-04_15-51-29.364691.log
Untracked: VennDiagram.2025-02-04_15-51-30.834105.log
Untracked: VennDiagram.2025-02-04_15-51-30.911511.log
Untracked: VennDiagram.2025-02-04_15-51-31.035066.log
Untracked: VennDiagram.2025-02-04_15-51-32.690396.log
Untracked: VennDiagram.2025-02-04_15-51-32.993526.log
Untracked: VennDiagram.2025-02-04_15-51-33.109805.log
Untracked: VennDiagram.2025-02-04_15-51-33.212363.log
Untracked: VennDiagram.2025-02-04_15-51-33.325014.log
Untracked: VennDiagram.2025-02-04_15-51-33.437939.log
Untracked: VennDiagram.2025-02-04_15-51-35.207005.log
Untracked: VennDiagram.2025-02-04_15-51-35.32123.log
Untracked: VennDiagram.2025-02-04_15-51-35.441289.log
Untracked: VennDiagram.2025-02-04_15-51-36.940297.log
Untracked: VennDiagram.2025-02-04_15-51-37.04925.log
Untracked: VennDiagram.2025-02-04_15-51-37.196678.log
Untracked: VennDiagram.2025-02-04_15-56-20.402562.log
Untracked: VennDiagram.2025-02-04_15-56-21.095201.log
Untracked: VennDiagram.2025-02-04_15-56-21.658956.log
Untracked: VennDiagram.2025-02-04_15-56-22.295715.log
Untracked: VennDiagram.2025-02-04_15-56-23.00622.log
Untracked: VennDiagram.2025-02-04_15-56-23.542984.log
Untracked: VennDiagram.2025-02-04_15-56-24.241354.log
Untracked: VennDiagram.2025-02-04_15-56-24.338286.log
Untracked: VennDiagram.2025-02-04_15-56-24.447678.log
Untracked: VennDiagram.2025-02-04_15-56-25.455476.log
Untracked: VennDiagram.2025-02-04_15-56-25.536017.log
Untracked: VennDiagram.2025-02-04_15-56-25.615197.log
Untracked: VennDiagram.2025-02-04_15-56-26.549159.log
Untracked: VennDiagram.2025-02-04_15-56-26.621213.log
Untracked: VennDiagram.2025-02-04_15-56-26.697113.log
Untracked: VennDiagram.2025-02-04_15-56-27.533924.log
Untracked: VennDiagram.2025-02-04_15-56-27.600504.log
Untracked: VennDiagram.2025-02-04_15-56-27.685498.log
Untracked: VennDiagram.2025-02-04_15-56-28.700077.log
Untracked: VennDiagram.2025-02-04_15-56-28.82203.log
Untracked: VennDiagram.2025-02-04_15-56-28.940701.log
Untracked: VennDiagram.2025-02-04_15-56-30.014282.log
Untracked: VennDiagram.2025-02-04_15-56-30.134515.log
Untracked: VennDiagram.2025-02-04_15-56-30.267793.log
Untracked: VennDiagram.2025-02-04_15-56-31.471547.log
Untracked: VennDiagram.2025-02-04_15-56-31.631102.log
Untracked: VennDiagram.2025-02-04_15-56-31.755499.log
Untracked: VennDiagram.2025-02-04_15-56-32.106736.log
Untracked: VennDiagram.2025-02-04_15-56-32.2603.log
Untracked: VennDiagram.2025-02-04_15-56-32.40892.log
Untracked: VennDiagram.2025-02-04_15-56-36.746813.log
Untracked: VennDiagram.2025-02-04_15-56-37.337978.log
Untracked: VennDiagram.2025-02-04_15-56-37.956234.log
Untracked: VennDiagram.2025-02-04_15-56-38.572973.log
Untracked: VennDiagram.2025-02-04_15-56-39.229542.log
Untracked: VennDiagram.2025-02-04_15-56-39.949819.log
Untracked: VennDiagram.2025-02-04_15-56-40.899435.log
Untracked: VennDiagram.2025-02-04_15-56-40.988596.log
Untracked: VennDiagram.2025-02-04_15-56-42.38608.log
Untracked: VennDiagram.2025-02-04_15-56-42.446364.log
Untracked: VennDiagram.2025-02-04_15-56-42.535677.log
Untracked: VennDiagram.2025-02-04_15-56-43.829731.log
Untracked: VennDiagram.2025-02-04_15-56-43.877483.log
Untracked: VennDiagram.2025-02-04_15-56-43.943462.log
Untracked: VennDiagram.2025-02-04_15-56-45.152079.log
Untracked: VennDiagram.2025-02-04_15-56-45.192203.log
Untracked: VennDiagram.2025-02-04_15-56-45.244826.log
Untracked: VennDiagram.2025-02-04_15-56-46.675774.log
Untracked: VennDiagram.2025-02-04_15-56-46.884219.log
Untracked: VennDiagram.2025-02-04_15-56-47.020421.log
Untracked: VennDiagram.2025-02-04_15-56-48.520432.log
Untracked: VennDiagram.2025-02-04_15-56-48.650446.log
Untracked: VennDiagram.2025-02-04_15-56-48.805541.log
Untracked: VennDiagram.2025-02-04_15-56-50.511101.log
Untracked: VennDiagram.2025-02-04_15-56-50.665197.log
Untracked: VennDiagram.2025-02-04_15-56-50.820691.log
Untracked: VennDiagram.2025-02-04_15-56-50.979836.log
Untracked: VennDiagram.2025-02-04_15-56-51.110867.log
Untracked: VennDiagram.2025-02-04_15-56-51.267635.log
Untracked: VennDiagram.2025-02-04_15-56-53.396086.log
Untracked: VennDiagram.2025-02-04_15-56-53.522413.log
Untracked: VennDiagram.2025-02-04_15-56-53.640542.log
Untracked: VennDiagram.2025-02-04_15-56-55.024938.log
Untracked: VennDiagram.2025-02-04_15-56-55.154707.log
Untracked: VennDiagram.2025-02-04_15-56-55.302767.log
Untracked: VennDiagram.2025-02-04_15-59-13.537713.log
Untracked: VennDiagram.2025-02-04_15-59-14.194005.log
Untracked: VennDiagram.2025-02-04_15-59-14.776579.log
Untracked: VennDiagram.2025-02-04_15-59-15.416659.log
Untracked: VennDiagram.2025-02-04_15-59-16.11075.log
Untracked: VennDiagram.2025-02-04_15-59-16.642224.log
Untracked: VennDiagram.2025-02-04_15-59-17.340007.log
Untracked: VennDiagram.2025-02-04_15-59-17.441869.log
Untracked: VennDiagram.2025-02-04_15-59-17.551239.log
Untracked: VennDiagram.2025-02-04_15-59-18.543717.log
Untracked: VennDiagram.2025-02-04_15-59-18.625116.log
Untracked: VennDiagram.2025-02-04_15-59-18.7291.log
Untracked: VennDiagram.2025-02-04_15-59-19.729022.log
Untracked: VennDiagram.2025-02-04_15-59-19.776203.log
Untracked: VennDiagram.2025-02-04_15-59-19.86461.log
Untracked: VennDiagram.2025-02-04_15-59-20.62887.log
Untracked: VennDiagram.2025-02-04_15-59-20.700008.log
Untracked: VennDiagram.2025-02-04_15-59-20.776797.log
Untracked: VennDiagram.2025-02-04_15-59-21.737075.log
Untracked: VennDiagram.2025-02-04_15-59-21.92142.log
Untracked: VennDiagram.2025-02-04_15-59-22.043409.log
Untracked: VennDiagram.2025-02-04_15-59-23.210811.log
Untracked: VennDiagram.2025-02-04_15-59-23.364662.log
Untracked: VennDiagram.2025-02-04_15-59-23.568013.log
Untracked: VennDiagram.2025-02-04_15-59-24.61685.log
Untracked: VennDiagram.2025-02-04_15-59-24.763047.log
Untracked: VennDiagram.2025-02-04_15-59-24.883329.log
Untracked: VennDiagram.2025-02-04_15-59-25.298418.log
Untracked: VennDiagram.2025-02-04_15-59-25.442904.log
Untracked: VennDiagram.2025-02-04_15-59-25.611716.log
Untracked: VennDiagram.2025-02-04_16-03-19.456941.log
Untracked: VennDiagram.2025-02-04_16-03-20.122554.log
Untracked: VennDiagram.2025-02-04_16-03-20.724458.log
Untracked: VennDiagram.2025-02-04_16-03-21.34842.log
Untracked: VennDiagram.2025-02-04_16-03-21.923749.log
Untracked: VennDiagram.2025-02-04_16-03-22.538917.log
Untracked: VennDiagram.2025-02-04_16-03-23.262906.log
Untracked: VennDiagram.2025-02-04_16-03-23.382086.log
Untracked: VennDiagram.2025-02-04_16-03-23.477625.log
Untracked: VennDiagram.2025-02-04_16-03-24.502105.log
Untracked: VennDiagram.2025-02-04_16-03-24.599716.log
Untracked: VennDiagram.2025-02-04_16-03-24.761148.log
Untracked: VennDiagram.2025-02-04_16-03-25.714138.log
Untracked: VennDiagram.2025-02-04_16-03-25.7816.log
Untracked: VennDiagram.2025-02-04_16-03-25.846224.log
Untracked: VennDiagram.2025-02-04_16-03-26.692148.log
Untracked: VennDiagram.2025-02-04_16-03-26.763157.log
Untracked: VennDiagram.2025-02-04_16-03-26.828708.log
Untracked: VennDiagram.2025-02-04_16-03-27.792087.log
Untracked: VennDiagram.2025-02-04_16-03-27.901277.log
Untracked: VennDiagram.2025-02-04_16-03-28.003051.log
Untracked: VennDiagram.2025-02-04_16-03-29.081778.log
Untracked: VennDiagram.2025-02-04_16-03-29.194234.log
Untracked: VennDiagram.2025-02-04_16-03-29.319064.log
Untracked: VennDiagram.2025-02-04_16-03-30.660073.log
Untracked: VennDiagram.2025-02-04_16-03-30.793228.log
Untracked: VennDiagram.2025-02-04_16-03-30.913003.log
Untracked: VennDiagram.2025-02-04_16-03-31.263501.log
Untracked: VennDiagram.2025-02-04_16-03-31.4398.log
Untracked: VennDiagram.2025-02-04_16-03-31.563746.log
Untracked: VennDiagram.2025-02-04_16-03-36.070518.log
Untracked: VennDiagram.2025-02-04_16-03-36.669898.log
Untracked: VennDiagram.2025-02-04_16-03-37.282008.log
Untracked: VennDiagram.2025-02-04_16-03-37.927826.log
Untracked: VennDiagram.2025-02-04_16-03-38.576564.log
Untracked: VennDiagram.2025-02-04_16-03-39.286332.log
Untracked: VennDiagram.2025-02-04_16-03-40.309703.log
Untracked: VennDiagram.2025-02-04_16-03-40.407387.log
Untracked: VennDiagram.2025-02-04_16-03-41.822183.log
Untracked: VennDiagram.2025-02-04_16-03-41.88328.log
Untracked: VennDiagram.2025-02-04_16-03-41.954768.log
Untracked: VennDiagram.2025-02-04_16-03-43.224878.log
Untracked: VennDiagram.2025-02-04_16-03-43.308812.log
Untracked: VennDiagram.2025-02-04_16-03-43.375439.log
Untracked: VennDiagram.2025-02-04_16-03-44.589314.log
Untracked: VennDiagram.2025-02-04_16-03-44.628562.log
Untracked: VennDiagram.2025-02-04_16-03-44.681486.log
Untracked: VennDiagram.2025-02-04_16-03-46.237678.log
Untracked: VennDiagram.2025-02-04_16-03-46.333901.log
Untracked: VennDiagram.2025-02-04_16-03-46.42509.log
Untracked: VennDiagram.2025-02-04_16-03-47.895502.log
Untracked: VennDiagram.2025-02-04_16-03-48.006449.log
Untracked: VennDiagram.2025-02-04_16-03-48.130001.log
Untracked: VennDiagram.2025-02-04_16-03-49.803562.log
Untracked: VennDiagram.2025-02-04_16-03-49.911734.log
Untracked: VennDiagram.2025-02-04_16-03-50.062569.log
Untracked: VennDiagram.2025-02-04_16-03-50.216238.log
Untracked: VennDiagram.2025-02-04_16-03-50.341815.log
Untracked: VennDiagram.2025-02-04_16-03-50.491867.log
Untracked: VennDiagram.2025-02-04_16-03-52.504104.log
Untracked: VennDiagram.2025-02-04_16-03-52.647679.log
Untracked: VennDiagram.2025-02-04_16-03-52.77192.log
Untracked: VennDiagram.2025-02-04_16-03-54.249174.log
Untracked: VennDiagram.2025-02-04_16-03-54.419573.log
Untracked: VennDiagram.2025-02-04_16-03-54.546233.log
Untracked: VennDiagram.2025-02-04_16-06-03.942247.log
Untracked: VennDiagram.2025-02-04_16-06-04.597651.log
Untracked: VennDiagram.2025-02-04_16-06-05.258743.log
Untracked: VennDiagram.2025-02-04_16-06-05.818308.log
Untracked: VennDiagram.2025-02-04_16-06-06.397238.log
Untracked: VennDiagram.2025-02-04_16-06-07.039869.log
Untracked: VennDiagram.2025-02-04_16-06-07.76476.log
Untracked: VennDiagram.2025-02-04_16-06-07.878622.log
Untracked: VennDiagram.2025-02-04_16-06-07.975805.log
Untracked: VennDiagram.2025-02-04_16-06-08.937264.log
Untracked: VennDiagram.2025-02-04_16-06-09.019522.log
Untracked: VennDiagram.2025-02-04_16-06-09.133352.log
Untracked: VennDiagram.2025-02-04_16-06-10.161384.log
Untracked: VennDiagram.2025-02-04_16-06-10.225207.log
Untracked: VennDiagram.2025-02-04_16-06-10.301025.log
Untracked: VennDiagram.2025-02-04_16-06-11.150667.log
Untracked: VennDiagram.2025-02-04_16-06-11.196012.log
Untracked: VennDiagram.2025-02-04_16-06-11.259451.log
Untracked: VennDiagram.2025-02-04_16-06-12.141522.log
Untracked: VennDiagram.2025-02-04_16-06-12.269124.log
Untracked: VennDiagram.2025-02-04_16-06-12.391402.log
Untracked: VennDiagram.2025-02-04_16-06-13.413282.log
Untracked: VennDiagram.2025-02-04_16-06-13.556241.log
Untracked: VennDiagram.2025-02-04_16-06-13.682501.log
Untracked: VennDiagram.2025-02-04_16-06-14.965651.log
Untracked: VennDiagram.2025-02-04_16-06-15.100663.log
Untracked: VennDiagram.2025-02-04_16-06-15.24878.log
Untracked: VennDiagram.2025-02-04_16-06-15.642978.log
Untracked: VennDiagram.2025-02-04_16-06-15.79509.log
Untracked: VennDiagram.2025-02-04_16-06-15.945777.log
Untracked: VennDiagram.2025-02-04_16-06-20.329849.log
Untracked: VennDiagram.2025-02-04_16-06-20.950387.log
Untracked: VennDiagram.2025-02-04_16-06-21.563335.log
Untracked: VennDiagram.2025-02-04_16-06-22.293862.log
Untracked: VennDiagram.2025-02-04_16-06-22.922746.log
Untracked: VennDiagram.2025-02-04_16-06-23.546467.log
Untracked: VennDiagram.2025-02-04_16-06-24.61759.log
Untracked: VennDiagram.2025-02-04_16-06-24.676216.log
Untracked: VennDiagram.2025-02-04_16-06-26.05688.log
Untracked: VennDiagram.2025-02-04_16-06-26.11542.log
Untracked: VennDiagram.2025-02-04_16-06-26.210236.log
Untracked: VennDiagram.2025-02-04_16-06-27.471835.log
Untracked: VennDiagram.2025-02-04_16-06-27.520873.log
Untracked: VennDiagram.2025-02-04_16-06-27.60499.log
Untracked: VennDiagram.2025-02-04_16-06-28.879082.log
Untracked: VennDiagram.2025-02-04_16-06-28.918751.log
Untracked: VennDiagram.2025-02-04_16-06-28.970384.log
Untracked: VennDiagram.2025-02-04_16-06-30.380686.log
Untracked: VennDiagram.2025-02-04_16-06-30.513438.log
Untracked: VennDiagram.2025-02-04_16-06-30.629794.log
Untracked: VennDiagram.2025-02-04_16-06-32.22439.log
Untracked: VennDiagram.2025-02-04_16-06-32.340402.log
Untracked: VennDiagram.2025-02-04_16-06-32.492767.log
Untracked: VennDiagram.2025-02-04_16-06-34.222258.log
Untracked: VennDiagram.2025-02-04_16-06-34.47456.log
Untracked: VennDiagram.2025-02-04_16-06-34.591863.log
Untracked: VennDiagram.2025-02-04_16-06-34.69503.log
Untracked: VennDiagram.2025-02-04_16-06-34.807902.log
Untracked: VennDiagram.2025-02-04_16-06-34.920727.log
Untracked: VennDiagram.2025-02-04_16-06-36.685321.log
Untracked: VennDiagram.2025-02-04_16-06-36.798304.log
Untracked: VennDiagram.2025-02-04_16-06-36.919383.log
Untracked: VennDiagram.2025-02-04_16-06-38.333419.log
Untracked: VennDiagram.2025-02-04_16-06-38.449796.log
Untracked: VennDiagram.2025-02-04_16-06-38.598992.log
Untracked: VennDiagram.2025-02-04_16-12-02.274913.log
Untracked: VennDiagram.2025-02-04_16-12-02.932431.log
Untracked: VennDiagram.2025-02-04_16-12-03.522126.log
Untracked: VennDiagram.2025-02-04_16-12-04.159922.log
Untracked: VennDiagram.2025-02-04_16-12-04.772384.log
Untracked: VennDiagram.2025-02-04_16-12-05.394376.log
Untracked: VennDiagram.2025-02-04_16-12-06.130134.log
Untracked: VennDiagram.2025-02-04_16-12-06.24343.log
Untracked: VennDiagram.2025-02-04_16-12-06.337776.log
Untracked: VennDiagram.2025-02-04_16-12-07.362954.log
Untracked: VennDiagram.2025-02-04_16-12-07.52706.log
Untracked: VennDiagram.2025-02-04_16-12-07.59836.log
Untracked: VennDiagram.2025-02-04_16-12-08.537271.log
Untracked: VennDiagram.2025-02-04_16-12-08.586537.log
Untracked: VennDiagram.2025-02-04_16-12-08.674844.log
Untracked: VennDiagram.2025-02-04_16-12-09.461242.log
Untracked: VennDiagram.2025-02-04_16-12-09.534623.log
Untracked: VennDiagram.2025-02-04_16-12-09.616973.log
Untracked: VennDiagram.2025-02-04_16-12-10.593938.log
Untracked: VennDiagram.2025-02-04_16-12-10.757537.log
Untracked: VennDiagram.2025-02-04_16-12-10.879413.log
Untracked: VennDiagram.2025-02-04_16-12-11.999572.log
Untracked: VennDiagram.2025-02-04_16-12-12.10911.log
Untracked: VennDiagram.2025-02-04_16-12-12.282272.log
Untracked: VennDiagram.2025-02-04_16-12-13.528949.log
Untracked: VennDiagram.2025-02-04_16-12-13.643971.log
Untracked: VennDiagram.2025-02-04_16-12-13.761816.log
Untracked: VennDiagram.2025-02-04_16-12-14.159488.log
Untracked: VennDiagram.2025-02-04_16-12-14.294344.log
Untracked: VennDiagram.2025-02-04_16-12-14.416391.log
Untracked: VennDiagram.2025-02-04_16-12-18.729863.log
Untracked: VennDiagram.2025-02-04_16-12-19.35177.log
Untracked: VennDiagram.2025-02-04_16-12-19.957128.log
Untracked: VennDiagram.2025-02-04_16-12-20.609211.log
Untracked: VennDiagram.2025-02-04_16-12-21.374131.log
Untracked: VennDiagram.2025-02-04_16-12-21.962027.log
Untracked: VennDiagram.2025-02-04_16-12-22.870443.log
Untracked: VennDiagram.2025-02-04_16-12-22.983807.log
Untracked: VennDiagram.2025-02-04_16-12-24.340475.log
Untracked: VennDiagram.2025-02-04_16-12-24.441685.log
Untracked: VennDiagram.2025-02-04_16-12-24.538528.log
Untracked: VennDiagram.2025-02-04_16-12-25.924598.log
Untracked: VennDiagram.2025-02-04_16-12-26.005768.log
Untracked: VennDiagram.2025-02-04_16-12-26.068207.log
Untracked: VennDiagram.2025-02-04_16-12-27.340775.log
Untracked: VennDiagram.2025-02-04_16-12-27.41637.log
Untracked: VennDiagram.2025-02-04_16-12-27.469742.log
Untracked: VennDiagram.2025-02-04_16-12-28.945452.log
Untracked: VennDiagram.2025-02-04_16-12-29.208674.log
Untracked: VennDiagram.2025-02-04_16-12-29.317044.log
Untracked: VennDiagram.2025-02-04_16-12-30.691493.log
Untracked: VennDiagram.2025-02-04_16-12-30.804669.log
Untracked: VennDiagram.2025-02-04_16-12-30.929422.log
Untracked: VennDiagram.2025-02-04_16-12-32.578919.log
Untracked: VennDiagram.2025-02-04_16-12-32.690565.log
Untracked: VennDiagram.2025-02-04_16-12-33.010214.log
Untracked: VennDiagram.2025-02-04_16-12-33.130886.log
Untracked: VennDiagram.2025-02-04_16-12-33.23233.log
Untracked: VennDiagram.2025-02-04_16-12-33.346093.log
Untracked: VennDiagram.2025-02-04_16-12-35.11223.log
Untracked: VennDiagram.2025-02-04_16-12-35.234636.log
Untracked: VennDiagram.2025-02-04_16-12-35.412338.log
Untracked: VennDiagram.2025-02-04_16-12-36.809428.log
Untracked: VennDiagram.2025-02-04_16-12-36.966434.log
Untracked: VennDiagram.2025-02-04_16-12-37.090813.log
Untracked: VennDiagram.2025-02-04_16-14-21.771295.log
Untracked: VennDiagram.2025-02-04_16-14-22.422352.log
Untracked: VennDiagram.2025-02-04_16-14-23.025853.log
Untracked: VennDiagram.2025-02-04_16-14-23.647933.log
Untracked: VennDiagram.2025-02-04_16-14-24.258311.log
Untracked: VennDiagram.2025-02-04_16-15-42.955833.log
Untracked: VennDiagram.2025-02-04_16-15-43.62272.log
Untracked: VennDiagram.2025-02-04_16-15-44.21455.log
Untracked: VennDiagram.2025-02-04_16-15-44.829027.log
Untracked: VennDiagram.2025-02-04_16-15-45.425896.log
Untracked: VennDiagram.2025-02-04_16-15-46.028253.log
Untracked: VennDiagram.2025-02-04_16-15-46.740942.log
Untracked: VennDiagram.2025-02-04_16-15-46.857683.log
Untracked: VennDiagram.2025-02-04_16-15-46.953744.log
Untracked: VennDiagram.2025-02-04_16-15-47.975044.log
Untracked: VennDiagram.2025-02-04_16-15-48.047837.log
Untracked: VennDiagram.2025-02-04_16-15-48.14101.log
Untracked: VennDiagram.2025-02-04_16-15-49.108844.log
Untracked: VennDiagram.2025-02-04_16-15-49.153279.log
Untracked: VennDiagram.2025-02-04_16-15-49.239038.log
Untracked: VennDiagram.2025-02-04_16-15-50.00323.log
Untracked: VennDiagram.2025-02-04_16-15-50.051195.log
Untracked: VennDiagram.2025-02-04_16-15-50.141141.log
Untracked: VennDiagram.2025-02-04_16-15-51.094422.log
Untracked: VennDiagram.2025-02-04_16-15-51.221538.log
Untracked: VennDiagram.2025-02-04_16-15-51.404995.log
Untracked: VennDiagram.2025-02-04_16-15-52.487124.log
Untracked: VennDiagram.2025-02-04_16-15-52.608372.log
Untracked: VennDiagram.2025-02-04_16-15-52.725623.log
Untracked: VennDiagram.2025-02-04_16-15-53.979482.log
Untracked: VennDiagram.2025-02-04_16-15-54.108491.log
Untracked: VennDiagram.2025-02-04_16-15-54.225091.log
Untracked: VennDiagram.2025-02-04_16-15-54.590899.log
Untracked: VennDiagram.2025-02-04_16-15-54.763887.log
Untracked: VennDiagram.2025-02-04_16-15-54.906697.log
Untracked: VennDiagram.2025-02-04_16-15-59.404626.log
Untracked: VennDiagram.2025-02-04_16-16-00.054176.log
Untracked: VennDiagram.2025-02-04_16-16-00.693532.log
Untracked: VennDiagram.2025-02-04_16-16-01.355832.log
Untracked: VennDiagram.2025-02-04_16-16-02.086632.log
Untracked: VennDiagram.2025-02-04_16-16-02.760966.log
Untracked: VennDiagram.2025-02-04_16-16-03.779751.log
Untracked: VennDiagram.2025-02-04_16-16-03.834407.log
Untracked: VennDiagram.2025-02-04_16-16-05.101907.log
Untracked: VennDiagram.2025-02-04_16-16-05.156179.log
Untracked: VennDiagram.2025-02-04_16-16-05.258581.log
Untracked: VennDiagram.2025-02-04_16-16-06.538277.log
Untracked: VennDiagram.2025-02-04_16-16-06.615982.log
Untracked: VennDiagram.2025-02-04_16-16-06.673954.log
Untracked: VennDiagram.2025-02-04_16-16-07.932354.log
Untracked: VennDiagram.2025-02-04_16-16-08.010023.log
Untracked: VennDiagram.2025-02-04_16-16-08.06288.log
Untracked: VennDiagram.2025-02-04_16-16-09.589912.log
Untracked: VennDiagram.2025-02-04_16-16-09.694367.log
Untracked: VennDiagram.2025-02-04_16-16-09.860535.log
Untracked: VennDiagram.2025-02-04_16-16-11.398989.log
Untracked: VennDiagram.2025-02-04_16-16-11.502119.log
Untracked: VennDiagram.2025-02-04_16-16-11.67713.log
Untracked: VennDiagram.2025-02-04_16-16-13.415655.log
Untracked: VennDiagram.2025-02-04_16-16-13.56655.log
Untracked: VennDiagram.2025-02-04_16-16-13.842569.log
Untracked: VennDiagram.2025-02-04_16-16-13.960506.log
Untracked: VennDiagram.2025-02-04_16-16-14.075204.log
Untracked: VennDiagram.2025-02-04_16-16-14.18127.log
Untracked: VennDiagram.2025-02-04_16-16-16.021481.log
Untracked: VennDiagram.2025-02-04_16-16-16.152576.log
Untracked: VennDiagram.2025-02-04_16-16-16.2715.log
Untracked: VennDiagram.2025-02-04_16-16-17.660411.log
Untracked: VennDiagram.2025-02-04_16-16-17.790705.log
Untracked: VennDiagram.2025-02-04_16-16-17.940519.log
Untracked: VennDiagram.2025-02-04_16-17-38.232672.log
Untracked: VennDiagram.2025-02-04_16-17-38.897013.log
Untracked: VennDiagram.2025-02-04_16-17-39.484984.log
Untracked: VennDiagram.2025-02-04_16-17-40.105697.log
Untracked: VennDiagram.2025-02-04_16-17-40.684753.log
Untracked: VennDiagram.2025-02-04_16-17-41.281863.log
Untracked: VennDiagram.2025-02-04_16-17-42.00645.log
Untracked: VennDiagram.2025-02-04_16-17-42.121064.log
Untracked: VennDiagram.2025-02-04_16-17-42.211807.log
Untracked: VennDiagram.2025-02-04_16-17-43.255978.log
Untracked: VennDiagram.2025-02-04_16-17-43.423607.log
Untracked: VennDiagram.2025-02-04_16-17-43.494185.log
Untracked: VennDiagram.2025-02-04_16-17-44.381402.log
Untracked: VennDiagram.2025-02-04_16-17-44.4276.log
Untracked: VennDiagram.2025-02-04_16-17-44.586134.log
Untracked: VennDiagram.2025-02-04_16-17-45.350184.log
Untracked: VennDiagram.2025-02-04_16-17-45.395401.log
Untracked: VennDiagram.2025-02-04_16-17-45.476579.log
Untracked: VennDiagram.2025-02-04_16-17-46.446921.log
Untracked: VennDiagram.2025-02-04_16-17-46.556267.log
Untracked: VennDiagram.2025-02-04_16-17-46.699112.log
Untracked: VennDiagram.2025-02-04_16-17-47.831634.log
Untracked: VennDiagram.2025-02-04_16-17-47.96449.log
Untracked: VennDiagram.2025-02-04_16-17-48.077348.log
Untracked: VennDiagram.2025-02-04_16-17-49.23306.log
Untracked: VennDiagram.2025-02-04_16-17-49.393659.log
Untracked: VennDiagram.2025-02-04_16-17-49.54087.log
Untracked: VennDiagram.2025-02-04_16-17-49.903859.log
Untracked: VennDiagram.2025-02-04_16-17-50.05872.log
Untracked: VennDiagram.2025-02-04_16-17-50.209251.log
Untracked: VennDiagram.2025-02-04_16-17-54.730027.log
Untracked: VennDiagram.2025-02-04_16-17-55.349865.log
Untracked: VennDiagram.2025-02-04_16-17-55.99619.log
Untracked: VennDiagram.2025-02-04_16-17-56.724636.log
Untracked: VennDiagram.2025-02-04_16-17-57.353846.log
Untracked: VennDiagram.2025-02-04_16-17-58.030999.log
Untracked: VennDiagram.2025-02-04_16-17-59.051764.log
Untracked: VennDiagram.2025-02-04_16-17-59.140338.log
Untracked: VennDiagram.2025-02-04_16-18-00.584844.log
Untracked: VennDiagram.2025-02-04_16-18-00.642488.log
Untracked: VennDiagram.2025-02-04_16-18-00.746612.log
Untracked: VennDiagram.2025-02-04_16-18-02.0296.log
Untracked: VennDiagram.2025-02-04_16-18-02.076195.log
Untracked: VennDiagram.2025-02-04_16-18-02.161693.log
Untracked: VennDiagram.2025-02-04_16-18-03.484097.log
Untracked: VennDiagram.2025-02-04_16-18-03.52421.log
Untracked: VennDiagram.2025-02-04_16-18-03.579092.log
Untracked: VennDiagram.2025-02-04_16-18-04.969915.log
Untracked: VennDiagram.2025-02-04_16-18-05.084231.log
Untracked: VennDiagram.2025-02-04_16-18-05.205229.log
Untracked: VennDiagram.2025-02-04_16-18-06.669512.log
Untracked: VennDiagram.2025-02-04_16-18-06.768238.log
Untracked: VennDiagram.2025-02-04_16-18-06.917106.log
Untracked: VennDiagram.2025-02-04_16-18-08.689433.log
Untracked: VennDiagram.2025-02-04_16-18-08.865748.log
Untracked: VennDiagram.2025-02-04_16-18-08.989122.log
Untracked: VennDiagram.2025-02-04_16-18-09.114462.log
Untracked: VennDiagram.2025-02-04_16-18-09.260063.log
Untracked: VennDiagram.2025-02-04_16-18-09.382712.log
Untracked: VennDiagram.2025-02-04_16-18-11.370224.log
Untracked: VennDiagram.2025-02-04_16-18-11.507071.log
Untracked: VennDiagram.2025-02-04_16-18-11.659949.log
Untracked: VennDiagram.2025-02-04_16-18-13.186794.log
Untracked: VennDiagram.2025-02-04_16-18-13.445492.log
Untracked: VennDiagram.2025-02-04_16-18-13.559455.log
Untracked: VennDiagram.2025-02-04_16-30-31.693215.log
Untracked: VennDiagram.2025-02-04_16-30-32.378128.log
Untracked: VennDiagram.2025-02-04_16-30-32.96341.log
Untracked: VennDiagram.2025-02-04_16-30-33.571783.log
Untracked: VennDiagram.2025-02-04_16-30-34.155161.log
Untracked: VennDiagram.2025-02-04_16-30-34.746619.log
Untracked: VennDiagram.2025-02-04_16-30-35.467718.log
Untracked: VennDiagram.2025-02-04_16-30-35.585431.log
Untracked: VennDiagram.2025-02-04_16-30-35.682214.log
Untracked: VennDiagram.2025-02-04_16-30-36.785092.log
Untracked: VennDiagram.2025-02-04_16-30-36.843795.log
Untracked: VennDiagram.2025-02-04_16-30-36.929023.log
Untracked: VennDiagram.2025-02-04_16-30-37.828219.log
Untracked: VennDiagram.2025-02-04_16-30-37.871445.log
Untracked: VennDiagram.2025-02-04_16-30-38.036068.log
Untracked: VennDiagram.2025-02-04_16-30-38.798233.log
Untracked: VennDiagram.2025-02-04_16-30-38.84433.log
Untracked: VennDiagram.2025-02-04_16-30-38.926578.log
Untracked: VennDiagram.2025-02-04_16-30-39.866659.log
Untracked: VennDiagram.2025-02-04_16-30-39.975476.log
Untracked: VennDiagram.2025-02-04_16-30-40.116958.log
Untracked: VennDiagram.2025-02-04_16-30-41.214545.log
Untracked: VennDiagram.2025-02-04_16-30-41.369314.log
Untracked: VennDiagram.2025-02-04_16-30-41.49635.log
Untracked: VennDiagram.2025-02-04_16-30-42.84708.log
Untracked: VennDiagram.2025-02-04_16-30-42.994217.log
Untracked: VennDiagram.2025-02-04_16-30-43.117178.log
Untracked: VennDiagram.2025-02-04_16-30-43.512751.log
Untracked: VennDiagram.2025-02-04_16-30-43.665303.log
Untracked: VennDiagram.2025-02-04_16-30-43.812725.log
Untracked: VennDiagram.2025-02-04_16-30-48.343143.log
Untracked: VennDiagram.2025-02-04_16-30-48.968913.log
Untracked: VennDiagram.2025-02-04_16-30-49.583819.log
Untracked: VennDiagram.2025-02-04_16-30-50.23769.log
Untracked: VennDiagram.2025-02-04_16-30-50.884302.log
Untracked: VennDiagram.2025-02-04_16-30-51.669506.log
Untracked: VennDiagram.2025-02-04_16-30-52.535259.log
Untracked: VennDiagram.2025-02-04_16-30-52.632441.log
Untracked: VennDiagram.2025-02-04_16-30-53.90912.log
Untracked: VennDiagram.2025-02-04_16-30-53.969732.log
Untracked: VennDiagram.2025-02-04_16-30-54.065778.log
Untracked: VennDiagram.2025-02-04_16-30-55.434489.log
Untracked: VennDiagram.2025-02-04_16-30-55.607764.log
Untracked: VennDiagram.2025-02-04_16-30-55.673356.log
Untracked: VennDiagram.2025-02-04_16-30-56.900839.log
Untracked: VennDiagram.2025-02-04_16-30-56.984147.log
Untracked: VennDiagram.2025-02-04_16-30-57.037289.log
Untracked: VennDiagram.2025-02-04_16-30-58.416746.log
Untracked: VennDiagram.2025-02-04_16-30-58.607914.log
Untracked: VennDiagram.2025-02-04_16-30-58.725849.log
Untracked: VennDiagram.2025-02-04_16-31-00.282272.log
Untracked: VennDiagram.2025-02-04_16-31-00.429415.log
Untracked: VennDiagram.2025-02-04_16-31-00.706451.log
Untracked: VennDiagram.2025-02-04_16-31-02.254516.log
Untracked: VennDiagram.2025-02-04_16-31-02.442394.log
Untracked: VennDiagram.2025-02-04_16-31-02.566027.log
Untracked: VennDiagram.2025-02-04_16-31-02.690485.log
Untracked: VennDiagram.2025-02-04_16-31-02.838229.log
Untracked: VennDiagram.2025-02-04_16-31-02.961402.log
Untracked: VennDiagram.2025-02-04_16-31-04.935973.log
Untracked: VennDiagram.2025-02-04_16-31-05.066788.log
Untracked: VennDiagram.2025-02-04_16-31-05.188204.log
Untracked: VennDiagram.2025-02-04_16-31-06.611575.log
Untracked: VennDiagram.2025-02-04_16-31-06.72132.log
Untracked: VennDiagram.2025-02-04_16-31-06.871917.log
Untracked: VennDiagram.2025-02-04_16-33-11.427229.log
Untracked: VennDiagram.2025-02-04_16-33-12.100445.log
Untracked: VennDiagram.2025-02-04_16-33-12.674309.log
Untracked: VennDiagram.2025-02-04_16-33-13.290178.log
Untracked: VennDiagram.2025-02-04_16-33-13.878369.log
Untracked: VennDiagram.2025-02-04_16-33-14.48252.log
Untracked: VennDiagram.2025-02-04_16-33-15.204622.log
Untracked: VennDiagram.2025-02-04_16-33-15.318041.log
Untracked: VennDiagram.2025-02-04_16-33-15.413652.log
Untracked: VennDiagram.2025-02-04_16-33-16.432558.log
Untracked: VennDiagram.2025-02-04_16-33-16.50479.log
Untracked: VennDiagram.2025-02-04_16-33-16.5934.log
Untracked: VennDiagram.2025-02-04_16-33-17.564593.log
Untracked: VennDiagram.2025-02-04_16-33-17.607638.log
Untracked: VennDiagram.2025-02-04_16-33-17.697567.log
Untracked: VennDiagram.2025-02-04_16-33-18.466234.log
Untracked: VennDiagram.2025-02-04_16-33-18.51172.log
Untracked: VennDiagram.2025-02-04_16-33-18.600298.log
Untracked: VennDiagram.2025-02-04_16-33-19.552386.log
Untracked: VennDiagram.2025-02-04_16-33-19.679623.log
Untracked: VennDiagram.2025-02-04_16-33-19.863219.log
Untracked: VennDiagram.2025-02-04_16-33-20.939139.log
Untracked: VennDiagram.2025-02-04_16-33-21.061752.log
Untracked: VennDiagram.2025-02-04_16-33-21.180721.log
Untracked: VennDiagram.2025-02-04_16-33-22.412045.log
Untracked: VennDiagram.2025-02-04_16-33-22.541654.log
Untracked: VennDiagram.2025-02-04_16-33-22.663861.log
Untracked: VennDiagram.2025-02-04_16-33-23.044702.log
Untracked: VennDiagram.2025-02-04_16-33-23.214578.log
Untracked: VennDiagram.2025-02-04_16-33-23.36391.log
Untracked: VennDiagram.2025-02-04_16-33-27.702786.log
Untracked: VennDiagram.2025-02-04_16-33-28.307444.log
Untracked: VennDiagram.2025-02-04_16-33-28.94418.log
Untracked: VennDiagram.2025-02-04_16-33-29.565052.log
Untracked: VennDiagram.2025-02-04_16-33-30.248131.log
Untracked: VennDiagram.2025-02-04_16-33-30.940797.log
Untracked: VennDiagram.2025-02-04_16-33-31.943642.log
Untracked: VennDiagram.2025-02-04_16-33-32.004441.log
Untracked: VennDiagram.2025-02-04_16-33-33.384465.log
Untracked: VennDiagram.2025-02-04_16-33-33.446326.log
Untracked: VennDiagram.2025-02-04_16-33-33.543718.log
Untracked: VennDiagram.2025-02-04_16-33-34.806561.log
Untracked: VennDiagram.2025-02-04_16-33-34.854525.log
Untracked: VennDiagram.2025-02-04_16-33-34.942816.log
Untracked: VennDiagram.2025-02-04_16-33-36.136098.log
Untracked: VennDiagram.2025-02-04_16-33-36.176521.log
Untracked: VennDiagram.2025-02-04_16-33-36.26505.log
Untracked: VennDiagram.2025-02-04_16-33-37.645451.log
Untracked: VennDiagram.2025-02-04_16-33-37.878764.log
Untracked: VennDiagram.2025-02-04_16-33-37.994782.log
Untracked: VennDiagram.2025-02-04_16-33-39.497397.log
Untracked: VennDiagram.2025-02-04_16-33-39.617763.log
Untracked: VennDiagram.2025-02-04_16-33-39.773626.log
Untracked: VennDiagram.2025-02-04_16-33-41.486858.log
Untracked: VennDiagram.2025-02-04_16-33-41.672077.log
Untracked: VennDiagram.2025-02-04_16-33-41.828907.log
Untracked: VennDiagram.2025-02-04_16-33-41.960911.log
Untracked: VennDiagram.2025-02-04_16-33-42.118348.log
Untracked: VennDiagram.2025-02-04_16-33-42.251625.log
Untracked: VennDiagram.2025-02-04_16-33-44.25211.log
Untracked: VennDiagram.2025-02-04_16-33-44.395885.log
Untracked: VennDiagram.2025-02-04_16-33-44.554582.log
Untracked: VennDiagram.2025-02-04_16-33-46.128515.log
Untracked: VennDiagram.2025-02-04_16-33-46.239657.log
Untracked: VennDiagram.2025-02-04_16-33-46.360385.log
Untracked: VennDiagram.2025-02-04_16-35-28.368862.log
Untracked: VennDiagram.2025-02-04_16-35-29.036521.log
Untracked: VennDiagram.2025-02-04_16-35-29.621278.log
Untracked: VennDiagram.2025-02-04_16-35-30.238244.log
Untracked: VennDiagram.2025-02-04_16-35-30.814834.log
Untracked: VennDiagram.2025-02-04_16-35-31.413902.log
Untracked: VennDiagram.2025-02-04_16-35-32.129073.log
Untracked: VennDiagram.2025-02-04_16-35-32.247435.log
Untracked: VennDiagram.2025-02-04_16-35-32.342143.log
Untracked: VennDiagram.2025-02-04_16-35-33.355516.log
Untracked: VennDiagram.2025-02-04_16-35-33.428751.log
Untracked: VennDiagram.2025-02-04_16-35-33.520046.log
Untracked: VennDiagram.2025-02-04_16-35-34.491357.log
Untracked: VennDiagram.2025-02-04_16-35-34.538731.log
Untracked: VennDiagram.2025-02-04_16-35-34.626301.log
Untracked: VennDiagram.2025-02-04_16-35-35.396347.log
Untracked: VennDiagram.2025-02-04_16-35-35.443151.log
Untracked: VennDiagram.2025-02-04_16-35-35.532797.log
Untracked: VennDiagram.2025-02-04_16-35-36.483906.log
Untracked: VennDiagram.2025-02-04_16-35-36.612519.log
Untracked: VennDiagram.2025-02-04_16-35-36.799288.log
Untracked: VennDiagram.2025-02-04_16-35-37.862995.log
Untracked: VennDiagram.2025-02-04_16-35-37.987709.log
Untracked: VennDiagram.2025-02-04_16-35-38.104399.log
Untracked: VennDiagram.2025-02-04_16-35-39.311019.log
Untracked: VennDiagram.2025-02-04_16-35-39.441899.log
Untracked: VennDiagram.2025-02-04_16-35-39.563083.log
Untracked: VennDiagram.2025-02-04_16-35-39.937114.log
Untracked: VennDiagram.2025-02-04_16-35-40.108825.log
Untracked: VennDiagram.2025-02-04_16-35-40.257151.log
Untracked: VennDiagram.2025-02-04_16-35-44.628394.log
Untracked: VennDiagram.2025-02-04_16-35-45.22156.log
Untracked: VennDiagram.2025-02-04_16-35-45.857021.log
Untracked: VennDiagram.2025-02-04_16-35-46.467628.log
Untracked: VennDiagram.2025-02-04_16-35-47.152252.log
Untracked: VennDiagram.2025-02-04_16-35-47.862686.log
Untracked: VennDiagram.2025-02-04_16-35-48.860778.log
Untracked: VennDiagram.2025-02-04_16-35-48.91908.log
Untracked: VennDiagram.2025-02-04_16-35-50.296273.log
Untracked: VennDiagram.2025-02-04_16-35-50.358084.log
Untracked: VennDiagram.2025-02-04_16-35-50.451748.log
Untracked: VennDiagram.2025-02-04_16-35-51.712735.log
Untracked: VennDiagram.2025-02-04_16-35-51.760251.log
Untracked: VennDiagram.2025-02-04_16-35-51.848392.log
Untracked: VennDiagram.2025-02-04_16-35-53.056454.log
Untracked: VennDiagram.2025-02-04_16-35-53.097502.log
Untracked: VennDiagram.2025-02-04_16-35-53.185374.log
Untracked: VennDiagram.2025-02-04_16-35-54.546121.log
Untracked: VennDiagram.2025-02-04_16-35-54.78001.log
Untracked: VennDiagram.2025-02-04_16-35-54.89365.log
Untracked: VennDiagram.2025-02-04_16-35-56.381624.log
Untracked: VennDiagram.2025-02-04_16-35-56.498873.log
Untracked: VennDiagram.2025-02-04_16-35-56.655967.log
Untracked: VennDiagram.2025-02-04_16-35-58.369131.log
Untracked: VennDiagram.2025-02-04_16-35-58.558426.log
Untracked: VennDiagram.2025-02-04_16-35-58.68916.log
Untracked: VennDiagram.2025-02-04_16-35-58.844203.log
Untracked: VennDiagram.2025-02-04_16-35-59.003046.log
Untracked: VennDiagram.2025-02-04_16-35-59.136486.log
Untracked: VennDiagram.2025-02-04_16-36-01.109875.log
Untracked: VennDiagram.2025-02-04_16-36-01.251401.log
Untracked: VennDiagram.2025-02-04_16-36-01.370341.log
Untracked: VennDiagram.2025-02-04_16-36-02.939444.log
Untracked: VennDiagram.2025-02-04_16-36-03.076017.log
Untracked: VennDiagram.2025-02-04_16-36-03.216413.log
Untracked: analysis/VennDiagram.2025-02-04_16-26-08.058431.log
Untracked: analysis/VennDiagram.2025-02-04_16-26-08.474707.log
Untracked: analysis/VennDiagram.2025-02-04_16-26-08.781517.log
Untracked: data/orthofinder/Polyneoptera/Orthogroups/Orthogroups.tsv
Untracked: data/orthofinder/Polyneoptera/Orthogroups/Orthogroups.txt
Untracked: data/orthofinder/Polyneoptera/Orthogroups/Orthogroups_reprocessed.tsv
Untracked: data/orthofinder/Polyneoptera/Orthogroups/Orthogroups_reprocessed.txt
Untracked: data/orthofinder/Schistocerca/Orthogroups/Orthogroups.tsv
Untracked: data/orthofinder/Schistocerca/Orthogroups/Orthogroups.txt
Untracked: data/orthofinder/Schistocerca/Orthogroups/Orthogroups_reprocessed.tsv
Untracked: data/orthofinder/Schistocerca/Orthogroups/Orthogroups_reprocessed.txt
Untracked: data/overlap/
Untracked: data/readcounts/
Unstaged changes:
Modified: analysis/3_deg-analysis.Rmd
Modified: analysis/3_deseq2-results.Rmd
Modified: analysis/3_overlap-venn.Rmd
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815241_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815242_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815243_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815244_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815245_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815246_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815247_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815248_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815249_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_G_Crd_SRR11815250_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815252_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815253_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815254_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815255_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815256_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815257_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815258_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815259_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815260_featurecounts.txt
Deleted: data/03-americana-DESeq2-togregaria/SAMER_S_Iso_SRR11815263_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815241_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815241_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815242_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815242_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815243_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815243_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815244_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815244_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815245_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815245_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815246_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815246_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815247_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815247_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815248_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815248_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815249_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815249_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815250_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_G_Crd_SRR11815250_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815252_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815252_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815253_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815253_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815254_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815254_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815255_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815255_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815256_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815256_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815257_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815257_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815258_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815258_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815259_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815259_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815260_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815260_featurecounts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815263_counts.txt
Deleted: data/03-americana-DESeq2/SAMER_S_Iso_SRR11815263_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648042_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648043_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648048_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648049_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648056_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648057_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648058_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648059_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648060_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_G_Crd_SRR17648061_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648044_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648045_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648046_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648047_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648050_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648051_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648052_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648053_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648054_featurecounts.txt
Deleted: data/03-cancellata-DESeq2-togregaria/SCANC_S_Iso_SRR17648055_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648042_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648042_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648043_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648043_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648048_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648048_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648049_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648049_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648056_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648056_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648057_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648057_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648058_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648058_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648059_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648059_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648060_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648060_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648061_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_G_Crd_SRR17648061_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648044_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648044_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648045_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648045_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648046_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648046_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648047_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648047_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648050_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648050_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648051_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648051_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648052_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648052_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648053_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648053_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648054_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648054_featurecounts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648055_counts.txt
Deleted: data/03-cancellata-DESeq2/SCANC_S_Iso_SRR17648055_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815219_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815220_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815221_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815222_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815223_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815224_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815225_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815226_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815227_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_G_Crd_SRR11815228_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815230_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815231_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815232_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815233_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815234_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815235_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815236_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815237_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815238_featurecounts.txt
Deleted: data/03-cubense-DESeq2-togregaria/SSCUB_S_Iso_SRR11815239_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815219_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815219_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815220_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815220_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815221_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815221_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815222_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815222_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815223_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815223_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815224_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815224_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815225_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815225_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815226_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815226_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815227_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815227_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815228_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_G_Crd_SRR11815228_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815230_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815230_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815231_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815231_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815232_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815232_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815233_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815233_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815234_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815234_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815235_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815235_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815236_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815236_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815237_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815237_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815238_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815238_featurecounts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815239_counts.txt
Deleted: data/03-cubense-DESeq2/SSCUB_S_Iso_SRR11815239_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-CRD-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-HEAD-ISO-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-CRD-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2-togregaria/SGRE-THOX-ISO-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-1_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-2_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-3_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-4_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-5_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-6_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-CRD-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-1_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-2_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-3_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-4_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-5_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-6_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-HEAD-ISO-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-1_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-2_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-3_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-4_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-5_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-6_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-CRD-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-1_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-1_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-2_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-2_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-3_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-3_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-4_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-4_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-5_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-5_MERGE_featurecounts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-6_MERGE_counts.txt
Deleted: data/03-gregaria-DESeq2/SGRE-THOX-ISO-6_MERGE_featurecounts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-1-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-2-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-3-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-5-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-6-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-CCT-8-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-2-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-4-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-5-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-6-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-8-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-G-I72-9-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-2-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-3-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-4-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-5-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-6-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-C72-7-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-1-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-10-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-2-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-5-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-6-AGY_counts.txt
Deleted: data/03-gregaria-vivian/GREG-S-ICT-8-AGY_counts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815197_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815198_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815199_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815200_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815201_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815202_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815203_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815204_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815205_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_G_Crd_SRR11815206_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815208_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815209_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815210_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815211_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815212_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815213_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815214_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815215_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815216_featurecounts.txt
Deleted: data/03-nitens-DESeq2-togregaria/SNITE_S_Iso_SRR11815217_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815197_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815197_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815198_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815198_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815199_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815199_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815200_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815200_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815201_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815201_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815202_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815202_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815203_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815203_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815204_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815204_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815205_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815205_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815206_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_G_Crd_SRR11815206_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815208_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815208_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815209_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815209_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815210_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815210_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815211_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815211_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815212_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815212_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815213_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815213_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815214_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815214_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815215_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815215_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815216_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815216_featurecounts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815217_counts.txt
Deleted: data/03-nitens-DESeq2/SNITE_S_Iso_SRR11815217_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815262_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815264_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815265_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815266_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815267_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815268_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815269_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815270_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815271_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_G_Crd_SRR11815272_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815195_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815196_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815207_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815218_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815229_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815240_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815251_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815261_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815273_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2-togregaria/SPICE_S_Iso_SRR11815274_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815262_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815262_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815264_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815264_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815265_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815265_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815266_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815266_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815267_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815267_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815268_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815268_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815269_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815269_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815270_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815270_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815271_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815271_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815272_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_G_Crd_SRR11815272_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815195_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815195_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815196_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815196_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815207_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815207_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815218_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815218_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815229_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815229_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815240_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815240_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815251_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815251_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815261_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815261_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815273_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815273_featurecounts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815274_counts.txt
Deleted: data/03-piceifrons-DESeq2/SPICE_S_Iso_SRR11815274_featurecounts.txt
Modified: data/DEG-results/overlapping_genes_head_thorax_americana.csv
Modified: data/DEG-results/overlapping_genes_head_thorax_cancellata.csv
Modified: data/DEG-results/overlapping_genes_head_thorax_cubense.csv
Modified: data/DEG-results/overlapping_genes_head_thorax_piceifrons.csv
Modified: data/DEG-results/scatter_plot_overlapping_genes_americana.png
Modified: data/DEG-results/scatter_plot_overlapping_genes_cancellata.png
Modified: data/DEG-results/scatter_plot_overlapping_genes_cubense.png
Modified: data/DEG-results/scatter_plot_overlapping_genes_piceifrons.png
Deleted: data/orthofinder/Schistocerca/Orthogroups/Orthogroups.GeneCount 2.tsv
Deleted: data/orthofinder/Schistocerca/Orthogroups/Orthogroups_SingleCopyOrthologues 2.txt
Deleted: data/orthofinder/Schistocerca/Orthogroups/Orthogroups_UnassignedGenes 2.tsv
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/3_overlap-venn.Rmd) and
HTML (docs/3_overlap-venn.html) files. If you’ve configured
a remote Git repository (see ?wflow_git_remote), click on
the hyperlinks in the table below to view the files as they were in that
past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | faf2db3 | Maeva TECHER | 2025-01-13 | update markdown |
| Rmd | fe6dae9 | Maeva TECHER | 2024-11-19 | changes ESA |
| html | fe6dae9 | Maeva TECHER | 2024-11-19 | changes ESA |
| Rmd | 3fa8e62 | Maeva TECHER | 2024-11-09 | updated analysis |
| html | 3fa8e62 | Maeva TECHER | 2024-11-09 | updated analysis |
| Rmd | edb70fe | Maeva TECHER | 2024-11-08 | overlap and deg results created |
| html | edb70fe | Maeva TECHER | 2024-11-08 | overlap and deg results created |
| html | ba35b82 | Maeva A. TECHER | 2024-06-20 | Build site. |
| html | 45d0b6b | Maeva A. TECHER | 2024-05-16 | Build site. |
| Rmd | 5dff93d | Maeva A. TECHER | 2024-05-16 | wflow_publish("analysis/3_overlap-venn.Rmd") |
We start by loading all the required R packages.
#(install first from CRAN or Bioconductor)
library(knitr)
library(dplyr)
library(ggplot2)
library(plotly)
library(htmlwidgets) # For saving interactive plots
library(ggVennDiagram)
library(pheatmap)
library(tidyr)
library(RColorBrewer)
library(viridis)
library(kableExtra)
library(tibble)
library(VennDiagram)
library(gridExtra)
library(grid)
library(DT)
library(readr)
library(tidyverse)
library(data.table)
# Path for all species
workDir <- "/Users/maevatecher/Documents/GitHub/locust-comparative-genomics/data"
ortho_dir <- "/Users/maevatecher/Documents/GitHub/locust-comparative-genomics/data/orthofinder/Schistocerca"
allspecies_path <- file.path(workDir, "/list/allspecies_geneid.csv")
allspecies_df <- read.table(allspecies_path, sep = ",", header = TRUE, quote = "", fill = TRUE, stringsAsFactors = FALSE)
species_list <- c("gregaria", "piceifrons", "cancellata", "americana", "cubense", "nitens")
species_order <- c( "nitens", "cubense", "americana", "piceifrons", "cancellata", "gregaria")
Here our objective is to compare the abundance, composition and
overlap of the DEGs found in the head and thorax tissues of each species
between the isolated and crowded last instar females. We found that the
differential genes expressed detected by DESeq2 varied
across species and tissues but we need some perspective: Are locusts
up-regulated and down-regulated the same genes? In the later section GO
enrichment, we will investigate what are the functions of these genes as
we will see that each species seems to show different gene expression
profiles in response to density changes.
We summarized the number of genes differential expressed between density for each species and each tissues.
# Initialize empty lists to store results
summary_list_head <- list()
summary_list_thorax <- list()
# Loop through each species to process their data
for (species in species_list) {
# Read the DESeq2 results
head_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
thorax_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
head_sigresults <- fread(head_sigresults_file) # fread is faster and uses less memory
thorax_sigresults <- fread(thorax_sigresults_file)
# Count upregulated and downregulated genes for head
head_upregulated <- sum(head_sigresults$log2FoldChange > 0)
head_downregulated <- sum(head_sigresults$log2FoldChange < 0)
head_upregulated_strict <- sum(head_sigresults$log2FoldChange > 1)
head_downregulated_strict <- sum(head_sigresults$log2FoldChange < -1)
# Count upregulated and downregulated genes for thorax
thorax_upregulated <- sum(thorax_sigresults$log2FoldChange > 0)
thorax_downregulated <- sum(thorax_sigresults$log2FoldChange < 0)
thorax_upregulated_strict <- sum(thorax_sigresults$log2FoldChange > 1)
thorax_downregulated_strict <- sum(thorax_sigresults$log2FoldChange < -1)
# Store results in the list
summary_list_head[[species]] <- data.frame(
Species = species,
Head_Upregulated = head_upregulated,
Head_Downregulated = head_downregulated,
Head_Upregulated_Strict = head_upregulated_strict,
Head_Downregulated_Strict = head_downregulated_strict
)
summary_list_thorax[[species]] <- data.frame(
Species = species,
Thorax_Upregulated = thorax_upregulated,
Thorax_Downregulated = thorax_downregulated,
Thorax_Upregulated_Strict = thorax_upregulated_strict,
Thorax_Downregulated_Strict = thorax_downregulated_strict
)
}
# Combine lists into final data frames
summary_table_head <- bind_rows(summary_list_head)
summary_table_thorax <- bind_rows(summary_list_thorax)
# Print the summary table in a markdown-friendly format
knitr::kable(summary_table_head, format = "markdown", caption = "Summary of differentially expressed genes in head per species")
| Species | Head_Upregulated | Head_Downregulated | Head_Upregulated_Strict | Head_Downregulated_Strict |
|---|---|---|---|---|
| gregaria | 2709 | 2988 | 814 | 662 |
| piceifrons | 375 | 375 | 194 | 191 |
| cancellata | 689 | 756 | 301 | 386 |
| americana | 703 | 487 | 311 | 256 |
| cubense | 30 | 31 | 30 | 31 |
| nitens | 189 | 259 | 104 | 207 |
# Convert the summary table to a long format for easier plotting
summary_long_head <- summary_table_head %>%
pivot_longer(cols = c(Head_Upregulated_Strict, Head_Downregulated_Strict),
names_to = "Tissue", values_to = "Count")
# Adjust the values for downregulated genes to be negative
summary_long_head <- summary_long_head %>%
mutate(Count = ifelse(Tissue == "Head_Downregulated_Strict", -Count, Count))
summary_long_head$Species <- factor(summary_long_head$Species, levels = species_order)
# Plot barplot for head
ggplot(summary_long_head, aes(x = Species, y = Count, fill = Tissue)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Upregulated and Downregulated Genes in Head (absolute lfc >1)",
x = "Species", y = "Number of Genes") +
scale_fill_manual(values = c("Head_Upregulated_Strict" = "red2", "Head_Downregulated_Strict" = "blue")) +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200)) +
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1)) +
coord_flip()

# Print the summary table for thorax
knitr::kable(summary_table_thorax, format = "markdown", caption = "Summary of differentially expressed genes in thorax per species")
| Species | Thorax_Upregulated | Thorax_Downregulated | Thorax_Upregulated_Strict | Thorax_Downregulated_Strict |
|---|---|---|---|---|
| gregaria | 2751 | 2691 | 622 | 1174 |
| piceifrons | 1517 | 1200 | 549 | 221 |
| cancellata | 686 | 648 | 289 | 303 |
| americana | 398 | 699 | 149 | 339 |
| cubense | 104 | 218 | 64 | 154 |
| nitens | 0 | 0 | 0 | 0 |
# Convert the summary table to a long format for thorax
summary_long_thorax <- summary_table_thorax %>%
pivot_longer(cols = c(Thorax_Upregulated_Strict, Thorax_Downregulated_Strict),
names_to = "Tissue", values_to = "Count")
# Adjust the values for downregulated genes to be negative
summary_long_thorax <- summary_long_thorax %>%
mutate(Count = ifelse(Tissue == "Thorax_Downregulated_Strict", -Count, Count))
summary_long_thorax$Species <- factor(summary_long_thorax$Species, levels = species_order)
# Plot barplot for thorax
ggplot(summary_long_thorax, aes(x = Species, y = Count, fill = Tissue)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Upregulated and Downregulated Genes in Thorax (absolute lfc >1)",
x = "Species", y = "Number of Genes") +
scale_fill_manual(values = c("Thorax_Upregulated_Strict" = "red2", "Thorax_Downregulated_Strict" = "blue")) +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200)) +
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1)) +
coord_flip()

# Define custom colors for each GeneType
custom_colors <- c(
"transcribed_pseudogene" = "#F4F1BB", # Example color for transcribed_pseudogene
"protein-coding" = "#9B57D3", # Example color for protein-coding
"lncRNA" = "#A5300F", # Example color for lncRNA
"tRNA" = "#74D055FF", # Example color for tRNA
"misc_RNA" = "#3B6978", # Example color for misc_RNA
"ncRNA" = "#29AF7FFF", # Example color for ncRNA
"pseudogene" = "#81B29A", # Example color for pseudogene
"rRNA" = "#5982DB", # Example color for rRNA
"snoRNA" = "#DCE318FF", # Example color for snoRNA
"snRNA" = "#665EB8" # Example color for snRNA
)
# Use scale_fill_manual to map the custom colors to the GeneTypes
custom_color_scale <- scale_fill_manual(
values = custom_colors
)
# Create an empty list to store the data for all species
all_species_data <- list()
# Loop through each species to process their data
for (species in species_list) {
# Read the DESeq2 results for head and thorax
head_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
thorax_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
head_sigresults <- read.csv(head_sigresults_file, stringsAsFactors = FALSE)
thorax_sigresults <- read.csv(thorax_sigresults_file, stringsAsFactors = FALSE)
# Add GeneType and Species columns (from `allspecies_df`)
head_sigresults_merged <- merge(head_sigresults, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
thorax_sigresults_merged <- merge(thorax_sigresults, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
# Count for upregulated and downregulated genes in head
head_upregulated <- head_sigresults_merged %>%
filter(log2FoldChange > 1) %>%
mutate(Regulation = "Upregulated", Tissue = "Head", Count = 1)
head_downregulated <- head_sigresults_merged %>%
filter(log2FoldChange < -1) %>%
mutate(Regulation = "Downregulated", Tissue = "Head", Count = -1) # Mutate downregulated genes to negative
# Combine upregulated and downregulated genes for head
head_combined <- rbind(head_upregulated, head_downregulated)
# Ensure all GeneTypes are represented for this species, even if they have no DEGs
head_combined <- head_combined %>%
complete(GeneType = unique(allspecies_df$GeneType),
fill = list(Count = 0)) # Fill missing GeneTypes with Count = 0
# Count for upregulated and downregulated genes in thorax
thorax_upregulated <- thorax_sigresults_merged %>%
filter(log2FoldChange > 1) %>%
mutate(Regulation = "Upregulated", Tissue = "Thorax", Count = 1)
thorax_downregulated <- thorax_sigresults_merged %>%
filter(log2FoldChange < -1) %>%
mutate(Regulation = "Downregulated", Tissue = "Thorax", Count = -1) # Mutate downregulated genes to negative
# Combine upregulated and downregulated genes for thorax
thorax_combined <- rbind(thorax_upregulated, thorax_downregulated)
# Ensure all GeneTypes are represented for this species in thorax, even if they have no DEGs
thorax_combined <- thorax_combined %>%
complete(GeneType = unique(allspecies_df$GeneType),
fill = list(Count = 0)) # Fill missing GeneTypes with Count = 0
# Combine data for head and thorax into one
combined_data <- rbind(head_combined, thorax_combined)
# Add species column to the data
combined_data$Species <- species
# Append the data to the list for all species
all_species_data[[species]] <- combined_data
}
# Combine all species data into one data frame
final_data <- bind_rows(all_species_data)
# Reorder species according to the desired order
final_data$Species <- factor(final_data$Species, levels = species_order)
# Filter for head tissue only
final_data_head <- final_data %>% filter(Tissue == "Head")
final_data_thorax <- final_data %>% filter(Tissue == "Thorax")
# Create the barplot for all species and only head tissue
ggplot(final_data_head, aes(x = Species, y = Count, fill = GeneType)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "DEGs by Gene Biotype for Head (absolute lfc >1)",
x = "Species",
y = "Number of Genes") +
custom_color_scale +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200))+
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.title.x = element_text(size = 14, face = "bold"),
axis.title.y = element_text(size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
axis.text.y = element_text(size = 12),
panel.grid.major.y = element_line(color = "grey90", linetype = "dashed"),
panel.grid.minor = element_blank()) +
coord_flip() # Flip coordinates to make the plot horizontal

# Create the barplot for all species and only head tissue
ggplot(final_data_thorax, aes(x = Species, y = Count, fill = GeneType)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "DEGs by Gene Biotype for Thorax (absolute lfc >1)",
x = "Species",
y = "Number of Genes") +
custom_color_scale +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200))+
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.title.x = element_text(size = 14, face = "bold"),
axis.title.y = element_text(size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
axis.text.y = element_text(size = 12),
panel.grid.major.y = element_line(color = "grey90", linetype = "dashed"),
panel.grid.minor = element_blank()) +
coord_flip() # Flip coordinates to make the plot horizontal


species <- "gregaria" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "piceifrons" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "cancellata" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "americana" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "cubense" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "nitens" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}


# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
# Initialize an empty list to store DEG data
venn_data_locusts_up <- list()
venn_data_locusts_down <- list()
venn_data_locusts_all <- list()
# Function to load DEGs for a given group of species for head
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in locusts) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- head_up$GeneID
degs_down[[species]] <- head_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for head
venn_data_locusts <- load_deg_data(locusts)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_locusts$up[["gregaria"]],
piceifrons = venn_data_locusts$up[["piceifrons"]],
cancellata = venn_data_locusts$up[["cancellata"]]
)
venn_data_down <- list(
gregaria = venn_data_locusts$down[["gregaria"]],
piceifrons = venn_data_locusts$down[["piceifrons"]],
cancellata = venn_data_locusts$down[["cancellata"]]
)
venn_data_all <- list(
gregaria = venn_data_locusts$all[["gregaria"]],
piceifrons = venn_data_locusts$all[["piceifrons"]],
cancellata = venn_data_locusts$all[["cancellata"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata")
legend_colors <- c("orange", "red", "orchid")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for head upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - Locusts", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - Locusts", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - Locusts", allspecies_df)

# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in locusts) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
head_data <- fread(head_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
head_data_filtered <- head_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
head_up <- head_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
head_down <- head_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# **Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# **Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
# Initialize an empty list to store DEG data
venn_data_locusts_up <- list()
venn_data_locusts_down <- list()
venn_data_locusts_all <- list()
# Function to load DEGs for a given group of species for thorax
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in locusts) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$GeneID
degs_down[[species]] <- thorax_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for thorax
venn_data_locusts <- load_deg_data(locusts)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_locusts$up[["gregaria"]],
piceifrons = venn_data_locusts$up[["piceifrons"]],
cancellata = venn_data_locusts$up[["cancellata"]]
)
venn_data_down <- list(
gregaria = venn_data_locusts$down[["gregaria"]],
piceifrons = venn_data_locusts$down[["piceifrons"]],
cancellata = venn_data_locusts$down[["cancellata"]]
)
venn_data_all <- list(
gregaria = venn_data_locusts$all[["gregaria"]],
piceifrons = venn_data_locusts$all[["piceifrons"]],
cancellata = venn_data_locusts$all[["cancellata"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata")
legend_colors <- c("orange", "red", "orchid")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for thorax upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - Locusts", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - Locusts", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - Locusts", allspecies_df)

# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in locusts) {
# Load DESeq2 results for thorax
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
thorax_data <- fread(thorax_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
thorax_data_filtered <- thorax_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
thorax_up <- thorax_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
thorax_down <- thorax_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# **Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# **Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

PACclade <- c("piceifrons", "americana", "cubense")
# Initialize an empty list to store DEG data
venn_data_PACclade_up <- list()
venn_data_PACclade_down <- list()
venn_data_PACclade_all <- list()
# Function to load DEGs for a given group of species for head
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in PACclade) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- head_up$GeneID
degs_down[[species]] <- head_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for head
venn_data_PACclade <- load_deg_data(PACclade)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
piceifrons = venn_data_PACclade$up[["piceifrons"]],
americana = venn_data_PACclade$up[["americana"]],
cubense = venn_data_PACclade$up[["cubense"]]
)
venn_data_down <- list(
piceifrons = venn_data_PACclade$down[["piceifrons"]],
americana = venn_data_PACclade$down[["americana"]],
cubense = venn_data_PACclade$down[["cubense"]]
)
venn_data_all <- list(
piceifrons = venn_data_PACclade$all[["piceifrons"]],
americana = venn_data_PACclade$all[["americana"]],
cubense = venn_data_PACclade$all[["cubense"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense")
legend_colors <- c("red", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for head upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - PACclade", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - PACclade", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - PACclade", allspecies_df)

# Define the species for Group 1
PACclade <- c("piceifrons", "americana", "cubense")
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in PACclade) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
head_data <- fread(head_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
head_data_filtered <- head_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
head_up <- head_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
head_down <- head_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# *Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Define the species for PACclade
PACclade <- c("piceifrons", "americana", "cubense")
# Initialize an empty list to store DEG data
venn_data_PACclade_up <- list()
venn_data_PACclade_down <- list()
venn_data_PACclade_all <- list()
# Function to load DEGs for a given group of species for thorax
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in PACclade) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$GeneID
degs_down[[species]] <- thorax_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for thorax
venn_data_PACclade <- load_deg_data(PACclade)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
piceifrons = venn_data_PACclade$up[["piceifrons"]],
americana = venn_data_PACclade$up[["americana"]],
cubense = venn_data_PACclade$up[["cubense"]]
)
venn_data_down <- list(
piceifrons = venn_data_PACclade$down[["piceifrons"]],
americana = venn_data_PACclade$down[["americana"]],
cubense = venn_data_PACclade$down[["cubense"]]
)
venn_data_all <- list(
piceifrons = venn_data_PACclade$all[["piceifrons"]],
americana = venn_data_PACclade$all[["americana"]],
cubense = venn_data_PACclade$all[["cubense"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense")
legend_colors <- c("red", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for thorax upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - PACclade", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - PACclade", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - PACclade", allspecies_df)

PACclade <- c("piceifrons", "americana", "cubense")
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in PACclade) {
# Load DESeq2 results for thorax
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
thorax_data <- fread(thorax_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
thorax_data_filtered <- thorax_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
thorax_up <- thorax_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
thorax_down <- thorax_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# *Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

# Define the species for Group 1
plastic_species <- c("gregaria", "piceifrons", "cancellata","americana")
# Initialize an empty list to store DEG data
venn_data_plastic_species_up <- list()
venn_data_plastic_species_down <- list()
venn_data_plastic_species_all <- list()
# Function to load DEGs for a given group of species for head
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in plastic_species) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- head_up$GeneID
degs_down[[species]] <- head_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for head
venn_data_plastic_species <- load_deg_data(plastic_species)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_plastic_species$up[["gregaria"]],
piceifrons = venn_data_plastic_species$up[["piceifrons"]],
cancellata = venn_data_plastic_species$up[["cancellata"]],
americana = venn_data_plastic_species$up[["americana"]]
)
venn_data_down <- list(
gregaria = venn_data_plastic_species$down[["gregaria"]],
piceifrons = venn_data_plastic_species$down[["piceifrons"]],
cancellata = venn_data_plastic_species$down[["cancellata"]],
americana = venn_data_plastic_species$down[["americana"]]
)
venn_data_all <- list(
gregaria = venn_data_plastic_species$all[["gregaria"]],
piceifrons = venn_data_plastic_species$all[["piceifrons"]],
cancellata = venn_data_plastic_species$all[["cancellata"]],
americana = venn_data_plastic_species$all[["americana"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata","americana"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata","americana")
legend_colors <- c("orange", "red", "orchid", "green")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for head upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - plastic_species", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - plastic_species", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - plastic_species", allspecies_df)

# Define the species for Group 1
plastic_species <- c("gregaria", "piceifrons", "cancellata","americana")
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in locusts) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
head_data <- fread(head_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
head_data_filtered <- head_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
head_up <- head_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
head_down <- head_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# **Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# **Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

plastic_species <- c("gregaria", "piceifrons", "cancellata","americana")
# Initialize an empty list to store DEG data
venn_data_plastic_species_up <- list()
venn_data_plastic_species_down <- list()
venn_data_plastic_species_all <- list()
# Function to load DEGs for a given group of species for thorax
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in plastic_species) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$GeneID
degs_down[[species]] <- thorax_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for thorax
venn_data_plastic_species <- load_deg_data(plastic_species)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_plastic_species$up[["gregaria"]],
piceifrons = venn_data_plastic_species$up[["piceifrons"]],
cancellata = venn_data_plastic_species$up[["cancellata"]],
americana = venn_data_plastic_species$up[["americana"]]
)
venn_data_down <- list(
gregaria = venn_data_plastic_species$down[["gregaria"]],
piceifrons = venn_data_plastic_species$down[["piceifrons"]],
cancellata = venn_data_plastic_species$down[["cancellata"]],
americana = venn_data_plastic_species$down[["americana"]]
)
venn_data_all <- list(
gregaria = venn_data_plastic_species$all[["gregaria"]],
piceifrons = venn_data_plastic_species$all[["piceifrons"]],
cancellata = venn_data_plastic_species$all[["cancellata"]],
americana = venn_data_plastic_species$all[["americana"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata","americana"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata","americana")
legend_colors <- c("orange", "red", "orchid", "green")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for thorax upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - plastic_species", allspecies_df)

# Display the Venn diagram and datatable for thorax downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - plastic_species", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - plastic_species", allspecies_df)

plastic_species <- c("gregaria", "piceifrons", "cancellata","americana")
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in plastic_species) {
# Load DESeq2 results for thorax
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
# Load the data using fread() for memory efficiency
thorax_data <- fread(thorax_file, data.table = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter significant DEGs first (reduces memory use in sorting)
thorax_data_filtered <- thorax_data %>%
filter(padj < 0.05, abs(log2FoldChange) > 1) # Keep only strong up/downregulated DEGs
# Select top 500 upregulated and top 500 downregulated genes
thorax_up <- thorax_data_filtered %>%
filter(log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
thorax_down <- thorax_data_filtered %>%
filter(log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice_head(n = 500) # More memory-efficient than slice(1:500)
# Combine data for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Fix duplicate GeneIDs: Aggregate log2FoldChange by taking the mean**
final_heatmap_data <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarise(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop")
# *Create heatmap matrix without duplicates**
heatmap_matrix <- final_heatmap_data %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Thorax Tissue - STRATEGY 1"
)

# Define the species for Group 1
allspecies <- c("gregaria", "piceifrons", "cancellata","americana", "cubense")
# Initialize an empty list to store DEG data
venn_data_allspecies_up <- list()
venn_data_allspecies_down <- list()
venn_data_allspecies_all <- list()
# Function to load DEGs for a given group of species for head
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in allspecies) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_togregaria_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- head_up$GeneID
degs_down[[species]] <- head_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for head
venn_data_allspecies <- load_deg_data(allspecies)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_allspecies$up[["gregaria"]],
piceifrons = venn_data_allspecies$up[["piceifrons"]],
cancellata = venn_data_allspecies$up[["cancellata"]],
americana = venn_data_allspecies$up[["americana"]],
cubense = venn_data_allspecies$up[["cubense"]]
)
venn_data_down <- list(
gregaria = venn_data_allspecies$down[["gregaria"]],
piceifrons = venn_data_allspecies$down[["piceifrons"]],
cancellata = venn_data_allspecies$down[["cancellata"]],
americana = venn_data_allspecies$down[["americana"]],
cubense = venn_data_allspecies$down[["cubense"]]
)
venn_data_all <- list(
gregaria = venn_data_allspecies$all[["gregaria"]],
piceifrons = venn_data_allspecies$all[["piceifrons"]],
cancellata = venn_data_allspecies$all[["cancellata"]],
americana = venn_data_allspecies$all[["americana"]],
cubense = venn_data_allspecies$all[["cubense"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata","americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green", "yellow"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata","americana", "cubense")
legend_colors <- c("orange", "red", "orchid", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for head upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - all species", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - all species", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - all species", allspecies_df)

# Thorax
# Initialize an empty list to store DEG data
venn_data_allspecies_up <- list()
venn_data_allspecies_down <- list()
venn_data_allspecies_all <- list()
# Function to load DEGs for a given group of species for thorax
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in allspecies) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_togregaria_", species, ".csv"))
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(GeneID = X)
all_deg <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(GeneID = X)
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$GeneID
degs_down[[species]] <- thorax_down$GeneID
degs_all[[species]] <- all_deg$GeneID
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Group 1 for thorax
venn_data_allspecies <- load_deg_data(allspecies)
# Prepare the data for the Venn diagrams
venn_data_up <- list(
gregaria = venn_data_allspecies$up[["gregaria"]],
piceifrons = venn_data_allspecies$up[["piceifrons"]],
cancellata = venn_data_allspecies$up[["cancellata"]],
americana = venn_data_allspecies$up[["americana"]],
cubense = venn_data_allspecies$up[["cubense"]]
)
venn_data_down <- list(
gregaria = venn_data_allspecies$down[["gregaria"]],
piceifrons = venn_data_allspecies$down[["piceifrons"]],
cancellata = venn_data_allspecies$down[["cancellata"]],
americana = venn_data_allspecies$down[["americana"]],
cubense = venn_data_allspecies$down[["cubense"]]
)
venn_data_all <- list(
gregaria = venn_data_allspecies$all[["gregaria"]],
piceifrons = venn_data_allspecies$all[["piceifrons"]],
cancellata = venn_data_allspecies$all[["cancellata"]],
americana = venn_data_allspecies$all[["americana"]],
cubense = venn_data_allspecies$all[["cubense"]]
)
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df) {
# Calculate the overlapping genes
overlap_genes <- Reduce(intersect, venn_data)
# Create a data frame for the overlapping genes
overlap_df <- data.frame(GeneID = overlap_genes)
# Merge to get species information
meta_brock_df <- merge(overlap_df, allspecies_df, by = "GeneID", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata","americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green", "yellow"), # Set colors for the groups
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata","americana", "cubense")
legend_colors <- c("orange", "red", "orchid", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping genes table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Display the Venn diagram and datatable for thorax upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - all species", allspecies_df)

# Display the Venn diagram and datatable for head downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - all species", allspecies_df)

# Display the Venn diagram and datatable for all significant DEGs
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Significant DEGs - all species", allspecies_df)

# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in species_list) {
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
# Load the data
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs and select top 100 upregulated and downregulated genes for each tissue
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species),
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Create heatmap matrix
# Aggregate log2FoldChange values correctly
heatmap_matrix <- final_heatmap_data %>%
group_by(GeneID, Species, Tissue) %>%
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
# Convert to wide format (no need for redundant grouping)
pivot_wider(names_from = c(Species, Tissue), values_from = log2FoldChange, values_fill = 0) %>%
# Ensure unique row names
column_to_rownames("GeneID") %>%
as.matrix()
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks to ensure **black = 0**
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create first heatmap with blue-red gradient
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head and Thorax Tissue - STRATEGY 1"
)

# Create second heatmap with cyan-black-orange gradient
pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head and Thorax Tissue - STRATEGY 1"
)

# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in species_list) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_togregaria_", species, ".csv"))
# Load the data
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Filter for significant DEGs and select top 100 upregulated and downregulated genes for each tissue
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data
final_heatmap_data <- bind_rows(heatmap_list)
# Ensure all species are represented, even if they have no significant DEGs
for (species in species_order) {
if (!species %in% unique(final_heatmap_data$Species)) {
message(paste("Adding placeholder for missing species:", species))
final_heatmap_data <- bind_rows(
final_heatmap_data,
data.frame(
GeneID = "Unassigned", # Placeholder GeneID
log2FoldChange = 0,
Tissue = "Head",
Regulation = "None",
Species = species
)
)
}
}
# Ensure species order in the data
final_heatmap_data$Species <- factor(final_heatmap_data$Species, levels = species_order)
# Create heatmap matrix (Thorax only)
heatmap_matrix <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Explicitly reorder the columns in heatmap_matrix
heatmap_matrix <- heatmap_matrix[, species_order, drop = FALSE]
# Define color palettes
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks to ensure **black = 0**
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create first heatmap with blue-red gradient
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Create second heatmap with cyan-black-orange gradient
pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Gene Expression in Head Tissue - STRATEGY 1"
)

# Define species order explicitly to ensure consistency
species_order <- c("nitens", "cubense", "americana", "piceifrons", "cancellata", "gregaria")
# Initialize an empty list to store heatmap data
heatmap_list <- list()
# Loop through each species to process their Thorax data
for (species in species_order) {
message(paste("Processing species:", species))
# Define file path for Thorax
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_togregaria_", species, ".csv"))
# Check if file exists before loading
if (!file.exists(thorax_file)) {
message(paste("Missing Thorax file for:", species, "- Assigning empty dataset"))
thorax_data <- data.frame(GeneID = character(), padj = numeric(), log2FoldChange = numeric(), stringsAsFactors = FALSE)
} else {
thorax_data <- tryCatch(read.csv(thorax_file, stringsAsFactors = FALSE), error = function(e) data.frame())
}
# Ensure GeneID column exists
if (!"GeneID" %in% colnames(thorax_data) && "X" %in% colnames(thorax_data)) {
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
}
# Convert GeneID to character
thorax_data$GeneID <- as.character(thorax_data$GeneID)
# If no significant DEGs are found, ensure the structure is correct
if (nrow(thorax_data) == 0) {
message(paste("No significant Thorax DEGs for:", species, "- Assigning placeholder values"))
thorax_data <- data.frame(
GeneID = "Unassigned",
log2FoldChange = 0,
Tissue = "Thorax",
Regulation = "None",
Species = species
)
} else {
# Filter for significant DEGs and select top 500 upregulated and downregulated genes
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap
thorax_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(GeneID, log2FoldChange, Tissue, Regulation, Species)
}
# Append to heatmap list, ensuring species is represented
heatmap_list[[species]] <- thorax_data
}
# Combine all species data
final_heatmap_data <- bind_rows(heatmap_list)
# Ensure all species are represented, even if they have no significant DEGs
for (species in species_order) {
if (!species %in% unique(final_heatmap_data$Species)) {
message(paste("Adding placeholder for missing species:", species))
final_heatmap_data <- bind_rows(
final_heatmap_data,
data.frame(
GeneID = "Unassigned", # Placeholder GeneID
log2FoldChange = 0,
Tissue = "Thorax",
Regulation = "None",
Species = species
)
)
}
}
# Ensure species order in the data
final_heatmap_data$Species <- factor(final_heatmap_data$Species, levels = species_order)
# Create heatmap matrix (Thorax only)
heatmap_matrix <- final_heatmap_data %>%
group_by(GeneID, Species) %>%
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("GeneID") %>%
as.matrix()
# Explicitly reorder the columns in heatmap_matrix
heatmap_matrix <- heatmap_matrix[, species_order, drop = FALSE]
# Define color palettes
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE)
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100)
# Generate heatmaps (Only thorax)
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of GeneID Expression in Thorax Tissue - STRATEGY 1"
)

pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of GeneID Expression in Thorax Tissue - STRATEGY 1"
)

Here the difference with STRATEGY 1 is that to look at the correspondance of genes across species for comparison, we will have to use orthologs (see section Orthofinder).
We load from our previous conversion
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
We summarized the number of genes differential expressed between density for each species and each tissues.
# Initialize empty lists to store results
summary_list_head <- list()
summary_list_thorax <- list()
# Loop through each species to process their data
for (species in species_list) {
# Read the DESeq2 results
head_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
thorax_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
head_sigresults <- fread(head_sigresults_file) # fread is faster and uses less memory
thorax_sigresults <- fread(thorax_sigresults_file)
# Count upregulated and downregulated genes for head
head_upregulated <- sum(head_sigresults$log2FoldChange > 0)
head_downregulated <- sum(head_sigresults$log2FoldChange < 0)
head_upregulated_strict <- sum(head_sigresults$log2FoldChange > 1)
head_downregulated_strict <- sum(head_sigresults$log2FoldChange < -1)
# Count upregulated and downregulated genes for thorax
thorax_upregulated <- sum(thorax_sigresults$log2FoldChange > 0)
thorax_downregulated <- sum(thorax_sigresults$log2FoldChange < 0)
thorax_upregulated_strict <- sum(thorax_sigresults$log2FoldChange > 1)
thorax_downregulated_strict <- sum(thorax_sigresults$log2FoldChange < -1)
# Store results in the list
summary_list_head[[species]] <- data.frame(
Species = species,
Head_Upregulated = head_upregulated,
Head_Downregulated = head_downregulated,
Head_Upregulated_Strict = head_upregulated_strict,
Head_Downregulated_Strict = head_downregulated_strict
)
summary_list_thorax[[species]] <- data.frame(
Species = species,
Thorax_Upregulated = thorax_upregulated,
Thorax_Downregulated = thorax_downregulated,
Thorax_Upregulated_Strict = thorax_upregulated_strict,
Thorax_Downregulated_Strict = thorax_downregulated_strict
)
}
# Combine lists into final data frames
summary_table_head <- bind_rows(summary_list_head)
summary_table_thorax <- bind_rows(summary_list_thorax)
# Print the summary table in a markdown-friendly format
knitr::kable(summary_table_head, format = "markdown", caption = "Summary of differentially expressed genes in head per species")
| Species | Head_Upregulated | Head_Downregulated | Head_Upregulated_Strict | Head_Downregulated_Strict |
|---|---|---|---|---|
| gregaria | 2709 | 2988 | 814 | 662 |
| piceifrons | 538 | 518 | 301 | 263 |
| cancellata | 751 | 877 | 378 | 476 |
| americana | 802 | 619 | 357 | 339 |
| cubense | 49 | 56 | 49 | 55 |
| nitens | 233 | 314 | 122 | 245 |
# Convert the summary table to a long format for easier plotting
summary_long_head <- summary_table_head %>%
pivot_longer(cols = c(Head_Upregulated_Strict, Head_Downregulated_Strict),
names_to = "Tissue", values_to = "Count")
# Adjust the values for downregulated genes to be negative
summary_long_head <- summary_long_head %>%
mutate(Count = ifelse(Tissue == "Head_Downregulated_Strict", -Count, Count))
summary_long_head$Species <- factor(summary_long_head$Species, levels = species_order)
# Plot barplot for head
ggplot(summary_long_head, aes(x = Species, y = Count, fill = Tissue)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Upregulated and Downregulated Genes in Head (absolute lfc >1)",
x = "Species", y = "Number of Genes") +
scale_fill_manual(values = c("Head_Upregulated_Strict" = "red2", "Head_Downregulated_Strict" = "blue")) +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200)) +
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1)) +
coord_flip()

# Print the summary table for thorax
knitr::kable(summary_table_thorax, format = "markdown", caption = "Summary of differentially expressed genes in thorax per species")
| Species | Thorax_Upregulated | Thorax_Downregulated | Thorax_Upregulated_Strict | Thorax_Downregulated_Strict |
|---|---|---|---|---|
| gregaria | 2751 | 2691 | 622 | 1174 |
| piceifrons | 1641 | 1361 | 652 | 332 |
| cancellata | 734 | 738 | 324 | 376 |
| americana | 460 | 798 | 181 | 427 |
| cubense | 127 | 251 | 78 | 185 |
| nitens | 0 | 0 | 0 | 0 |
# Convert the summary table to a long format for thorax
summary_long_thorax <- summary_table_thorax %>%
pivot_longer(cols = c(Thorax_Upregulated_Strict, Thorax_Downregulated_Strict),
names_to = "Tissue", values_to = "Count")
# Adjust the values for downregulated genes to be negative
summary_long_thorax <- summary_long_thorax %>%
mutate(Count = ifelse(Tissue == "Thorax_Downregulated_Strict", -Count, Count))
summary_long_thorax$Species <- factor(summary_long_thorax$Species, levels = species_order)
# Plot barplot for thorax
ggplot(summary_long_thorax, aes(x = Species, y = Count, fill = Tissue)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Upregulated and Downregulated Genes in Thorax (absolute lfc >1)",
x = "Species", y = "Number of Genes") +
scale_fill_manual(values = c("Thorax_Upregulated_Strict" = "red2", "Thorax_Downregulated_Strict" = "blue")) +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200)) +
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1)) +
coord_flip()

# Define custom colors for each GeneType
custom_colors <- c(
"transcribed_pseudogene" = "#F4F1BB", # Example color for transcribed_pseudogene
"protein-coding" = "#9B57D3", # Example color for protein-coding
"lncRNA" = "#A5300F", # Example color for lncRNA
"tRNA" = "#74D055FF", # Example color for tRNA
"misc_RNA" = "#3B6978", # Example color for misc_RNA
"ncRNA" = "#29AF7FFF", # Example color for ncRNA
"pseudogene" = "#81B29A", # Example color for pseudogene
"rRNA" = "#5982DB", # Example color for rRNA
"snoRNA" = "#DCE318FF", # Example color for snoRNA
"snRNA" = "#665EB8" # Example color for snRNA
)
# Use scale_fill_manual to map the custom colors to the GeneTypes
custom_color_scale <- scale_fill_manual(
values = custom_colors
)
# Create an empty list to store the data for all species
all_species_data <- list()
# Loop through each species to process their data
for (species in species_list) {
# Read the DESeq2 results for head and thorax
head_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
thorax_sigresults_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
head_sigresults <- read.csv(head_sigresults_file, stringsAsFactors = FALSE)
thorax_sigresults <- read.csv(thorax_sigresults_file, stringsAsFactors = FALSE)
# Add GeneType and Species columns (from `allspecies_df`)
head_sigresults_merged <- merge(head_sigresults, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
thorax_sigresults_merged <- merge(thorax_sigresults, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
# Count for upregulated and downregulated genes in head
head_upregulated <- head_sigresults_merged %>%
filter(log2FoldChange > 1) %>%
mutate(Regulation = "Upregulated", Tissue = "Head", Count = 1)
head_downregulated <- head_sigresults_merged %>%
filter(log2FoldChange < -1) %>%
mutate(Regulation = "Downregulated", Tissue = "Head", Count = -1) # Mutate downregulated genes to negative
# Combine upregulated and downregulated genes for head
head_combined <- rbind(head_upregulated, head_downregulated)
# Ensure all GeneTypes are represented for this species, even if they have no DEGs
head_combined <- head_combined %>%
complete(GeneType = unique(allspecies_df$GeneType),
fill = list(Count = 0)) # Fill missing GeneTypes with Count = 0
# Count for upregulated and downregulated genes in thorax
thorax_upregulated <- thorax_sigresults_merged %>%
filter(log2FoldChange > 1) %>%
mutate(Regulation = "Upregulated", Tissue = "Thorax", Count = 1)
thorax_downregulated <- thorax_sigresults_merged %>%
filter(log2FoldChange < -1) %>%
mutate(Regulation = "Downregulated", Tissue = "Thorax", Count = -1) # Mutate downregulated genes to negative
# Combine upregulated and downregulated genes for thorax
thorax_combined <- rbind(thorax_upregulated, thorax_downregulated)
# Ensure all GeneTypes are represented for this species in thorax, even if they have no DEGs
thorax_combined <- thorax_combined %>%
complete(GeneType = unique(allspecies_df$GeneType),
fill = list(Count = 0)) # Fill missing GeneTypes with Count = 0
# Combine data for head and thorax into one
combined_data <- rbind(head_combined, thorax_combined)
# Add species column to the data
combined_data$Species <- species
# Append the data to the list for all species
all_species_data[[species]] <- combined_data
}
# Combine all species data into one data frame
final_data <- bind_rows(all_species_data)
# Reorder species according to the desired order
final_data$Species <- factor(final_data$Species, levels = species_order)
# Filter for head tissue only
final_data_head <- final_data %>% filter(Tissue == "Head")
final_data_thorax <- final_data %>% filter(Tissue == "Thorax")
# Create the barplot for all species and only head tissue
ggplot(final_data_head, aes(x = Species, y = Count, fill = GeneType)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "DEGs by Gene Biotype for Head (absolute lfc >1)",
x = "Species",
y = "Number of Genes") +
custom_color_scale +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200))+
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.title.x = element_text(size = 14, face = "bold"),
axis.title.y = element_text(size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
axis.text.y = element_text(size = 12),
panel.grid.major.y = element_line(color = "grey90", linetype = "dashed"),
panel.grid.minor = element_blank()) +
coord_flip() # Flip coordinates to make the plot horizontal

# Create the barplot for all species and only head tissue
ggplot(final_data_thorax, aes(x = Species, y = Count, fill = GeneType)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "DEGs by Gene Biotype for Thorax (absolute lfc >1)",
x = "Species",
y = "Number of Genes") +
custom_color_scale +
scale_y_continuous(labels = function(x) ifelse(x < 0, -x, x), limits = c(-1200, 1200))+
theme_minimal(base_size = 12) +
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
axis.title.x = element_text(size = 14, face = "bold"),
axis.title.y = element_text(size = 14, face = "bold"),
axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
axis.text.y = element_text(size = 12),
panel.grid.major.y = element_line(color = "grey90", linetype = "dashed"),
panel.grid.minor = element_blank()) +
coord_flip() # Flip coordinates to make the plot horizontal


species <- "gregaria" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "piceifrons" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "cancellata" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "americana" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "cubense" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}



species <- "nitens" # Specify the species for which to generate plots
# Load DESeq2 results for head and thorax
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0 || nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
} else {
# Filter for significant DEGs and select upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
select(GeneID = X)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
select(GeneID = X)
# Prepare data for Venn diagram
venn_data <- list(
Head_Upregulated = head_up$GeneID,
Head_Downregulated = head_down$GeneID,
Thorax_Upregulated = thorax_up$GeneID,
Thorax_Downregulated = thorax_down$GeneID
)
# Generate the four-way Venn diagram with specified colors and legend outside
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("Head Upregulated", "Head Downregulated", "Thorax Upregulated", "Thorax Downregulated"),
filename = NULL,
output = TRUE,
fill = c("red", "skyblue", "orange", "blue"), # Set colors for upregulated and downregulated
alpha = 0.5,
cex = 1.2, # Text size for numbers
cat.cex = 0, # Text size for category labels
cat.pos = c(0, 0, 0, 0), # Position to center labels
cat.dist = c(0.1, 0.1, 0.1, 0.1), # Distance between category labels and circles
main = paste("Venn Diagram of DEGs for S.", species),
main.cex = 1.2, # Size of the main title
cat.col = c("red", "skyblue", "orange", "blue") # Color the category labels
)
# Clear the current plotting area before drawing the next Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("Head Up", "Head Down", "Thorax Up", "Thorax Down")
legend_colors <- c("red", "skyblue", "orange", "blue")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Scatter plot for overlapping genes
# Filter significant DEGs for both head and thorax
head_sig_genes <- head_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
thorax_sig_genes <- thorax_data %>%
filter(padj < 0.05 & abs(log2FoldChange) > 1) %>%
select(GeneID = X, log2FoldChange, padj)
# Find overlapping genes based on GeneID
overlapping_genes <- inner_join(head_sig_genes, thorax_sig_genes, by = "GeneID", suffix = c("_head", "_thorax"))
# Save the overlapping genes to a CSV file
output_file <- file.path(workDir, "DEG-results", paste0("overlapping_genes_head_thorax_", species, ".csv"))
write.csv(overlapping_genes, output_file, row.names = FALSE)
# Plot overlapping genes with scatter plot
p <- ggplot(overlapping_genes, aes(x = log2FoldChange_head, y = log2FoldChange_thorax)) +
geom_point(aes(color = case_when(
log2FoldChange_head > 0 & log2FoldChange_thorax > 0 ~ "Upregulated in Both",
log2FoldChange_head < 0 & log2FoldChange_thorax < 0 ~ "Downregulated in Both",
log2FoldChange_head > 0 & log2FoldChange_thorax < 0 ~ "Up in Head, Down in Thorax",
log2FoldChange_head < 0 & log2FoldChange_thorax > 0 ~ "Down in Head, Up in Thorax"
)), size = 3, alpha = 0.7) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed", color = "gray") +
labs(
x = "Log2 Fold Change (Head)",
y = "Log2 Fold Change (Thorax)",
color = "Regulation Pattern",
title = "Comparison of Log2 Fold Changes in Overlapping Genes",
subtitle = paste("Head vs. Thorax in", species)
) +
theme_minimal() +
theme(
plot.title = element_text(size = 16, face = "bold"),
plot.subtitle = element_text(size = 12, face = "italic"),
legend.position = "top"
) +
scale_color_manual(values = c(
"Upregulated in Both" = "red",
"Downregulated in Both" = "blue",
"Up in Head, Down in Thorax" = "purple",
"Down in Head, Up in Thorax" = "green"
))
# Save the scatter plot
ggsave(filename = file.path(workDir, "DEG-results", paste0("scatter_plot_overlapping_genes_", species, ".png")), plot = p)
# Display the scatter plot
print(p)
}


# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species
load_deg_data <- function(locusts, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in locusts) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
# Check if the file exists
if (!file.exists(head_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(head_data)[colnames(head_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
head_data_merged <- merge(head_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
head_data_merged <- merge(head_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
head_data_merged$Orthogroup[is.na(head_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
head_down <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- head_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- head_up$Orthogroup
degs_down[[species]] <- head_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
# Function to display Venn diagram and corresponding datatable
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# Print overlap info
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
# If no overlaps exist, display a message and an empty plot
if (length(overlap_orthogroups) == 0) {
message("⚠️ No overlapping Orthogroups found. Displaying an empty Venn diagram.")
# Create an empty Venn diagram placeholder
plot.new()
text(0.5, 0.5, "No overlapping Orthogroups found", cex = 1.5, col = "red")
return(NULL) # Exit the function gracefully
}
# Create a data frame for the overlapping Orthogroups
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Ensure merged data exists
if (nrow(meta_brock_df) == 0) {
message("⚠️ Merge failed: No matching rows after merging Orthogroups.")
return(NULL)
}
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Display the datatable for overlapping Orthogroups
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species', target = 'cell',
fontStyle = 'italic'
)
}
# Load DEGs for locusts
venn_data_locusts <- load_deg_data(locusts, allspecies_df, filtered_final_orthotable)
# Prepare the data for Venn diagrams
venn_data_up <- list(
gregaria = venn_data_locusts$up[["gregaria"]],
piceifrons = venn_data_locusts$up[["piceifrons"]],
cancellata = venn_data_locusts$up[["cancellata"]]
)
venn_data_down <- list(
gregaria = venn_data_locusts$down[["gregaria"]],
piceifrons = venn_data_locusts$down[["piceifrons"]],
cancellata = venn_data_locusts$down[["cancellata"]]
)
venn_data_all <- list(
gregaria = venn_data_locusts$all[["gregaria"]],
piceifrons = venn_data_locusts$all[["piceifrons"]],
cancellata = venn_data_locusts$all[["cancellata"]]
)
# Display the Venn diagrams with fallback for missing overlaps
message("Processing Venn diagram for head upregulated DEGs...")
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
character(0)

NULL
message("Processing Venn diagram for head downregulated DEGs...")
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0010820"

message("Processing Venn diagram for all significant DEGs...")
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Head DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0010820"

# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in locusts) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
# Load the DESeq2 results
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(head_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
head_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Head_Combined = sum(log2FoldChange[Tissue == "Head"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Head_Combined,
values_fill = list(Head_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species (for Thorax)
load_deg_data <- function(locusts, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in locusts) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
# Check if the file exists
if (!file.exists(thorax_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
thorax_data_merged <- merge(thorax_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
thorax_data_merged <- merge(thorax_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
thorax_data_merged$Orthogroup[is.na(thorax_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
thorax_down <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- thorax_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$Orthogroup
degs_down[[species]] <- thorax_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate the overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# Print the overlap to check if there are matching Orthogroups
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
# Create a data frame for the overlapping Orthogroups
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Check if the overlap_df has any data
if (nrow(overlap_df) == 0) {
stop("No overlapping Orthogroups found.")
}
# Rename GeneID column to avoid conflict in allspecies_df
colnames(allspecies_df)[colnames(allspecies_df) == "GeneID"] <- "GeneID_allspecies"
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Check if the merge produced any data
cat("Merged Data (after Orthogroup merge): \n")
if (nrow(meta_brock_df) == 0) {
stop("Merge failed: No matching rows after merging Orthogroups.")
}
# print(head(meta_brock_df))
# Rename gene_id column to GeneID_meta_brock
colnames(meta_brock_df)[colnames(meta_brock_df) == "gene_id"] <- "GeneID_meta_brock"
# Ensure that GeneID columns are the same type (character)
meta_brock_df$GeneID_meta_brock <- as.character(meta_brock_df$GeneID_meta_brock)
allspecies_df$GeneID_allspecies <- as.character(allspecies_df$GeneID_allspecies)
# Perform the merge with renamed columns
meta_brock_df <- merge(meta_brock_df, allspecies_df, by.x = "GeneID_meta_brock", by.y = "GeneID_allspecies", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("gregaria", "piceifrons", "cancellata"),
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("gregaria", "piceifrons", "cancellata")
legend_colors <- c("orange", "red", "orchid")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping Orthogroups table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species.x', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Example for testing with your data (for Thorax)
venn_data_locusts <- load_deg_data(locusts, allspecies_df, filtered_final_orthotable)
# Prepare the data for the Venn diagrams for Thorax
venn_data_up <- list(
gregaria = venn_data_locusts$up[["gregaria"]],
piceifrons = venn_data_locusts$up[["piceifrons"]],
cancellata = venn_data_locusts$up[["cancellata"]]
)
venn_data_down <- list(
gregaria = venn_data_locusts$down[["gregaria"]],
piceifrons = venn_data_locusts$down[["piceifrons"]],
cancellata = venn_data_locusts$down[["cancellata"]]
)
venn_data_all <- list(
gregaria = venn_data_locusts$all[["gregaria"]],
piceifrons = venn_data_locusts$all[["piceifrons"]],
cancellata = venn_data_locusts$all[["cancellata"]]
)
# Display the Venn diagram and datatable for thorax upregulated DEGs
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0013270" "OG0010858" "OG0010993" "OG0007957"
Merged Data (after Orthogroup merge):

# Display the Venn diagram and datatable for thorax downregulated DEGs
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0009434" "OG0010820"
Merged Data (after Orthogroup merge):

# Display the Venn diagram and datatable for all significant DEGs in Thorax
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Thorax DEGs - Locusts", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0013270" "OG0009434" "OG0013368" "OG0010820" "OG0010858" "OG0010993"
[7] "OG0007957"
Merged Data (after Orthogroup merge):

# Define the species for Group 1
locusts <- c("gregaria", "piceifrons", "cancellata")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in locusts) {
# Load DESeq2 results for head
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
# Load the DESeq2 results
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(thorax_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
thorax_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Thorax_Combined = sum(log2FoldChange[Tissue == "Thorax"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Thorax_Combined,
values_fill = list(Thorax_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Define the species for PACclade
PACclade <- c("piceifrons", "americana", "cubense")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species (PACclade)
load_deg_data <- function(PACclade, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in PACclade) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
# Check if the file exists
if (!file.exists(head_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(head_data)[colnames(head_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
head_data_merged <- merge(head_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
head_data_merged <- merge(head_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
head_data_merged$Orthogroup[is.na(head_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
head_down <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- head_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- head_up$Orthogroup
degs_down[[species]] <- head_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate the overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# If no overlapping Orthogroups, we still display the Venn diagram, but inform the user
if(length(overlap_orthogroups) == 0) {
cat("No overlapping Orthogroups found for", title, "\n")
} else {
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
}
# Create a data frame for the overlapping Orthogroups (even if it's empty)
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Rename GeneID column to avoid conflict in allspecies_df
colnames(allspecies_df)[colnames(allspecies_df) == "GeneID"] <- "GeneID_allspecies"
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Check if the merge produced any data
if (nrow(meta_brock_df) == 0) {
cat("No matching rows after merging Orthogroups for", title, "\n")
}
# Rename gene_id column to GeneID_meta_brock
colnames(meta_brock_df)[colnames(meta_brock_df) == "gene_id"] <- "GeneID_meta_brock"
# Ensure that GeneID columns are the same type (character)
meta_brock_df$GeneID_meta_brock <- as.character(meta_brock_df$GeneID_meta_brock)
allspecies_df$GeneID_allspecies <- as.character(allspecies_df$GeneID_allspecies)
# Perform the merge with renamed columns
meta_brock_df <- merge(meta_brock_df, allspecies_df, by.x = "GeneID_meta_brock", by.y = "GeneID_allspecies", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense")
legend_colors <- c("red", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping Orthogroups table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species.x', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Example for testing with your data (for PACclade)
venn_data_pacclade <- load_deg_data(PACclade, allspecies_df, filtered_final_orthotable)
# Prepare the data for the Venn diagrams for PACclade
venn_data_up <- list(
piceifrons = venn_data_pacclade$up[["piceifrons"]],
americana = venn_data_pacclade$up[["americana"]],
cubense = venn_data_pacclade$up[["cubense"]]
)
venn_data_down <- list(
piceifrons = venn_data_pacclade$down[["piceifrons"]],
americana = venn_data_pacclade$down[["americana"]],
cubense = venn_data_pacclade$down[["cubense"]]
)
venn_data_all <- list(
piceifrons = venn_data_pacclade$all[["piceifrons"]],
americana = venn_data_pacclade$all[["americana"]],
cubense = venn_data_pacclade$all[["cubense"]]
)
# Display the Venn diagram and datatable for head upregulated DEGs (PACclade)
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - PAC", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0007393" "OG0013008"

# Display the Venn diagram and datatable for head downregulated DEGs (PACclade)
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - PAC", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Head Downregulated DEGs - PAC
No matching rows after merging Orthogroups for Venn Diagram of Head Downregulated DEGs - PAC

# Display the Venn diagram and datatable for all significant DEGs (PACclade)
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Head DEGs - PAC", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0007393" "OG0013008"

# Define the species for Group 1
PACclade <- c("piceifrons", "americana", "cubense")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in PACclade) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
# Load the DESeq2 results
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(head_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
head_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Head_Combined = sum(log2FoldChange[Tissue == "Head"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Head_Combined,
values_fill = list(Head_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Define the species for PACclade
PACclade <- c("piceifrons", "americana", "cubense")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species (PACclade)
load_deg_data <- function(PACclade, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in PACclade) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
# Check if the file exists
if (!file.exists(head_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
thorax_data_merged <- merge(thorax_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
thorax_data_merged <- merge(thorax_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
thorax_data_merged$Orthogroup[is.na(thorax_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
thorax_down <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- thorax_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$Orthogroup
degs_down[[species]] <- thorax_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate the overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# If no overlapping Orthogroups, we still display the Venn diagram, but inform the user
if(length(overlap_orthogroups) == 0) {
cat("No overlapping Orthogroups found for", title, "\n")
} else {
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
}
# Create a data frame for the overlapping Orthogroups (even if it's empty)
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Rename GeneID column to avoid conflict in allspecies_df
colnames(allspecies_df)[colnames(allspecies_df) == "GeneID"] <- "GeneID_allspecies"
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Check if the merge produced any data
if (nrow(meta_brock_df) == 0) {
cat("No matching rows after merging Orthogroups for", title, "\n")
}
# Rename gene_id column to GeneID_meta_brock
colnames(meta_brock_df)[colnames(meta_brock_df) == "gene_id"] <- "GeneID_meta_brock"
# Ensure that GeneID columns are the same type (character)
meta_brock_df$GeneID_meta_brock <- as.character(meta_brock_df$GeneID_meta_brock)
allspecies_df$GeneID_allspecies <- as.character(allspecies_df$GeneID_allspecies)
# Perform the merge with renamed columns
meta_brock_df <- merge(meta_brock_df, allspecies_df, by.x = "GeneID_meta_brock", by.y = "GeneID_allspecies", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense")
legend_colors <- c("red", "green", "yellow")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping Orthogroups table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species.x', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Example for testing with your data (for PACclade)
venn_data_pacclade <- load_deg_data(PACclade, allspecies_df, filtered_final_orthotable)
# Prepare the data for the Venn diagrams for PACclade
venn_data_up <- list(
piceifrons = venn_data_pacclade$up[["piceifrons"]],
americana = venn_data_pacclade$up[["americana"]],
cubense = venn_data_pacclade$up[["cubense"]]
)
venn_data_down <- list(
piceifrons = venn_data_pacclade$down[["piceifrons"]],
americana = venn_data_pacclade$down[["americana"]],
cubense = venn_data_pacclade$down[["cubense"]]
)
venn_data_all <- list(
piceifrons = venn_data_pacclade$all[["piceifrons"]],
americana = venn_data_pacclade$all[["americana"]],
cubense = venn_data_pacclade$all[["cubense"]]
)
# Display the Venn diagram and datatable for thorax upregulated DEGs (PACclade)
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - PAC", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Thorax Upregulated DEGs - PAC
No matching rows after merging Orthogroups for Venn Diagram of Thorax Upregulated DEGs - PAC

# Display the Venn diagram and datatable for head downregulated DEGs (PACclade)
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - PAC", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Thorax Downregulated DEGs - PAC
No matching rows after merging Orthogroups for Venn Diagram of Thorax Downregulated DEGs - PAC

# Display the Venn diagram and datatable for all significant DEGs (PACclade)
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Thorax DEGs - PAC", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of All Thorax DEGs - PAC
No matching rows after merging Orthogroups for Venn Diagram of All Thorax DEGs - PAC

# Define the species for PACclade
PACclade <- c("piceifrons", "americana", "cubense")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in PACclade) {
# Load DESeq2 results for head
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
# Load the DESeq2 results
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(thorax_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
thorax_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Thorax_Combined = sum(log2FoldChange[Tissue == "Thorax"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Thorax_Combined,
values_fill = list(Thorax_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Define the species for plastic_species
plastic_species <- c("gregaria", "piceifrons", "cancellata", "americana")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species (plastic_species)
load_deg_data <- function(plastic_species, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in plastic_species) {
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
# Check if the file exists
if (!file.exists(head_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(head_data)[colnames(head_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
head_data_merged <- merge(head_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
head_data_merged <- merge(head_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
head_data_merged$Orthogroup[is.na(head_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
head_up <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
head_down <- head_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- head_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- head_up$Orthogroup
degs_down[[species]] <- head_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate the overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# If no overlapping Orthogroups, we still display the Venn diagram, but inform the user
if(length(overlap_orthogroups) == 0) {
cat("No overlapping Orthogroups found for", title, "\n")
} else {
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
}
# Create a data frame for the overlapping Orthogroups (even if it's empty)
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Rename GeneID column to avoid conflict in allspecies_df
colnames(allspecies_df)[colnames(allspecies_df) == "GeneID"] <- "GeneID_allspecies"
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Check if the merge produced any data
if (nrow(meta_brock_df) == 0) {
cat("No matching rows after merging Orthogroups for", title, "\n")
}
# Rename gene_id column to GeneID_meta_brock
colnames(meta_brock_df)[colnames(meta_brock_df) == "gene_id"] <- "GeneID_meta_brock"
# Ensure that GeneID columns are the same type (character)
meta_brock_df$GeneID_meta_brock <- as.character(meta_brock_df$GeneID_meta_brock)
allspecies_df$GeneID_allspecies <- as.character(allspecies_df$GeneID_allspecies)
# Perform the merge with renamed columns
meta_brock_df <- merge(meta_brock_df, allspecies_df, by.x = "GeneID_meta_brock", by.y = "GeneID_allspecies", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense", "gregaria"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow", "orange"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense", "gregaria")
legend_colors <- c("red", "green", "yellow", "orange")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping Orthogroups table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species.x', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Example for testing with your data (for plastic_species)
venn_data_plastic_species <- load_deg_data(plastic_species, allspecies_df, filtered_final_orthotable)
# Prepare the data for the Venn diagrams for plastic_species
venn_data_up <- list(
gregaria = venn_data_plastic_species$up[["gregaria"]],
piceifrons = venn_data_plastic_species$up[["piceifrons"]],
cancellata = venn_data_plastic_species$up[["cancellata"]],
americana = venn_data_plastic_species$up[["americana"]]
)
venn_data_down <- list(
gregaria = venn_data_plastic_species$down[["gregaria"]],
piceifrons = venn_data_plastic_species$down[["piceifrons"]],
cancellata = venn_data_plastic_species$down[["cancellata"]],
americana = venn_data_plastic_species$down[["americana"]]
)
venn_data_all <- list(
gregaria = venn_data_plastic_species$all[["gregaria"]],
piceifrons = venn_data_plastic_species$all[["piceifrons"]],
cancellata = venn_data_plastic_species$all[["cancellata"]],
americana = venn_data_plastic_species$all[["americana"]]
)
# Display the Venn diagram and datatable for head upregulated DEGs (plastic_species)
display_venn_with_datatable(venn_data_up, "Venn Diagram of Head Upregulated DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Head Upregulated DEGs - Plastic Species
No matching rows after merging Orthogroups for Venn Diagram of Head Upregulated DEGs - Plastic Species

# Display the Venn diagram and datatable for head downregulated DEGs (plastic_species)
display_venn_with_datatable(venn_data_down, "Venn Diagram of Head Downregulated DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Head Downregulated DEGs - Plastic Species
No matching rows after merging Orthogroups for Venn Diagram of Head Downregulated DEGs - Plastic Species

# Display the Venn diagram and datatable for all significant DEGs (plastic_species)
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Head DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of All Head DEGs - Plastic Species
No matching rows after merging Orthogroups for Venn Diagram of All Head DEGs - Plastic Species

# Define the species for Group 1
plastic_species <- c("gregaria", "piceifrons", "cancellata", "americana")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in plastic_species) {
# Load DESeq2 results for head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
# Load the DESeq2 results
head_data <- read.csv(head_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(head_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(head_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
head_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Head_Combined = sum(log2FoldChange[Tissue == "Head"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Head_Combined,
values_fill = list(Head_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Define the species for plastic_species
plastic_species <- c("gregaria", "piceifrons", "cancellata", "americana")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Function to load DEGs for a given group of species (plastic_species)
load_deg_data <- function(plastic_species, allspecies_df, filtered_final_orthotable) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
for (species in plastic_species) {
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
# Check if the file exists
if (!file.exists(thorax_file)) {
message(paste("File not found for species:", species))
next # Skip this iteration if the file is missing
}
# Read the data
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Rename the "X" column to "GeneID"
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
# Merge DEG data with GeneType and Orthogroup information
thorax_data_merged <- merge(thorax_data, allspecies_df[, c("GeneID", "GeneType", "Species")], by = "GeneID")
thorax_data_merged <- merge(thorax_data_merged, filtered_final_orthotable[, c("GeneID", "Orthogroup")], by = "GeneID")
# Handle missing Orthogroups
thorax_data_merged$Orthogroup[is.na(thorax_data_merged$Orthogroup)] <- "Unknown"
# Filter for significant DEGs (both upregulated and downregulated)
thorax_up <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
thorax_down <- thorax_data_merged %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_deg <- thorax_data_merged %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the list
degs_up[[species]] <- thorax_up$Orthogroup
degs_down[[species]] <- thorax_down$Orthogroup
degs_all[[species]] <- all_deg$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Function to display Venn diagram and corresponding datatable based on Orthogroups
display_venn_with_datatable <- function(venn_data, title, allspecies_df, filtered_final_orthotable) {
# Calculate the overlapping Orthogroups
overlap_orthogroups <- Reduce(intersect, venn_data)
# If no overlapping Orthogroups, we still display the Venn diagram, but inform the user
if(length(overlap_orthogroups) == 0) {
cat("No overlapping Orthogroups found for", title, "\n")
} else {
cat("Overlapping Orthogroups: \n")
print(overlap_orthogroups)
}
# Create a data frame for the overlapping Orthogroups (even if it's empty)
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Rename GeneID column to avoid conflict in allspecies_df
colnames(allspecies_df)[colnames(allspecies_df) == "GeneID"] <- "GeneID_allspecies"
# Merge to get species and other information from filtered_final_orthotable
meta_brock_df <- merge(overlap_df, filtered_final_orthotable, by = "Orthogroup", all.x = TRUE)
# Check if the merge produced any data
if (nrow(meta_brock_df) == 0) {
cat("No matching rows after merging Orthogroups for", title, "\n")
}
# Rename gene_id column to GeneID_meta_brock
colnames(meta_brock_df)[colnames(meta_brock_df) == "gene_id"] <- "GeneID_meta_brock"
# Ensure that GeneID columns are the same type (character)
meta_brock_df$GeneID_meta_brock <- as.character(meta_brock_df$GeneID_meta_brock)
allspecies_df$GeneID_allspecies <- as.character(allspecies_df$GeneID_allspecies)
# Perform the merge with renamed columns
meta_brock_df <- merge(meta_brock_df, allspecies_df, by.x = "GeneID_meta_brock", by.y = "GeneID_allspecies", all.x = TRUE)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = c("piceifrons", "americana", "cubense", "gregaria"),
filename = NULL,
output = TRUE,
fill = c("red", "green", "yellow", "orange"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear the current plotting area before drawing the Venn diagram
grid.newpage()
# Display the Venn diagram
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- c("piceifrons", "americana", "cubense", "gregaria")
legend_colors <- c("red", "green", "yellow", "orange")
# Positioning the legend lower on the right side of the plot
legend_x <- unit(0.85, "npc") # Adjust x position
legend_y <- unit(0.2, "npc") # Lower the legend vertically
# Draw the legend
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the merged overlapping Orthogroups table with datatable
datatable(meta_brock_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE,
escape = FALSE
) %>%
formatStyle(
'Species.x', target = 'cell',
fontStyle = 'italic'
) %>%
formatStyle(
columns = names(meta_brock_df),
target = 'row',
color = styleEqual(c("red", "blue", "black"), c("red", "blue", "black")),
fontWeight = styleEqual(c("bold", "normal"), c("bold", "normal")),
backgroundColor = styleEqual(c("red", "blue", "black"), c("white", "white", "white"))
)
}
# Example for testing with your data (for plastic_species)
venn_data_plastic_species <- load_deg_data(plastic_species, allspecies_df, filtered_final_orthotable)
# Prepare the data for the Venn diagrams for plastic_species
venn_data_up <- list(
gregaria = venn_data_plastic_species$up[["gregaria"]],
piceifrons = venn_data_plastic_species$up[["piceifrons"]],
cancellata = venn_data_plastic_species$up[["cancellata"]],
americana = venn_data_plastic_species$up[["americana"]]
)
venn_data_down <- list(
gregaria = venn_data_plastic_species$down[["gregaria"]],
piceifrons = venn_data_plastic_species$down[["piceifrons"]],
cancellata = venn_data_plastic_species$down[["cancellata"]],
americana = venn_data_plastic_species$down[["americana"]]
)
venn_data_all <- list(
gregaria = venn_data_plastic_species$all[["gregaria"]],
piceifrons = venn_data_plastic_species$all[["piceifrons"]],
cancellata = venn_data_plastic_species$all[["cancellata"]],
americana = venn_data_plastic_species$all[["americana"]]
)
# Display the Venn diagram and datatable for thorax upregulated DEGs (plastic_species)
display_venn_with_datatable(venn_data_up, "Venn Diagram of Thorax Upregulated DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0010858" "OG0007957"

# Display the Venn diagram and datatable for head downregulated DEGs (plastic_species)
display_venn_with_datatable(venn_data_down, "Venn Diagram of Thorax Downregulated DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
No overlapping Orthogroups found for Venn Diagram of Thorax Downregulated DEGs - Plastic Species
No matching rows after merging Orthogroups for Venn Diagram of Thorax Downregulated DEGs - Plastic Species

# Display the Venn diagram and datatable for all significant DEGs (plastic_species)
display_venn_with_datatable(venn_data_all, "Venn Diagram of All Thorax DEGs - Plastic Species", allspecies_df, filtered_final_orthotable)
Overlapping Orthogroups:
[1] "OG0013368" "OG0010858" "OG0007957"

# Define the species for PACclade
plastic_species <- c("gregaria", "piceifrons", "cancellata", "americana")
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Initialize an empty list to store heatmap data for each species
heatmap_list <- list()
# Loop through each species to process their data
for (species in plastic_species) {
# Load DESeq2 results for head
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
# Load the DESeq2 results
thorax_data <- read.csv(thorax_file, stringsAsFactors = FALSE)
# Check if data is empty and handle accordingly
if (nrow(thorax_data) == 0) {
message(paste("No data for species:", species))
next # Skip to the next species if there's no data
}
# Rename the "gene_id" column in filtered_final_orthotable for consistency
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
# Merge with filtered_final_orthotable to include Orthogroup
merged_data <- merge(thorax_data, filtered_final_orthotable, by = "GeneID", all.x = TRUE)
# Check if merge was successful
if (nrow(merged_data) == 0) {
message(paste("No matching data for species:", species))
next # Skip if no matching data after merging
}
# Filter for significant DEGs and select top 500 upregulated and downregulated genes for each tissue
thorax_up <- merged_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- merged_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap, adding the species column
heatmap_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append the heatmap data to the list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data into a single dataframe for heatmap matrix preparation
final_heatmap_data <- bind_rows(heatmap_list)
# Check if final_heatmap_data is empty before proceeding
if (nrow(final_heatmap_data) == 0) {
stop("No valid data available for heatmap generation.")
}
# Filter out rows with missing Orthogroup values
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(Orthogroup))
# Check if there are any missing values in log2FoldChange (optional, just in case)
final_heatmap_data <- final_heatmap_data %>%
filter(!is.na(log2FoldChange))
# Create heatmap matrix using Orthogroup instead of GeneID
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(
Thorax_Combined = sum(log2FoldChange[Tissue == "Thorax"], na.rm = TRUE),
.groups = 'drop'
) %>%
pivot_wider(names_from = Species,
values_from = Thorax_Combined,
values_fill = list(Thorax_Combined = 0)) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Check if heatmap_matrix is empty
if (nrow(heatmap_matrix) == 0) {
stop("No valid data available for heatmap matrix.")
}
# Define color palettes
# Define a custom color gradient where 0 is black
custom_color_palette1 <- colorRampPalette(c("cyan", "cyan3", "black", "orange3", "orange"))(100)
# Define a custom color gradient where 0 is white
custom_color_palette2 <- colorRampPalette(c("blue3", "blue", "white", "red", "red3"))(100)
# Define color breaks so that black is exactly at 0
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE) # Get max absolute log2FoldChange
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100) # Symmetric scale
# Create heatmap with clustering
pheatmap(
heatmap_matrix,
color = custom_color_palette2,
breaks = color_breaks,
cluster_rows = TRUE, # Cluster genes
cluster_cols = FALSE, # Do not cluster species
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Create heatmap without clustering columns
pheatmap(
heatmap_matrix,
color = custom_color_palette1,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

# Load orthogroup mapping
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure column names are correctly set
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select only relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Ensure one entry per GeneID
# Define species list
allspecies <- c("gregaria", "piceifrons", "cancellata", "americana", "cubense")
# Function to load DEGs for a given set of species and a specific tissue
load_deg_data <- function(species_list, tissue) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in species_list) {
# Define the correct file path based on tissue
deg_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_", tissue, "_", species, ".csv"))
# Read DESeq2 results
deg_data <- read.csv(deg_file, stringsAsFactors = FALSE)
# Ensure 'GeneID' column exists (some DESeq2 outputs use 'X')
if (!"GeneID" %in% colnames(deg_data)) {
if ("X" %in% colnames(deg_data)) {
colnames(deg_data)[colnames(deg_data) == "X"] <- "GeneID"
} else {
message(paste("No GeneID column found for", species, "in", tissue, "- Skipping"))
next
}
}
# Convert to character for safe merging
deg_data$GeneID <- as.character(deg_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Merge with orthogroup information
deg_data <- left_join(deg_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup)) # Handle missing orthogroups
# Check if data is empty
if (nrow(deg_data) == 0) {
message(paste("No data for species:", species, "in tissue:", tissue))
next
}
# Filter for significant DEGs based on `log2FoldChange`
upregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
downregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_degs <- deg_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the lists
degs_up[[species]] <- upregulated$Orthogroup
degs_down[[species]] <- downregulated$Orthogroup
degs_all[[species]] <- all_degs$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Head
venn_data_allspecies_head <- load_deg_data(allspecies, "Head")
# Load DEG data for Thorax
venn_data_allspecies_thorax <- load_deg_data(allspecies, "Thorax")
# Function to generate Venn diagrams with Orthogroups
display_venn_with_datatable <- function(venn_data, title) {
# Calculate overlapping genes
overlap_orthogroups <- Reduce(intersect, venn_data)
# Create a dataframe for overlapping orthogroups
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = allspecies,
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green", "yellow"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear plotting area and display Venn diagram
grid.newpage()
grid.draw(venn_plot)
# Manually create a custom legend
legend_labels <- allspecies
legend_colors <- c("orange", "red", "orchid", "green", "yellow")
# Position legend
legend_x <- unit(0.85, "npc")
legend_y <- unit(0.2, "npc")
for (i in 1:length(legend_labels)) {
grid.rect(x = legend_x, y = legend_y - unit((i - 1) * 0.05, "npc"),
width = unit(0.02, "npc"), height = unit(0.02, "npc"),
gp = gpar(fill = legend_colors[i], col = NA))
grid.text(label = legend_labels[i], x = legend_x + unit(0.05, "npc"),
y = legend_y - unit((i - 1) * 0.05, "npc"),
just = "left", gp = gpar(cex = 0.8))
}
# Display the overlapping Orthogroups as a datatable
datatable(overlap_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
),
rownames = FALSE)
}
# Display Venn diagrams and tables for HEAD
display_venn_with_datatable(venn_data_allspecies_head$up, "Venn Diagram of Upregulated Orthogroups - Head")

display_venn_with_datatable(venn_data_allspecies_head$down, "Venn Diagram of Downregulated Orthogroups - Head")

display_venn_with_datatable(venn_data_allspecies_head$all, "Venn Diagram of All Significant Orthogroups - Head")

# Display Venn diagrams and tables for THORAX
display_venn_with_datatable(venn_data_allspecies_thorax$up, "Venn Diagram of Upregulated Orthogroups - Thorax")

display_venn_with_datatable(venn_data_allspecies_thorax$down, "Venn Diagram of Downregulated Orthogroups - Thorax")

display_venn_with_datatable(venn_data_allspecies_thorax$all, "Venn Diagram of All Significant Orthogroups - Thorax")

# Load Orthogroup information
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure correct column names
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Keep unique mapping
# Define species order explicitly
species_order <- c("nitens", "cubense", "americana", "piceifrons", "cancellata", "gregaria")
# Initialize an empty list to store heatmap data
heatmap_list <- list()
# Loop through each species to process their data
for (species in species_order) {
message(paste("Processing species:", species))
# Define file paths
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
# Check if files exist before loading
if (!file.exists(head_file)) {
message(paste("Missing Head file for:", species, "- Assigning empty dataset"))
head_data <- data.frame(GeneID = character(), padj = numeric(), log2FoldChange = numeric(), stringsAsFactors = FALSE)
} else {
head_data <- tryCatch(read.csv(head_file, stringsAsFactors = FALSE), error = function(e) data.frame())
}
if (!file.exists(thorax_file)) {
message(paste("Missing Thorax file for:", species, "- Assigning empty dataset"))
thorax_data <- data.frame(GeneID = character(), padj = numeric(), log2FoldChange = numeric(), stringsAsFactors = FALSE)
} else {
thorax_data <- tryCatch(read.csv(thorax_file, stringsAsFactors = FALSE), error = function(e) data.frame())
}
# Ensure GeneID column exists
if (!"GeneID" %in% colnames(head_data) && "X" %in% colnames(head_data)) {
colnames(head_data)[colnames(head_data) == "X"] <- "GeneID"
}
if (!"GeneID" %in% colnames(thorax_data) && "X" %in% colnames(thorax_data)) {
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
}
# Convert GeneID to character
head_data$GeneID <- as.character(head_data$GeneID)
thorax_data$GeneID <- as.character(thorax_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Ensure species is not skipped if one dataset is empty
if (nrow(head_data) == 0 && nrow(thorax_data) == 0) {
message(paste("No data for species:", species, "- Skipping"))
next
}
# If thorax data is missing, assign zero values
if (nrow(thorax_data) == 0) {
message(paste("No Thorax data for:", species, "- Assigning 0 values"))
thorax_data <- data.frame(GeneID = head_data$GeneID, padj = 1, log2FoldChange = 0, stringsAsFactors = FALSE)
}
# Merge with orthogroup information
head_data <- left_join(head_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup))
thorax_data <- left_join(thorax_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup))
# Filter for significant DEGs and select top 500 upregulated and downregulated genes per tissue
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species),
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append to heatmap list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data
final_heatmap_data <- bind_rows(heatmap_list)
# Ensure species order in the data
final_heatmap_data$Species <- factor(final_heatmap_data$Species, levels = species_order)
# Create heatmap matrix (Thorax only)
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>% # Remove Tissue to ensure unique Orthogroup rows
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
distinct(Orthogroup, .keep_all = TRUE) %>% # Ensure unique Orthogroup rows
column_to_rownames("Orthogroup") %>%
as.matrix()
# Explicitly reorder the columns in heatmap_matrix
heatmap_matrix <- heatmap_matrix[, species_order, drop = FALSE] # Ensure order is applied
# Define color palettes
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE)
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100)
# Generate heatmaps
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head and Thorax Tissue - STRATEGY 2"
)

pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head and Thorax Tissue- STRATEGY 2"
)

# Load orthogroup mapping
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure column names are correctly set
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select only relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Ensure one entry per GeneID
# Define species list
allspecies <- c("gregaria", "piceifrons", "cancellata", "americana", "cubense")
# Function to load DEGs for a given set of species and a specific tissue (ONLY HEAD)
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in species_list) {
# Define the correct file path for Head
deg_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Head_", species, ".csv"))
# Read DESeq2 results
deg_data <- read.csv(deg_file, stringsAsFactors = FALSE)
# Ensure 'GeneID' column exists (some DESeq2 outputs use 'X')
if (!"GeneID" %in% colnames(deg_data)) {
if ("X" %in% colnames(deg_data)) {
colnames(deg_data)[colnames(deg_data) == "X"] <- "GeneID"
} else {
message(paste("No GeneID column found for", species, "in Head - Skipping"))
next
}
}
# Convert to character for safe merging
deg_data$GeneID <- as.character(deg_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Merge with orthogroup information
deg_data <- left_join(deg_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup)) # Handle missing orthogroups
# Check if data is empty
if (nrow(deg_data) == 0) {
message(paste("No data for species:", species, "in Head"))
next
}
# Filter for significant DEGs based on `log2FoldChange`
upregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
downregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_degs <- deg_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the lists
degs_up[[species]] <- upregulated$Orthogroup
degs_down[[species]] <- downregulated$Orthogroup
degs_all[[species]] <- all_degs$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Head only
venn_data_allspecies_head <- load_deg_data(allspecies)
# Function to generate Venn diagrams with Orthogroups (ONLY HEAD)
display_venn_with_datatable <- function(venn_data, title) {
# Calculate overlapping genes
overlap_orthogroups <- Reduce(intersect, venn_data)
# Create a dataframe for overlapping orthogroups
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = allspecies,
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green", "yellow"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear plotting area and display Venn diagram
grid.newpage()
grid.draw(venn_plot)
# Display overlapping Orthogroups as a datatable
datatable(overlap_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
), rownames = FALSE)
}
# Display Venn diagrams and tables for HEAD only
display_venn_with_datatable(venn_data_allspecies_head$up, "Venn Diagram of Upregulated Orthogroups - Head")

display_venn_with_datatable(venn_data_allspecies_head$down, "Venn Diagram of Downregulated Orthogroups - Head")

display_venn_with_datatable(venn_data_allspecies_head$all, "Venn Diagram of All Significant Orthogroups - Head")

# Load Orthogroup information
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure correct column names
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Keep unique mapping
# Define species order explicitly
species_order <- c("nitens", "cubense", "americana", "piceifrons", "cancellata", "gregaria")
# Initialize an empty list to store heatmap data
heatmap_list <- list()
# Loop through each species to process their Head data
for (species in species_order) {
message(paste("Processing species:", species))
# Define file path for Head
head_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Head_", species, ".csv"))
# Check if file exists before loading
if (!file.exists(head_file)) {
message(paste("Missing Head file for:", species, "- Assigning empty dataset"))
head_data <- data.frame(GeneID = character(), padj = numeric(), log2FoldChange = numeric(), stringsAsFactors = FALSE)
} else {
head_data <- tryCatch(read.csv(head_file, stringsAsFactors = FALSE), error = function(e) data.frame())
}
# Ensure GeneID column exists
if (!"GeneID" %in% colnames(head_data) && "X" %in% colnames(head_data)) {
colnames(head_data)[colnames(head_data) == "X"] <- "GeneID"
}
# Convert GeneID to character
head_data$GeneID <- as.character(head_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Merge with orthogroup information
head_data <- left_join(head_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup))
# Filter for significant DEGs and select top 500 upregulated and downregulated genes
head_up <- head_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
head_down <- head_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap
heatmap_data <- bind_rows(
head_up %>% mutate(Tissue = "Head", Regulation = "Upregulated", Species = species),
head_down %>% mutate(Tissue = "Head", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
# Append to heatmap list
heatmap_list[[species]] <- heatmap_data
}
# Combine all species data
final_heatmap_data <- bind_rows(heatmap_list)
# Ensure all species are represented, even if they have no significant DEGs
for (species in species_order) {
if (!species %in% unique(final_heatmap_data$Species)) {
message(paste("Adding placeholder for missing species:", species))
final_heatmap_data <- bind_rows(
final_heatmap_data,
data.frame(
Orthogroup = "Unassigned", # Placeholder Orthogroup
log2FoldChange = 0,
Tissue = "Head",
Regulation = "None",
Species = species
)
)
}
}
# Ensure species order in the data
final_heatmap_data$Species <- factor(final_heatmap_data$Species, levels = species_order)
# Create heatmap matrix (Thorax only)
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Explicitly reorder the columns in heatmap_matrix
heatmap_matrix <- heatmap_matrix[, species_order, drop = FALSE] # Ensure order is applied
# Define color palettes
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE)
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100)
# Generate heatmaps (Only Head)
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Head Tissue - STRATEGY 2"
)

# Load orthogroup mapping
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure column names are correctly set
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select only relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Ensure one entry per GeneID
# Define species list
allspecies <- c("gregaria", "piceifrons", "cancellata", "americana", "cubense")
# Function to load DEGs for a given set of species and a specific tissue (ONLY thorax)
load_deg_data <- function(species_list) {
degs_up <- list()
degs_down <- list()
degs_all <- list()
for (species in species_list) {
# Define the correct file path for thorax
deg_file <- file.path(workDir, "DEG-results", paste0("DESeq2_results_Thorax_", species, ".csv"))
# Read DESeq2 results
deg_data <- read.csv(deg_file, stringsAsFactors = FALSE)
# Ensure 'GeneID' column exists (some DESeq2 outputs use 'X')
if (!"GeneID" %in% colnames(deg_data)) {
if ("X" %in% colnames(deg_data)) {
colnames(deg_data)[colnames(deg_data) == "X"] <- "GeneID"
} else {
message(paste("No GeneID column found for", species, "in Thorax - Skipping"))
next
}
}
# Convert to character for safe merging
deg_data$GeneID <- as.character(deg_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Merge with orthogroup information
deg_data <- left_join(deg_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup)) # Handle missing orthogroups
# Check if data is empty
if (nrow(deg_data) == 0) {
message(paste("No data for species:", species, "in Thorax"))
next
}
# Filter for significant DEGs based on `log2FoldChange`
upregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange >= 1) %>%
select(Orthogroup) %>%
distinct()
downregulated <- deg_data %>%
filter(padj < 0.05 & log2FoldChange <= -1) %>%
select(Orthogroup) %>%
distinct()
all_degs <- deg_data %>%
filter(padj < 0.05 & abs(log2FoldChange) >= 1) %>%
select(Orthogroup) %>%
distinct()
# Store the DEGs in the lists
degs_up[[species]] <- upregulated$Orthogroup
degs_down[[species]] <- downregulated$Orthogroup
degs_all[[species]] <- all_degs$Orthogroup
}
return(list(up = degs_up, down = degs_down, all = degs_all))
}
# Load DEG data for Thorax only
venn_data_allspecies_thorax <- load_deg_data(allspecies)
# Function to generate Venn diagrams with Orthogroups (ONLY thorax)
display_venn_with_datatable <- function(venn_data, title) {
# Calculate overlapping genes
overlap_orthogroups <- Reduce(intersect, venn_data)
# Create a dataframe for overlapping orthogroups
overlap_df <- data.frame(Orthogroup = overlap_orthogroups)
# Generate the Venn diagram
venn_plot <- venn.diagram(
x = venn_data,
category.names = allspecies,
filename = NULL,
output = TRUE,
fill = c("orange", "red", "orchid", "green", "yellow"),
alpha = 0.5,
cex = 1.2,
cat.cex = 0,
main = title,
main.cex = 1.2
)
# Clear plotting area and display Venn diagram
grid.newpage()
grid.draw(venn_plot)
# Display overlapping Orthogroups as a datatable
datatable(overlap_df, options = list(
pageLength = 10,
scrollX = TRUE,
autoWidth = TRUE,
searchHighlight = TRUE
), rownames = FALSE)
}
# Display Venn diagrams and tables for thorax only
display_venn_with_datatable(venn_data_allspecies_thorax$up, "Venn Diagram of Upregulated Orthogroups - Thorax")

display_venn_with_datatable(venn_data_allspecies_thorax$down, "Venn Diagram of Downregulated Orthogroups - Thorax")

display_venn_with_datatable(venn_data_allspecies_thorax$all, "Venn Diagram of All Significant Orthogroups - Thorax")

# Load Orthogroup information
input_file <- file.path(ortho_dir, "Orthogroups_genesprotein_Schisto_Jan2025.txt")
filtered_final_orthotable <- read.table(input_file, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
# Ensure correct column names
if ("gene_id" %in% colnames(filtered_final_orthotable)) {
colnames(filtered_final_orthotable)[colnames(filtered_final_orthotable) == "gene_id"] <- "GeneID"
}
# Select relevant columns and ensure uniqueness
filtered_final_orthotable <- filtered_final_orthotable %>%
select(GeneID, Orthogroup) %>%
distinct(GeneID, .keep_all = TRUE) # Keep unique mapping
# Define species order explicitly
species_order <- c("nitens", "cubense", "americana", "piceifrons", "cancellata", "gregaria")
# Initialize an empty list to store heatmap data
heatmap_list <- list()
# Loop through each species to process their Thorax data
for (species in species_order) {
message(paste("Processing species:", species))
# Define file path for Thorax
thorax_file <- file.path(workDir, "DEG-results", paste0("DESeq2_sigresults_Thorax_", species, ".csv"))
# Check if file exists before loading
if (!file.exists(thorax_file)) {
message(paste("Missing Thorax file for:", species, "- Assigning empty dataset"))
thorax_data <- data.frame(GeneID = character(), padj = numeric(), log2FoldChange = numeric(), stringsAsFactors = FALSE)
} else {
thorax_data <- tryCatch(read.csv(thorax_file, stringsAsFactors = FALSE), error = function(e) data.frame())
}
# Ensure GeneID column exists
if (!"GeneID" %in% colnames(thorax_data) && "X" %in% colnames(thorax_data)) {
colnames(thorax_data)[colnames(thorax_data) == "X"] <- "GeneID"
}
# Convert GeneID to character
thorax_data$GeneID <- as.character(thorax_data$GeneID)
filtered_final_orthotable$GeneID <- as.character(filtered_final_orthotable$GeneID)
# Merge with orthogroup information
thorax_data <- left_join(thorax_data, filtered_final_orthotable, by = "GeneID") %>%
mutate(Orthogroup = ifelse(is.na(Orthogroup), "Unassigned", Orthogroup))
# If no significant DEGs are found, ensure the structure is correct
if (nrow(thorax_data) == 0) {
message(paste("No significant Thorax DEGs for:", species, "- Assigning placeholder values"))
thorax_data <- data.frame(
Orthogroup = character(),
log2FoldChange = numeric(),
Tissue = character(),
Regulation = character(),
Species = character()
)
} else {
# Filter for significant DEGs and select top 500 upregulated and downregulated genes
thorax_up <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange > 1) %>%
arrange(desc(log2FoldChange)) %>%
slice(1:500)
thorax_down <- thorax_data %>%
filter(padj < 0.05 & log2FoldChange < -1) %>%
arrange(log2FoldChange) %>%
slice(1:500)
# Combine data and prepare for heatmap
thorax_data <- bind_rows(
thorax_up %>% mutate(Tissue = "Thorax", Regulation = "Upregulated", Species = species),
thorax_down %>% mutate(Tissue = "Thorax", Regulation = "Downregulated", Species = species)
) %>%
select(Orthogroup, log2FoldChange, Tissue, Regulation, Species)
}
# Append to heatmap list, ensuring species is represented
heatmap_list[[species]] <- thorax_data
}
# Combine all species data
final_heatmap_data <- bind_rows(heatmap_list)
# Ensure all species are represented, even if they have no significant DEGs
for (species in species_order) {
if (!species %in% unique(final_heatmap_data$Species)) {
message(paste("Adding placeholder for missing species:", species))
final_heatmap_data <- bind_rows(
final_heatmap_data,
data.frame(
Orthogroup = "Unassigned", # Placeholder Orthogroup
log2FoldChange = 0,
Tissue = "Thorax",
Regulation = "None",
Species = species
)
)
}
}
# Ensure species order in the data
final_heatmap_data$Species <- factor(final_heatmap_data$Species, levels = species_order)
# Create heatmap matrix (Thorax only)
heatmap_matrix <- final_heatmap_data %>%
group_by(Orthogroup, Species) %>%
summarize(log2FoldChange = mean(log2FoldChange, na.rm = TRUE), .groups = "drop") %>%
pivot_wider(names_from = Species, values_from = log2FoldChange, values_fill = 0) %>%
column_to_rownames("Orthogroup") %>%
as.matrix()
# Explicitly reorder the columns in heatmap_matrix
heatmap_matrix <- heatmap_matrix[, species_order, drop = FALSE] # Ensure order is applied
# Define color palettes
custom_cyan_orange_palette <- colorRampPalette(c("cyan", "cyan2", "cyan3", "black", "orange3", "orange2", "orange"))(100)
custom_blue_red_palette <- colorRampPalette(c("blue3", "blue2", "blue1", "white", "red", "red2", "red3"))(100)
# Define color breaks
max_abs_lfc <- max(abs(heatmap_matrix), na.rm = TRUE)
color_breaks <- seq(-max_abs_lfc, max_abs_lfc, length.out = 100)
# Generate heatmaps (Only thorax)
pheatmap(
heatmap_matrix,
color = custom_blue_red_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

pheatmap(
heatmap_matrix,
color = custom_cyan_orange_palette,
breaks = color_breaks,
cluster_rows = TRUE,
cluster_cols = FALSE,
show_rownames = FALSE,
show_colnames = TRUE,
fontsize_row = 6,
fontsize_col = 10,
main = "Heatmap of Orthologs Expression in Thorax Tissue - STRATEGY 2"
)

sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.3
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Asia/Tokyo
tzcode source: internal
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] data.table_1.16.4 lubridate_1.9.4 forcats_1.0.0
[4] stringr_1.5.1 purrr_1.0.2 tidyverse_2.0.0
[7] readr_2.1.5 DT_0.33 gridExtra_2.3
[10] VennDiagram_1.7.3 futile.logger_1.4.3 tibble_3.2.1
[13] kableExtra_1.4.0 viridis_0.6.5 viridisLite_0.4.2
[16] RColorBrewer_1.1-3 tidyr_1.3.1 pheatmap_1.0.12
[19] ggVennDiagram_1.5.3 htmlwidgets_1.6.4 plotly_4.10.4
[22] ggplot2_3.5.1 dplyr_1.1.4 knitr_1.49
loaded via a namespace (and not attached):
[1] gtable_0.3.6 xfun_0.50 bslib_0.8.0
[4] tzdb_0.4.0 crosstalk_1.2.1 vctrs_0.6.5
[7] tools_4.4.1 generics_0.1.3 pkgconfig_2.0.3
[10] lifecycle_1.0.4 farver_2.1.2 compiler_4.4.1
[13] git2r_0.35.0 textshaping_0.4.1 munsell_0.5.1
[16] httpuv_1.6.15 htmltools_0.5.8.1 sass_0.4.9
[19] yaml_2.3.10 lazyeval_0.2.2 later_1.4.1
[22] pillar_1.10.1 jquerylib_0.1.4 whisker_0.4.1
[25] cachem_1.1.0 tidyselect_1.2.1 digest_0.6.37
[28] stringi_1.8.4 labeling_0.4.3 rprojroot_2.0.4
[31] fastmap_1.2.0 colorspace_2.1-1 cli_3.6.3
[34] magrittr_2.0.3 withr_3.0.2 scales_1.3.0
[37] promises_1.3.2 timechange_0.3.0 rmarkdown_2.29
[40] lambda.r_1.2.4 httr_1.4.7 workflowr_1.7.1
[43] ragg_1.3.3 hms_1.1.3 evaluate_1.0.3
[46] rlang_1.1.4 futile.options_1.0.1 Rcpp_1.0.14
[49] glue_1.8.0 formatR_1.14 xml2_1.3.6
[52] svglite_2.1.3 rstudioapi_0.17.1 jsonlite_1.8.9
[55] R6_2.5.1 systemfonts_1.1.0 fs_1.6.5