Mercurial > repos > iuc > phyloseq_from_dada2
annotate phyloseq_from_biom.R @ 3:40ebae5bbe51 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 10dfb1308ff858c6623c7dd9215a3bdf518427f9
author | iuc |
---|---|
date | Tue, 03 Dec 2024 17:45:31 +0000 |
parents | 87064cb77a52 |
children |
rev | line source |
---|---|
2
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
2 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
3 suppressPackageStartupMessages(library("optparse")) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
4 suppressPackageStartupMessages(library("phyloseq")) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
5 suppressPackageStartupMessages(library("tidyverse")) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
6 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
7 option_list <- list( |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
8 make_option(c("--BIOMfilename"), action = "store", dest = "biom", help = "Input BIOM file"), |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
9 make_option(c("--treefilename"), action = "store", dest = "tree", default = NULL, help = "Input Tree newick/nexus file"), |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
10 make_option(c("--parseFunction"), action = "store", dest = "parsefoo", default = "parse_taxonomy_default", help = "Parse function parse_taxonomy_default/read_tree_greengenes"), |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
11 make_option(c("--refseqfilename"), action = "store", dest = "sequences", default = NULL, help = "Input Sequence fasta file"), |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
12 make_option(c("--output"), action = "store", dest = "output", help = "RDS output") |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
13 ) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
14 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
15 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
16 args <- parse_args(parser, positional_arguments = TRUE) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
17 opt <- args$options |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
18 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
19 parsefoo <- get(opt$parsefoo) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
20 phyloseq_obj <- import_biom( |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
21 BIOMfilename = opt$biom, |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
22 treefilename = opt$tree, |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
23 refseqfilename = opt$sequences, |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
24 parseFunction = parsefoo |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
25 ) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
26 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
27 print(phyloseq_obj) |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
28 |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
29 # save R object to file |
87064cb77a52
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff
changeset
|
30 saveRDS(phyloseq_obj, file = opt$output, compress = TRUE) |