-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9a707
commit a95049c
Showing
16 changed files
with
4,088 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Proportion of affected species | ||
|
||
# prop_critical ~ sites + (1|method) + (1|richness) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
#################### eDNA expeditions - scientific analysis #################### | ||
########################## Environmental data download ######################### | ||
# January of 2024 | ||
# Author: Mike Burrows | ||
# Contact: [email protected] | ||
# Author: Silas Principe, Mike Burrows | ||
# Contact: [email protected]; [email protected] | ||
# | ||
########## Read and analyse eDNA data from UNESCO World Heritage Sites ######### | ||
############## Plot eDNA data from UNESCO World Heritage Sites ################# | ||
|
||
# Load packages | ||
library(dplyr) | ||
library(stringr) | ||
library(purrr) | ||
library(arrow) | ||
library(data.table) | ||
library(ggplot2) | ||
fs::dir_create("figures") | ||
|
||
|
||
#### | ||
|
||
speciestherm<-read_parquet("results/species_tsummaries.parquet") | ||
|
||
speciesthermdt<-data.table(speciestherm) | ||
|
@@ -30,28 +29,18 @@ speciesthermsite<-read_parquet("results/tsummaries_aggregated.parquet") | |
|
||
speciesthermsitedt<-data.table(speciesthermsite) | ||
|
||
### CTI by higher geography areas ##### | ||
|
||
names(speciesthermsitedt) | ||
# [1] "species" "AphiaID" "source_obis" "source_gbif" "source_dna" | ||
# [6] "higherGeography" "q_0.5" "q_0.75" "q_0.9" "q_0.95" | ||
# [11] "q_0.99" "q_1" "mean" "sd" "q_0" | ||
# [16] "q_0.01" "q_0.05" "q_0.1" "q_0.25" "site_current" | ||
# [21] "site_ssp126_dec100" "site_ssp126_dec50" "site_ssp245_dec100" "site_ssp245_dec50" "site_ssp370_dec100" | ||
# [26] "site_ssp370_dec50" "site_ssp460_dec100" "site_ssp460_dec50" "site_ssp585_dec100" "site_ssp585_dec50" | ||
# [31] "records" "where" | ||
speciesthermsitedt$where <- ifelse(speciesthermsitedt$where == "Both" | | ||
speciesthermsitedt$where == "OBIS/GBIF", "Databases", "eDNA") | ||
|
||
### CTI by higher geography areas ##### | ||
ctihighergeog<-speciesthermsitedt[,list(ctiavg=mean(q_0.5), | ||
sdcti=sd(q_0.5), | ||
str=mean(q_0.9-q_0.1), | ||
sstavg=mean(site_current), | ||
nspp=.N),by=c("higherGeography","where")] | ||
|
||
# Save for later use | ||
write_parquet(ctihighergeog, "results/cti_highergeo.parquet") | ||
|
||
# Save figures | ||
pdf("figures/AllSpeciesThermalMetrics.pdf",height=3.5,width=8) | ||
par(mfrow=c(1,3)) | ||
plot(data=ctihighergeog,ctiavg~sstavg,pch=16,col=unclass(as.factor(where)),cex=1.5,main="All species", | ||
xlab="Sea surface temperature (°C)", ylab="Community Temperature Index (°C)") | ||
|
@@ -68,6 +57,53 @@ plot(data=ctihighergeog,str~sstavg,pch=16,col=unclass(as.factor(where)),cex=1.5, | |
#abline(a=0,b=1,lty=3) | ||
legend("bottomleft",legend=levels(as.factor(ctihighergeog$where)),inset=0.02,col=1:3,pt.cex=1.5,pch=16) | ||
|
||
|
||
(p1 <- ggplot(ctihighergeog) + | ||
geom_abline(slope = 1, intercept = 0, color = "grey90") + | ||
geom_point(aes(x = sstavg, y = ctiavg, colour = where, size = nspp), alpha = .5) + | ||
scale_color_manual(values = c("#00c3c9", "#f58000")) + #"#5151db", | ||
scale_y_continuous(limits = c(5, 30)) + | ||
scale_x_continuous(limits = c(5, 30)) + | ||
scale_size(range = c(2,7)) + | ||
guides(colour = guide_legend(override.aes = list(alpha = 1, size = 3))) + | ||
ylab("Community Thermal Index (°C)") + | ||
xlab("Sea Surface Temperature (°C)") + | ||
theme_light() + | ||
theme(panel.grid = element_blank(), | ||
panel.grid.major.y = element_line(colour = "grey90", linewidth = 0.3, linetype = 2), | ||
legend.title = element_blank())) | ||
|
||
(p2 <- ggplot(ctihighergeog) + | ||
geom_point(aes(x = sstavg, y = sdcti, colour = where, size = nspp), alpha = .5) + | ||
scale_color_manual(values = c("#00c3c9", "#f58000")) + #"#5151db", | ||
# scale_y_continuous(limits = c(5, 30)) + | ||
# scale_x_continuous(limits = c(5, 30)) + | ||
scale_size(range = c(2,7)) + | ||
guides(colour = guide_legend(override.aes = list(alpha = 1, size = 3))) + | ||
ylab("SD CTI (°C)") + | ||
xlab("Sea Surface Temperature (°C)") + | ||
theme_light() + | ||
theme(panel.grid = element_blank(), | ||
panel.grid.major.y = element_line(colour = "grey90", linewidth = 0.3, linetype = 2), | ||
legend.title = element_blank())) | ||
|
||
(p3 <- ggplot(ctihighergeog) + | ||
geom_point(aes(x = sstavg, y = str, colour = where, size = nspp), alpha = .5) + | ||
scale_color_manual(values = c("#00c3c9", "#f58000")) + #"#5151db", | ||
# scale_y_continuous(limits = c(5, 30)) + | ||
# scale_x_continuous(limits = c(5, 30)) + | ||
scale_size(range = c(2,7)) + | ||
guides(colour = guide_legend(override.aes = list(alpha = 1, size = 3))) + | ||
ylab("Species thermal range (average, °C)") + | ||
xlab("Sea Surface Temperature (°C)") + | ||
theme_light() + | ||
theme(panel.grid = element_blank(), | ||
panel.grid.major.y = element_line(colour = "grey90", linewidth = 0.3, linetype = 2), | ||
legend.title = element_blank())) | ||
|
||
library(patchwork) | ||
p1 + p2 + p3 + patchwork::plot_layout(guides = "collect") | ||
|
||
### Add taxon information | ||
|
||
specieslist<-read_parquet("results/species_list.parquet") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.