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

Midoux Cedric's avatar
Midoux Cedric 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")
Midoux Cedric's avatar
Midoux Cedric committed
8
seqtab.nochim <- removeBimeraDenovo(seqtab, method="consensus", multithread = snakemake@threads, verbose = TRUE)
Midoux Cedric's avatar
Midoux Cedric committed
9

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

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

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