annotate test-data/generate.R @ 3:a2d4da20749a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 5b6fb9641a1320e13aba367c4e7bc52ae064acc6
author iuc
date Mon, 26 Feb 2024 07:53:13 +0000
parents 1979fdd0914f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e53885a980fe "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
1 library(ampvis2)
e53885a980fe "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
2
e53885a980fe "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
e53885a980fe "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))
e53885a980fe "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff changeset
5
e53885a980fe "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")
e53885a980fe "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)
e53885a980fe "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")
e53885a980fe "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)
e53885a980fe "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
1979fdd0914f "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
11
1979fdd0914f "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
1979fdd0914f "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")
1979fdd0914f "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")
1979fdd0914f "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
1979fdd0914f "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
1979fdd0914f "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
1979fdd0914f "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")
1979fdd0914f "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
1979fdd0914f "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
1979fdd0914f "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
1979fdd0914f "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
22
1979fdd0914f "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")
1979fdd0914f "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")
1979fdd0914f "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents: 0
diff changeset
25
1979fdd0914f "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