annotate test-data/generate.R @ 1:e7afc79b841e draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
author iuc
date Thu, 07 Apr 2022 14:13:03 +0000
parents 7499e3a586c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
1 library(ampvis2)
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
2
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
3 # subset taxa using 200 random OTUs
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
4 aalborgwwtps <- amp_subset_taxa(AalborgWWTPs, tax_vector = sample(AalborgWWTPs$tax$OTU, 200))
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
5
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
6 ape::write.tree(aalborgwwtps$tree, "AalborgWWTPs.nwk")
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
7 amp_export_fasta(aalborgwwtps, "AalborgWWTPs.fa", tax = F)
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
8 amp_export_otutable(aalborgwwtps, "AalborgWWTPs.otu")
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
9 write.table(aalborgwwtps$tax, file = "AalborgWWTPs.tax", quote = F, sep = "\t", row.names = F)
7499e3a586c0 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
10 write.table(aalborgwwtps$metadata, file = "AalborgWWTPs.tsv", quote = F, sep = "\t")
1
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
11
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
12 # construct data for merge_ampvis2
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
13 t <- amp_load(otutable = "AalborgWWTPs.otu.csv", metadata = "AalborgWWTPs.tsv", taxonomy = "AalborgWWTPs.tax.tsv", fasta = "AalborgWWTPs.fa", tree = "AalborgWWTPs.nwk")
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
14 d_2010 <- amp_subset_samples(t, Period %in% "2010")
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
15 # 60 samples and 109 OTUs have been filtered
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
16 # Before: 67 samples and 200 OTUs
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
17 # After: 7 samples and 91 OTUs
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
18 d_2011 <- amp_subset_samples(t, Period %in% "2011")
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
19 # 61 samples and 94 OTUs have been filtered
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
20 # Before: 67 samples and 200 OTUs
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
21 # After: 6 samples and 106 OTUs
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
22
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
23 saveRDS(d_2010, "AalborgWWTPs.2010.rds")
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
24 saveRDS(d_2011, "AalborgWWTPs.2011.rds")
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
25
e7afc79b841e "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
26 # => merging should give 13 samples