Mercurial > repos > iuc > ampvis2_subset_samples
annotate test-data/generate.R @ 6:f9fa155c191f draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit cb30e4b8d695e096753fe7cb5056b118b25a87fd
author | iuc |
---|---|
date | Mon, 26 Aug 2024 16:15:51 +0000 |
parents | 14b38ec15fe9 |
children |
rev | line source |
---|---|
0
03b77eb5ed68
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff
changeset
|
1 library(ampvis2) |
03b77eb5ed68
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff
changeset
|
2 |
03b77eb5ed68
"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 |
03b77eb5ed68
"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)) |
03b77eb5ed68
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
iuc
parents:
diff
changeset
|
5 |
03b77eb5ed68
"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") |
03b77eb5ed68
"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) |
03b77eb5ed68
"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") |
03b77eb5ed68
"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) |
03b77eb5ed68
"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
14b38ec15fe9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents:
0
diff
changeset
|
11 |
14b38ec15fe9
"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 |
14b38ec15fe9
"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") |
14b38ec15fe9
"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") |
14b38ec15fe9
"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 |
14b38ec15fe9
"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 |
14b38ec15fe9
"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 |
14b38ec15fe9
"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") |
14b38ec15fe9
"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 |
14b38ec15fe9
"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 |
14b38ec15fe9
"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 |
14b38ec15fe9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents:
0
diff
changeset
|
22 |
14b38ec15fe9
"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") |
14b38ec15fe9
"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") |
14b38ec15fe9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
iuc
parents:
0
diff
changeset
|
25 |
14b38ec15fe9
"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 |