makeSequenceTable.R 613 Bytes
Newer Older
Cedric Midoux's avatar
Cedric Midoux committed
1
library(dada2)
Cedric Midoux's avatar
Cedric Midoux committed
2
library(biomformat)
Cedric Midoux's avatar
Cedric Midoux committed
3

Cedric Midoux's avatar
Cedric Midoux committed
4
5
6
7
dada_list <- lapply(snakemake@input, readRDS)
names(dada_list) <- lapply(snakemake@input, function(x){basename(tools::file_path_sans_ext(x))})

seqtab <- makeSequenceTable(dada_list, orderBy = "abundance")
Cedric Midoux's avatar
Cedric Midoux committed
8
seqtab.nochim <- removeBimeraDenovo(seqtab, method="consensus", multithread = snakemake@threads, verbose = TRUE)
Cedric Midoux's avatar
Cedric Midoux committed
9

Cedric Midoux's avatar
Cedric Midoux committed
10
saveRDS(seqtab.nochim, snakemake@output$rds)
Cedric Midoux's avatar
Cedric Midoux committed
11

Cedric Midoux's avatar
Cedric Midoux committed
12
uniquesToFasta(seqtab.nochim, snakemake@output$fasta)
Cedric Midoux's avatar
Cedric Midoux committed
13

Cedric Midoux's avatar
Cedric Midoux committed
14
write.table(t(seqtab.nochim), snakemake@output$tsv, sep = "\t", quote = FALSE)
Cedric Midoux's avatar
Cedric Midoux committed
15
16
17

biom <- make_biom(t(seqtab.nochim))
write_biom(biom, snakemake@output$biom)