comparison phyloseq_from_dada2.R @ 1:b85ba18a8f36 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/phyloseq commit 7df921baa7aa8680421b9440a1cd6eaab1a15ce2
author iuc
date Fri, 09 Feb 2024 21:42:24 +0000
parents 46a99bd1f10e
children 87064cb77a52
comparison
equal deleted inserted replaced
0:46a99bd1f10e 1:b85ba18a8f36
8 make_option(c("--sequence_table"), action = "store", dest = "sequence_table", help = "Input sequence table"), 8 make_option(c("--sequence_table"), action = "store", dest = "sequence_table", help = "Input sequence table"),
9 make_option(c("--taxonomy_table"), action = "store", dest = "taxonomy_table", help = "Input taxonomy table"), 9 make_option(c("--taxonomy_table"), action = "store", dest = "taxonomy_table", help = "Input taxonomy table"),
10 make_option(c("--output"), action = "store", dest = "output", help = "RDS output") 10 make_option(c("--output"), action = "store", dest = "output", help = "RDS output")
11 ) 11 )
12 12
13 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list); 13 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list)
14 args <- parse_args(parser, positional_arguments = TRUE); 14 args <- parse_args(parser, positional_arguments = TRUE)
15 opt <- args$options; 15 opt <- args$options
16
17 # The input sequence_table is an integer matrix 16 # The input sequence_table is an integer matrix
18 # stored as tabular (rows = samples, columns = ASVs). 17 # stored as tabular (rows = samples, columns = ASVs).
19 seq_table_numeric_matrix <- data.matrix(read.table(opt$sequence_table, sep = "\t")); 18 seq_table_numeric_matrix <- data.matrix(read.table(opt$sequence_table, sep = "\t"))
20
21 # The input taxonomy_table is a table containing 19 # The input taxonomy_table is a table containing
22 # the assigned taxonomies exceeding the minBoot 20 # the assigned taxonomies exceeding the minBoot
23 # level of bootstrapping confidence. Rows correspond 21 # level of bootstrapping confidence. Rows correspond
24 # to sequences, columns to taxonomic levels. NA 22 # to sequences, columns to taxonomic levels. NA
25 # indicates that the sequence was not consistently 23 # indicates that the sequence was not consistently
26 # classified at that level at the minBoot threshold. 24 # classified at that level at the minBoot threshold.
27 tax_table_matrix <- as.matrix(read.table(opt$taxonomy_table, header = FALSE, sep = "\t")); 25 tax_table_matrix <- as.matrix(read.table(opt$taxonomy_table, header = FALSE, sep = "\t"))
28
29 # Construct a tax_table object. The rownames of 26 # Construct a tax_table object. The rownames of
30 # tax_tab must match the OTU names (taxa_names) 27 # tax_tab must match the OTU names (taxa_names)
31 # of the otu_table defined below. 28 # of the otu_table defined below.
32 tax_tab <- tax_table(tax_table_matrix); 29 tax_tab <- tax_table(tax_table_matrix)
33
34 # Construct an otu_table object. 30 # Construct an otu_table object.
35 otu_tab <- otu_table(seq_table_numeric_matrix, taxa_are_rows = TRUE); 31 otu_tab <- otu_table(seq_table_numeric_matrix, taxa_are_rows = TRUE)
36
37 # Construct a phyloseq object. 32 # Construct a phyloseq object.
38 phyloseq_obj <- phyloseq(otu_tab, tax_tab); 33 phyloseq_obj <- phyloseq(otu_tab, tax_tab)
39 saveRDS(phyloseq_obj, file = opt$output, compress = TRUE); 34 saveRDS(phyloseq_obj, file = opt$output, compress = TRUE)