annotate phyloseq_from_biom.R @ 2:dfe800a3faaf draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
author iuc
date Sat, 16 Mar 2024 07:56:05 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
dfe800a3faaf 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
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
2
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
3 suppressPackageStartupMessages(library("optparse"))
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
4 suppressPackageStartupMessages(library("phyloseq"))
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
5 suppressPackageStartupMessages(library("tidyverse"))
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
6
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
7 option_list <- list(
dfe800a3faaf 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"),
dfe800a3faaf 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"),
dfe800a3faaf 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"),
dfe800a3faaf 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"),
dfe800a3faaf 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")
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
13 )
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
14
dfe800a3faaf 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)
dfe800a3faaf 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)
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
17 opt <- args$options
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
18
dfe800a3faaf 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)
dfe800a3faaf 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(
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
21 BIOMfilename = opt$biom,
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
22 treefilename = opt$tree,
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
23 refseqfilename = opt$sequences,
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
24 parseFunction = parsefoo
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
25 )
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
26
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
27 print(phyloseq_obj)
dfe800a3faaf planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 5ec9f9e81bb9a42dec5c331dd23215ca0b027b2b
iuc
parents:
diff changeset
28
dfe800a3faaf 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
dfe800a3faaf 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)