-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some updates to the format (including SRA removal)
- Loading branch information
Colin J. Carlson
committed
May 30, 2021
1 parent
0dd62a2
commit 8654517
Showing
42 changed files
with
19,152 additions
and
39,997 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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,99 @@ | ||
|
||
setwd("~/Github/virion") | ||
library(tidyverse) | ||
library(vroom) | ||
library(sf) | ||
library(fasterize) | ||
|
||
vir <- vroom("Virion/virion.csv.gz") | ||
iucn <- st_read(dsn = 'C:/Users/cjcar/Dropbox/CurrentIUCN', | ||
layer = 'MAMMALS') | ||
|
||
vir %>% filter(HostClass == "mammalia") %>% | ||
select(Host, Virus) %>% | ||
distinct() %>% | ||
group_by(Host) %>% | ||
summarize(NVirus = n_distinct(Virus)) -> nvir | ||
|
||
iucn %>% mutate(binomial = tolower(binomial)) %>% | ||
left_join(nvir, by = c('binomial' = 'Host')) %>% | ||
filter(NVirus > 0) -> iucn | ||
|
||
r <- raster::getData("worldclim",var="alt",res=5) # Make a blank raster | ||
map.num.m <- fasterize(iucn, r, field = NULL, fun = 'count') | ||
map.sum.m <- fasterize(iucn, r, field = "NVirus", fun = 'sum') | ||
|
||
############ | ||
|
||
iucn <- st_read(dsn = 'C:/Users/cjcar/Dropbox/CurrentIUCN', | ||
layer = 'REPTILES') | ||
|
||
vir %>% filter(HostClass == "lepidosauria" | HostOrder == "testudines") %>% | ||
select(Host, Virus) %>% | ||
distinct() %>% | ||
group_by(Host) %>% | ||
summarize(NVirus = n_distinct(Virus)) -> nvir | ||
|
||
iucn %>% mutate(binomial = tolower(binomial)) %>% | ||
left_join(nvir, by = c('binomial' = 'Host')) %>% | ||
filter(NVirus > 0) -> iucn | ||
|
||
r <- raster::getData("worldclim",var="alt",res=5) # Make a blank raster | ||
map.num.r <- fasterize(iucn, r, field = NULL, fun = 'count') | ||
map.sum.r <- fasterize(iucn, r, field = "NVirus", fun = 'sum') | ||
|
||
############ | ||
|
||
iucn <- st_read(dsn = 'C:/Users/cjcar/Dropbox/CurrentIUCN', | ||
layer = 'AMPHIBIANS') | ||
|
||
vir %>% filter(HostClass == "amphibia") %>% | ||
select(Host, Virus) %>% | ||
distinct() %>% | ||
group_by(Host) %>% | ||
summarize(NVirus = n_distinct(Virus)) -> nvir | ||
|
||
iucn %>% mutate(binomial = tolower(binomial)) %>% | ||
left_join(nvir, by = c('binomial' = 'Host')) %>% | ||
filter(NVirus > 0) -> iucn | ||
|
||
r <- raster::getData("worldclim",var="alt",res=5) # Make a blank raster | ||
map.num.a <- fasterize(iucn, r, field = NULL, fun = 'count') | ||
map.sum.a <- fasterize(iucn, r, field = "NVirus", fun = 'sum') | ||
|
||
############ | ||
|
||
library(rgdal) | ||
bl <- st_read(dsn="C:/Users/cjcar/Dropbox/Dan\'s birdlife hole/BOTW.gdb",layer="All_Species") | ||
|
||
vir %>% filter(HostClass == "aves") %>% | ||
select(Host, Virus) %>% | ||
distinct() %>% | ||
group_by(Host) %>% | ||
summarize(NVirus = n_distinct(Virus)) -> nvir | ||
|
||
bl %>% mutate(SCINAME = tolower(SCINAME)) %>% | ||
left_join(nvir, by = c('SCINAME' = 'Host')) %>% | ||
filter(NVirus > 0) -> bl2 | ||
|
||
map.num.b <- fasterize(bl2, r, field = NULL, fun = 'count') | ||
map.sum.b <- fasterize(bl2, r, field = "NVirus", fun = 'sum') | ||
|
||
library(rasterVis) | ||
|
||
s1 <- stack(map.num.m, map.num.b, map.num.r, map.num.a) | ||
names(s1) <- c("Mammals", "Birds", "Reptiles", "Amphibians") | ||
levelplot(log(s1+1), names.attr = names(s1)) | ||
|
||
s2 <- stack(map.sum.m, map.sum.b, map.sum.r, map.sum.a) | ||
names(s2) <- c("Mammals", "Birds", "Reptiles", "Amphibians") | ||
levelplot(log(s2+1), names.attr = names(s2)) | ||
|
||
s3 <- stack(map.num.m, map.sum.m, | ||
map.num.b, map.sum.b, | ||
map.num.r, map.sum.r, | ||
map.num.a, map.sum.a) | ||
names(s3) <- c("Mammal (species)", "Mammal (interactions)", | ||
"Bird (species)", "Bird (interactions)", | ||
"Reptile (species)", "Reptile (interactions)", | ||
"Amphibian (species)", "Amphibian (interactions)") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.