annotate test-data/generate.R @ 4:4289db874e3c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit ab75ba7665d7fb5c18ad08dfbba92b273f991dfc
author iuc
date Sat, 16 Mar 2024 11:34:53 +0000
parents 7b81221e7925
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b7f7d0c6d579 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
1 library(ampvis2)
b7f7d0c6d579 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
2
b7f7d0c6d579 "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
b7f7d0c6d579 "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))
b7f7d0c6d579 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
5
b7f7d0c6d579 "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")
b7f7d0c6d579 "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)
b7f7d0c6d579 "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")
b7f7d0c6d579 "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)
b7f7d0c6d579 "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
7b81221e7925 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
11
7b81221e7925 "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
7b81221e7925 "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")
7b81221e7925 "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")
7b81221e7925 "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
7b81221e7925 "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
7b81221e7925 "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
7b81221e7925 "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")
7b81221e7925 "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
7b81221e7925 "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
7b81221e7925 "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
7b81221e7925 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
22
7b81221e7925 "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")
7b81221e7925 "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")
7b81221e7925 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
25
7b81221e7925 "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