Skip to content

Commit

Permalink
Added tutorial files
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNickols committed Dec 14, 2023
1 parent 2811a42 commit 7742a27
Show file tree
Hide file tree
Showing 4 changed files with 1,840 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assembly_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,13 @@ dependencies:
- zipp=3.11.0=pyhd8ed1ab_0
- zlib=1.2.13=h166bdaf_4
- zstd=1.5.2=h6239696_4
- r-colorspace=2.1_0=r42h57805ef_1
- r-farver=2.1.1=r42ha503ecb_2
- r-ggplot2=3.4.4=r42hc72bb7e_0
- r-gtable=0.3.4=r42hc72bb7e_0
- r-isoband=0.2.7=r42ha503ecb_2
- r-labeling=0.4.3=r42hc72bb7e_0
- r-munsell=0.5.0=r42hc72bb7e_1006
- r-rcolorbrewer=1.1_3=r42h785f33e_2
- r-scales=1.3.0=r42hc72bb7e_0
- r-viridislite=0.4.2=r42hc72bb7e_1
35 changes: 35 additions & 0 deletions tutorial/abundance_script.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
rm(list = ls())
library(reshape2)
library(ggplot2)

threshold <- 0.01
profile <- read.csv('animal_guts_profile.tsv', sep='\t')
profile <- profile[grepl("s__|sgb_|UNKNOWN", profile$Taxonomy) &
!grepl("t__", profile$Taxonomy),]
profile[,-1][profile[,-1] < threshold] <- 0
profile[profile$Taxonomy == "UNKNOWN",-1] = profile[profile$Taxonomy == "UNKNOWN",-1] +
(100 - colSums(profile[,-1]))

# Plot an ECDF of unknown percentage by sample
unknownECDF <- function(profile) {
df <- data.frame("abundance" = c(unlist(profile[profile$Taxonomy == "UNKNOWN",-1]),
colSums(profile[grepl("s__", profile$Taxonomy),-1]),
colSums(profile[grepl("sgb_", profile$Taxonomy),-1])),
"type" = c(rep("Unknown", ncol(profile) - 1),
rep("Known", ncol(profile) - 1),
rep("SGB", ncol(profile) - 1)),
"sample" = rep(colnames(profile)[-1], 3))

df$sample <- factor(df$sample, levels = df$sample[df$type == "Unknown"][order(df$abundance[df$type == "Unknown"])])

p1 <- ggplot(df, aes(fill=type, y=abundance, x = sample)) +
geom_bar(position="fill", stat="identity") +
theme(axis.text.x=element_blank()) +
ylab("Abundance") + xlab("Sample") +
labs(fill = "Abundance type")

dir.create(file.path("figures/"), showWarnings = FALSE)
ggsave("figures/ECDF.png", p1, width=18, height=10, units = 'cm', dpi=1000)
}

unknownECDF(profile)
63 changes: 63 additions & 0 deletions tutorial/animal_guts_metadata.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"sample_id" "diet" "flight" "habitat" "class"
"ERR5005154" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005155" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005158" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005160" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005161" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005164" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005165" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005166" "Omnivore" "Non-flying land animal" "Farm" "Aves"
"ERR5005167" "Herbivore" "Non-flying land animal" "Farm" "Mammalia"
"ERR5005168" "Omnivore" "Non-flying land animal" "Farm" "Aves"
"ERR5005169" "Omnivore" "Non-flying land animal" "Farm" "Aves"
"ERR5005170" "Omnivore" "Non-flying land animal" "Farm" "Mammalia"
"ERR5005284" "Herbivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005285" "Herbivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005286" "Insectivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005287" "Omnivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005289" "Herbivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005302" "Carnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005305" "Herbivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005309" "Carnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005310" "Omnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005311" "Insectivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005312" "Carnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005314" "Omnivore" "Non-flying land animal" "Captive herp" "Amphibia"
"ERR5005315" "Insectivore" "Non-flying land animal" "Captive herp" "Amphibia"
"ERR5005317" "Omnivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005318" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005319" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005320" "Omnivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005321" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005322" "Herbivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005325" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005326" "Carnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005330" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005335" "Herbivore" "Non-flying land animal" "Captive aquatic mammal" "Mammalia"
"ERR5005162" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005334" "Herbivore" "Non-flying land animal" "Captive aquatic mammal" "Mammalia"
"ERR5005156" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005157" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005159" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005163" "Carnivore" "Marine animal" "Ocean" "Mammalia"
"ERR5005171" "Herbivore" "Flying land animal" "Farm" "Aves"
"ERR5005283" "Carnivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005288" "Omnivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005290" "Insectivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005291" "Carnivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005292" "Insectivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005293" "Carnivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005301" "Insectivore" "Non-flying land animal" "Captive terrestrial mammal" "Mammalia"
"ERR5005303" "Herbivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005304" "Omnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005306" "Carnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005307" "Herbivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005308" "Carnivore" "Non-flying land animal" "Captive herp" "Reptilia"
"ERR5005313" "Omnivore" "Non-flying land animal" "Captive herp" "Amphibia"
"ERR5005316" "Insectivore" "Non-flying land animal" "Captive herp" "Amphibia"
"ERR5005323" "Omnivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005324" "Omnivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005327" "Carnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005328" "Omnivore" "Flying land animal" "Captive bird" "Aves"
"ERR5005329" "Omnivore" "Non-flying land animal" "Captive bird" "Aves"
"ERR5005331" "Herbivore" "Non-flying land animal" "Captive bird" "Aves"
Loading

0 comments on commit 7742a27

Please sign in to comment.