Mercurial > repos > iuc > ampvis2_export_otu
comparison test-data/generate.R @ 0:8e6d236aab1c draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit f32c3d9a92dca8a60504824fc7bcee290c30a211
author | iuc |
---|---|
date | Tue, 01 Apr 2025 10:00:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8e6d236aab1c |
---|---|
1 library(ampvis2) | |
2 | |
3 # subset taxa using 200 random OTUs | |
4 aalborgwwtps <- amp_subset_taxa(AalborgWWTPs, tax_vector = sample(AalborgWWTPs$tax$OTU, 200)) | |
5 | |
6 ape::write.tree(aalborgwwtps$tree, "AalborgWWTPs.nwk") | |
7 amp_export_fasta(aalborgwwtps, "AalborgWWTPs.fa", tax = F) | |
8 amp_export_otutable(aalborgwwtps, "AalborgWWTPs.otu") | |
9 write.table(aalborgwwtps$tax, file = "AalborgWWTPs.tax", quote = F, sep = "\t", row.names = F) | |
10 write.table(aalborgwwtps$metadata, file = "AalborgWWTPs.tsv", quote = F, sep = "\t") | |
11 | |
12 # construct data for merge_ampvis2 | |
13 t <- amp_load(otutable = "AalborgWWTPs.otu.csv", metadata = "AalborgWWTPs.tsv", taxonomy = "AalborgWWTPs.tax.tsv", fasta = "AalborgWWTPs.fa", tree = "AalborgWWTPs.nwk") | |
14 d_2010 <- amp_subset_samples(t, Period %in% "2010") | |
15 # 60 samples and 109 OTUs have been filtered | |
16 # Before: 67 samples and 200 OTUs | |
17 # After: 7 samples and 91 OTUs | |
18 d_2011 <- amp_subset_samples(t, Period %in% "2011") | |
19 # 61 samples and 94 OTUs have been filtered | |
20 # Before: 67 samples and 200 OTUs | |
21 # After: 6 samples and 106 OTUs | |
22 | |
23 saveRDS(d_2010, "AalborgWWTPs.2010.rds") | |
24 saveRDS(d_2011, "AalborgWWTPs.2011.rds") | |
25 | |
26 # => merging should give 13 samples |