# HG changeset patch # User iuc # Date 1594726860 14400 # Node ID 0b884b080bb6c20632d075e80e4dc313c90e403c # Parent 69900ffd3b8e96158c5356949fa3dc76774f13b3 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dada2 commit 8533fe71d1d50f09348da2dc34941724407a1ffe" diff -r 69900ffd3b8e -r 0b884b080bb6 macros.xml --- a/macros.xml Mon Mar 16 08:22:08 2020 -0400 +++ b/macros.xml Tue Jul 14 07:41:00 2020 -0400 @@ -7,7 +7,7 @@ - 1.14 + 1.16 0 @@ -124,6 +124,9 @@ .. image:: pairpipe.png +Note: In particular for the analysis of paired collections the collections should be sorted lexicographical +before the analysis. + For single end data you the steps "Unzip collection" and "mergePairs" are not necessary. More information may be found on the dada2 homepage:: https://benjjneb.github.io/dada2/index.html (in particular tutorials) or the documentation of dada2's R package https://bioconductor.org/packages/release/bioc/html/dada2.html (in particular the pdf which contains the full documentation of all parameters) diff -r 69900ffd3b8e -r 0b884b080bb6 static/images/pairpipe.png Binary file static/images/pairpipe.png has changed diff -r 69900ffd3b8e -r 0b884b080bb6 static/images/pairpipe.svg --- a/static/images/pairpipe.svg Mon Mar 16 08:22:08 2020 -0400 +++ b/static/images/pairpipe.svg Tue Jul 14 07:41:00 2020 -0400 @@ -24,7 +24,7 @@ image/svg+xml - + @@ -37,16 +37,16 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1016" + inkscape:window-width="1680" + inkscape:window-height="986" id="namedview386" showgrid="false" inkscape:snap-global="true" inkscape:snap-bbox="false" inkscape:object-paths="true" - inkscape:zoom="1" - inkscape:cx="650.80177" - inkscape:cy="176.12189" + inkscape:zoom="2" + inkscape:cx="336.68624" + inkscape:cy="192.12189" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" @@ -443,22 +443,22 @@ plotQualityProfile + style="stroke:#000000;marker-end:url(#id2);stroke-width:0.93333333;stroke-miterlimit:4;stroke-dasharray:none" /> + d="m 283.77925,110.5 h 33.78051" + style="stroke:#000000;stroke-width:0.93333333;marker-end:url(#id2);stroke-miterlimit:4;stroke-dasharray:none" /> @@ -524,7 +524,7 @@ sodipodi:role="line">and addSpecies + style="stroke:#000000;marker-end:url(#id2);stroke-width:0.93333333;stroke-miterlimit:4;stroke-dasharray:none" /> + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93333333;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#id2);stroke-miterlimit:4;stroke-dasharray:none" /> + style="stroke:#000000;marker-end:url(#id2);stroke-width:0.93333333;stroke-miterlimit:4;stroke-dasharray:none" /> + style="stroke:#000000;marker-end:url(#id2);stroke-width:0.93333333;stroke-miterlimit:4;stroke-dasharray:none" /> + transform="translate(-52.17332,-509.99998)"> filterAndTrim - Unzip Collection - - - - - + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.93333333;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#id2);stroke-miterlimit:4;stroke-dasharray:none" /> @@ -815,34 +779,34 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path5609" - d="M 117.55976,114.5 161.14262,20.499995" - style="stroke:#000000;marker-end:url(#id2)" /> + d="M 121.78486,109.34886 167.41518,39.34955" + style="stroke:#000000;stroke-width:0.93333334;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#id2)" /> Paired input dataset collection + style="stroke:#000000;marker-end:url(#id2);stroke-width:0.93333333;stroke-miterlimit:4;stroke-dasharray:none" /> plotComplexity + + + Unzip & Sortdataset collection + + + diff -r 69900ffd3b8e -r 0b884b080bb6 test-data/gentest.R --- a/test-data/gentest.R Mon Mar 16 08:22:08 2020 -0400 +++ b/test-data/gentest.R Tue Jul 14 07:41:00 2020 -0400 @@ -1,192 +1,186 @@ -library(dada2, quietly=T) -library(ggplot2, quietly=T) +library(dada2, quietly = T) +library(ggplot2, quietly = T) -sample.names <- c('F3D0_S188_L001', 'F3D141_S207_L001') -fwd <- c('F3D0_S188_L001_R1_001.fastq.gz', 'F3D141_S207_L001_R1_001.fastq.gz') -rev <- c('F3D0_S188_L001_R2_001.fastq.gz', 'F3D141_S207_L001_R2_001.fastq.gz') +sample_names <- c("F3D0_S188_L001", "F3D141_S207_L001") +fwd <- c("F3D0_S188_L001_R1_001.fastq.gz", "F3D141_S207_L001_R1_001.fastq.gz") +rev <- c("F3D0_S188_L001_R2_001.fastq.gz", "F3D141_S207_L001_R2_001.fastq.gz") -filt.fwd <- c('filterAndTrim_F3D0_R1.fq.gz', 'filterAndTrim_F3D141_R1.fq.gz') -filt.rev <- c('filterAndTrim_F3D0_R2.fq.gz', 'filterAndTrim_F3D141_R2.fq.gz') +filt_fwd <- c("filterAndTrim_F3D0_R1.fq.gz", "filterAndTrim_F3D141_R1.fq.gz") +filt_rev <- c("filterAndTrim_F3D0_R2.fq.gz", "filterAndTrim_F3D141_R2.fq.gz") print("filterAndTrim") -for(i in 1:length(fwd)){ - ftout <- filterAndTrim(fwd[i], filt.fwd[i], rev[i], filt.rev[i]) - b <- paste(strsplit(fwd[i], ".", fixed=T)[[1]][1], "tab", sep=".") - write.table(ftout, b, quote=F, sep="\t", col.names=NA) +for (i in seq_len(fwd)) { + ftout <- dada2::filterAndTrim(fwd[i], filt_fwd[i], rev[i], filt_rev[i]) + b <- paste(strsplit(fwd[i], ".", fixed = T)[[1]][1], "tab", sep = ".") + write.table(ftout, b, quote = F, sep = "\t", col.names = NA) } # In the test only the 1st data set is used t <- data.frame() -t <- rbind(t, ftout[1,]) +t <- rbind(t, ftout[1, ]) colnames(t) <- colnames(ftout) rownames(t) <- rownames(ftout)[1] -write.table(t, "filterAndTrim.tab", quote=F, sep="\t", col.names=NA) +write.table(t, "filterAndTrim.tab", quote = F, sep = "\t", col.names = NA) -names(fwd) <- sample.names -names(rev) <- sample.names -names(filt.fwd) <- sample.names -names(filt.rev) <- sample.names +names(fwd) <- sample_names +names(rev) <- sample_names +names(filt_fwd) <- sample_names +names(filt_rev) <- sample_names # Plot quality profile (just for one file, Galaxy compares with sim_size) print("plots") -qp <- plotQualityProfile(fwd) -ggsave('qualityProfile_fwd.pdf', qp, width = 20,height = 15,units = c("cm")) -qp <- plotQualityProfile(rev) -ggsave('qualityProfile_rev.pdf', qp, width = 20,height = 15,units = c("cm")) -qp <- plotQualityProfile(fwd[1]) -ggsave('qualityProfile.pdf', qp, width = 20,height = 15,units = c("cm")) +qp <- dada2::plotQualityProfile(fwd) +ggsave("qualityProfile_fwd.pdf", qp, width = 20, height = 15, units = c("cm")) +qp <- dada2::plotQualityProfile(rev) +ggsave("qualityProfile_rev.pdf", qp, width = 20, height = 15, units = c("cm")) +qp <- dada2::plotQualityProfile(fwd[1]) +ggsave("qualityProfile.pdf", qp, width = 20, height = 15, units = c("cm")) # Plot complexity (just for one file, Galaxy compares with sim_size) -cp <- plotComplexity(fwd) -ggsave('complexity_fwd.pdf', cp, width = 20,height = 15,units = c("cm")) -cp <- plotComplexity(rev) -ggsave('complexity_rev.pdf', cp, width = 20,height = 15,units = c("cm")) -cp <- plotComplexity(fwd[1]) -ggsave('complexity.pdf', cp, width = 20,height = 15,units = c("cm")) +cp <- dada2::plotComplexity(fwd) +ggsave("complexity_fwd.pdf", cp, width = 20, height = 15, units = c("cm")) +cp <- dada2::plotComplexity(rev) +ggsave("complexity_rev.pdf", cp, width = 20, height = 15, units = c("cm")) +cp <- dada2::plotComplexity(fwd[1]) +ggsave("complexity.pdf", cp, width = 20, height = 15, units = c("cm")) # learn Errors print("learnErrors") -err.fwd <- learnErrors(filt.fwd) -saveRDS(err.fwd, file='learnErrors_R1.Rdata') -plot <- plotErrors(err.fwd) -ggsave('learnErrors_R1.pdf', plot, width = 20,height = 15,units = c("cm")) +err_fwd <- dada2::learnErrors(filt_fwd) +saveRDS(err_fwd, file = "learnErrors_R1.Rdata") +plot <- dada2::plotErrors(err_fwd) +ggsave("learnErrors_R1.pdf", plot, width = 20, height = 15, units = c("cm")) -err.rev <- learnErrors(filt.rev) -saveRDS(err.rev, file='learnErrors_R2.Rdata') -plot <- plotErrors(err.rev) -ggsave('learnErrors.pdf', plot, width = 20,height = 15,units = c("cm")) +err_rev <- dada2::learnErrors(filt_rev) +saveRDS(err_rev, file = "learnErrors_R2.Rdata") +plot <- dada2::plotErrors(err_rev) +ggsave("learnErrors.pdf", plot, width = 20, height = 15, units = c("cm")) # dada print("dada") -dada.fwd <- dada(filt.fwd, err.fwd) -dada.rev <- dada(filt.rev, err.rev) -for( id in sample.names ){ - saveRDS(dada.fwd[[id]], file=paste("dada_", id,"_R1.Rdata", sep="")) - saveRDS(dada.rev[[id]], file=paste("dada_", id,"_R2.Rdata", sep="")) +dada_fwd <- dada2::dada(filt_fwd, err_fwd) +dada_rev <- dada2::dada(filt_rev, err_rev) +for (id in sample_names) { + saveRDS(dada_fwd[[id]], file = paste("dada_", id, "_R1.Rdata", sep = "")) + saveRDS(dada_rev[[id]], file = paste("dada_", id, "_R2.Rdata", sep = "")) } # merge pairs print("mergePairs") -merged <- mergePairs(dada.fwd, filt.fwd, dada.rev, filt.rev) -for( id in sample.names ){ - saveRDS(merged[[id]], file=paste("mergePairs_", id,".Rdata", sep="")) +merged <- dada2::mergePairs(dada_fwd, filt_fwd, dada_rev, filt_rev) +for (id in sample_names) { + saveRDS(merged[[id]], file = paste("mergePairs_", id, ".Rdata", sep = "")) } # make sequence table print("makeSequenceTable") seqtab <- makeSequenceTable(merged) -write.table(t(seqtab), file="makeSequenceTable.tab", quote=F, sep="\t", row.names = T, col.names = NA) +write.table(t(seqtab), file = "makeSequenceTable.tab", quote = F, sep = "\t", row.names = T, col.names = NA) -reads.per.seqlen <- tapply(colSums(seqtab), factor(nchar(getSequences(seqtab))), sum) -df <- data.frame(length=as.numeric(names(reads.per.seqlen)), count=reads.per.seqlen) -pdf( 'makeSequenceTable.pdf' ) -ggplot(data=df, aes(x=length, y=count)) + +reads_per_seqlen <- tapply(colSums(seqtab), factor(nchar(getSequences(seqtab))), sum) +df <- data.frame(length = as.numeric(names(reads_per_seqlen)), count = reads_per_seqlen) +pdf("makeSequenceTable.pdf") +ggplot(data = df, aes(x = length, y = count)) + geom_col() + theme_bw() bequiet <- dev.off() # remove bimera print("removeBimera") -seqtab.nochim <- removeBimeraDenovo(seqtab) -write.table(t(seqtab), file="removeBimeraDenovo.tab", quote=F, sep="\t", row.names = T, col.names = NA) +seqtab_nochim <- dada2::removeBimeraDenovo(seqtab) +write.table(t(seqtab), file = "removeBimeraDenovo.tab", quote = F, sep = "\t", row.names = T, col.names = NA) # assign taxonomy/species -tl <- 'Level1,Level2,Level3,Level4,Level5' +tl <- "Level1,Level2,Level3,Level4,Level5" tl <- strsplit(tl, ",")[[1]] set.seed(42) print("assignTaxonomyAndSpecies") -taxa <- assignTaxonomy(seqtab.nochim, 'reference.fa.gz', outputBootstraps = T, taxLevels=tl, multithread = 1) +taxa <- dada2::assignTaxonomy(seqtab_nochim, "reference.fa.gz", outputBootstraps = T, taxLevels = tl, multithread = 1) -taxa$tax <- addSpecies(taxa$tax, 'reference_species.fa.gz') -write.table(taxa$tax, file = 'assignTaxonomyAddspecies.tab', quote = F, sep = "\t", row.names = T, col.names = NA) +taxa$tax <- dada2::addSpecies(taxa$tax, "reference_species.fa.gz") +write.table(taxa$tax, file = "assignTaxonomyAddspecies.tab", quote = F, sep = "\t", row.names = T, col.names = NA) -write.table(taxa$boot, file = 'assignTaxonomyAddspecies_boot.tab', quote = F, sep = "\t", row.names = T, col.names = NA) +write.table(taxa$boot, file = "assignTaxonomyAddspecies_boot.tab", quote = F, sep = "\t", row.names = T, col.names = NA) -## Generate extra test data for parameter testing +## Generate extra test data for parameter testing print("alternatives") -filterAndTrim(fwd, c('filterAndTrim_single_F3D0_R1.fq.gz', 'filterAndTrim_single_F3D141_R1.fq.gz'), rm.phix = T, orient.fwd = 'TACGG') +dada2::filterAndTrim(fwd, c("filterAndTrim_single_F3D0_R1.fq.gz", "filterAndTrim_single_F3D141_R1.fq.gz"), rm.phix = T, orient.fwd = "TACGG") -filterAndTrim(fwd, c('filterAndTrim_single_trimmers_F3D0_R1.fq.gz', 'filterAndTrim_single_trimmers_F3D141_R1.fq.gz'), truncQ = 30, truncLen = 2, trimLeft = 150, trimRight = 2) +dada2::filterAndTrim(fwd, c("filterAndTrim_single_trimmers_F3D0_R1.fq.gz", "filterAndTrim_single_trimmers_F3D141_R1.fq.gz"), truncQ = 30, truncLen = 2, trimLeft = 150, trimRight = 2) -filterAndTrim(fwd, c('filterAndTrim_single_filters_F3D0_R1.fq.gz', 'filterAndTrim_single_filters_F3D141_R1.fq.gz'), maxLen = 255, minLen = 60, maxN = 100, minQ = 13, maxEE = 1) +dada2::filterAndTrim(fwd, c("filterAndTrim_single_filters_F3D0_R1.fq.gz", "filterAndTrim_single_filters_F3D141_R1.fq.gz"), maxLen = 255, minLen = 60, maxN = 100, minQ = 13, maxEE = 1) -merged_nondef <- mergePairs(dada.fwd, filt.fwd, dada.rev, filt.rev, minOverlap = 8, maxMismatch = 1, justConcatenate = TRUE, trimOverhang = TRUE) -for( id in sample.names ){ - saveRDS(merged_nondef[[id]], file=paste("mergePairs_", id,"_nondefault.Rdata", sep="")) +merged_nondef <- dada2::mergePairs(dada_fwd, filt_fwd, dada_rev, filt_rev, minOverlap = 8, maxMismatch = 1, justConcatenate = TRUE, trimOverhang = TRUE) +for (id in sample_names) { + saveRDS(merged_nondef[[id]], file = paste("mergePairs_", id, "_nondefault.Rdata", sep = "")) } -rb.dada.fwd <- removeBimeraDenovo(dada.fwd[["F3D0_S188_L001"]]) -write.table(rb.dada.fwd, file = 'removeBimeraDenovo_F3D0_dada_uniques.tab', quote = F, sep = "\t", row.names = T, col.names = F) +rb_dada_fwd <- dada2::removeBimeraDenovo(dada_fwd[["F3D0_S188_L001"]]) +write.table(rb_dada_fwd, file = "removeBimeraDenovo_F3D0_dada_uniques.tab", quote = F, sep = "\t", row.names = T, col.names = F) -rb.merged <- removeBimeraDenovo(merged, method="pooled") -saveRDS(rb.merged, file='removeBimeraDenovo_F3D0_mergepairs.Rdata') - +rb_merged <- dada2::removeBimeraDenovo(merged, method = "pooled") +saveRDS(rb_merged, file = "removeBimeraDenovo_F3D0_mergepairs.Rdata") + # SeqCounts -getN <- function(x){ sum(getUniques(x)) } - -read.uniques <- function ( fname ) { - p <- read.table(fname, header=F, sep="\t") - n <-x[,2] - names(n)<-x[,1] +get_n <- function(x) { + sum(dada2::getUniques(x)) } - print("seqCounts ft") -samples = list() -samples[["F3D0_S188_L001_R1_001.tab"]] <- read.table("F3D0_S188_L001_R1_001.tab", header=T, sep="\t", row.names=1) +samples <- list() +samples[["F3D0_S188_L001_R1_001.tab"]] <- read.table("F3D0_S188_L001_R1_001.tab", header = T, sep = "\t", row.names = 1) dname <- "filter" tdf <- samples[["F3D0_S188_L001_R1_001.tab"]] -names(tdf) <- paste( dname, names(tdf) ) -tdf <- cbind( data.frame(samples=names( samples )), tdf) -write.table(tdf, "seqCounts_filter.tab", quote=F, sep="\t", row.names = F, col.names = T) +names(tdf) <- paste(dname, names(tdf)) +tdf <- cbind(data.frame(samples = names(samples)), tdf) +write.table(tdf, "seqCounts_filter.tab", quote = F, sep = "\t", row.names = F, col.names = T) -samples = list() -samples[["F3D0_S188_L001_R1_001.tab"]] <- read.table("F3D0_S188_L001_R1_001.tab", header=T, sep="\t", row.names=1) -samples[["F3D141_S207_L001_R1_001.tab"]] <- read.table("F3D141_S207_L001_R1_001.tab", header=T, sep="\t", row.names=1) +samples <- list() +samples[["F3D0_S188_L001_R1_001.tab"]] <- read.table("F3D0_S188_L001_R1_001.tab", header = T, sep = "\t", row.names = 1) +samples[["F3D141_S207_L001_R1_001.tab"]] <- read.table("F3D141_S207_L001_R1_001.tab", header = T, sep = "\t", row.names = 1) dname <- "filter" tdf <- samples[["F3D0_S188_L001_R1_001.tab"]] tdf <- rbind(tdf, samples[["F3D141_S207_L001_R1_001.tab"]]) -names(tdf) <- paste( dname, names(tdf) ) -tdf <- cbind( data.frame(samples=names( samples )), tdf) -write.table(tdf, "seqCounts_filter_both.tab", quote=F, sep="\t", row.names = F, col.names = T) +names(tdf) <- paste(dname, names(tdf)) +tdf <- cbind(data.frame(samples = names(samples)), tdf) +write.table(tdf, "seqCounts_filter_both.tab", quote = F, sep = "\t", row.names = F, col.names = T) print("seqCounts dada") -samples = list() -samples[["dada_F3D0_S188_L001_R1.Rdata"]] <- readRDS('dada_F3D0_S188_L001_R1.Rdata') -samples[["dada_F3D141_S207_L001_R1.Rdata"]] <- readRDS('dada_F3D141_S207_L001_R1.Rdata') +samples <- list() +samples[["dada_F3D0_S188_L001_R1.Rdata"]] <- readRDS("dada_F3D0_S188_L001_R1.Rdata") +samples[["dada_F3D141_S207_L001_R1.Rdata"]] <- readRDS("dada_F3D141_S207_L001_R1.Rdata") dname <- "dadaF" -tdf <- data.frame( samples = names(samples) ) -tdf[[ dname ]] <- sapply(samples, getN) -write.table(tdf, "seqCounts_dadaF.tab", quote=F, sep="\t", row.names = F, col.names = T) +tdf <- data.frame(samples = names(samples)) +tdf[[dname]] <- sapply(samples, get_n) +write.table(tdf, "seqCounts_dadaF.tab", quote = F, sep = "\t", row.names = F, col.names = T) print("seqCounts mp") -samples = list() -samples[["mergePairs_F3D0_S188_L001.Rdata"]] <- readRDS('mergePairs_F3D0_S188_L001.Rdata') -samples[["mergePairs_F3D141_S207_L001.Rdata"]] <- readRDS('mergePairs_F3D141_S207_L001.Rdata') +samples <- list() +samples[["mergePairs_F3D0_S188_L001.Rdata"]] <- readRDS("mergePairs_F3D0_S188_L001.Rdata") +samples[["mergePairs_F3D141_S207_L001.Rdata"]] <- readRDS("mergePairs_F3D141_S207_L001.Rdata") dname <- "merge" -tdf <- data.frame( samples = names(samples) ) -tdf[[ dname ]] <- sapply(samples, getN) -write.table(tdf, "seqCounts_merge.tab", quote=F, sep="\t", row.names = F, col.names = T) +tdf <- data.frame(samples = names(samples)) +tdf[[dname]] <- sapply(samples, get_n) +write.table(tdf, "seqCounts_merge.tab", quote = F, sep = "\t", row.names = F, col.names = T) print("seqCounts st") -samples = list() -samples <- t(as.matrix( read.table("makeSequenceTable.tab", header=T, sep="\t", row.names=1) )) +samples <- list() +samples <- t(as.matrix(read.table("makeSequenceTable.tab", header = T, sep = "\t", row.names = 1))) dname <- "seqtab" -tdf <- data.frame( samples = row.names(samples) ) -tdf[[ dname ]] <- rowSums(samples) -write.table(tdf, "seqCounts_seqtab.tab", quote=F, sep="\t", row.names = F, col.names = T) +tdf <- data.frame(samples = row.names(samples)) +tdf[[dname]] <- rowSums(samples) +write.table(tdf, "seqCounts_seqtab.tab", quote = F, sep = "\t", row.names = F, col.names = T) print("seqCounts rb") -samples = list() -samples <- t(as.matrix( read.table("removeBimeraDenovo.tab", header=T, sep="\t", row.names=1) )) +samples <- list() +samples <- t(as.matrix(read.table("removeBimeraDenovo.tab", header = T, sep = "\t", row.names = 1))) dname <- "nochim" -tdf <- data.frame( samples = row.names(samples) ) -tdf[[ dname ]] <- rowSums(samples) -write.table(tdf, "seqCounts_nochim.tab", quote=F, sep="\t", row.names = F, col.names = T) - +tdf <- data.frame(samples = row.names(samples)) +tdf[[dname]] <- rowSums(samples) +write.table(tdf, "seqCounts_nochim.tab", quote = F, sep = "\t", row.names = F, col.names = T) diff -r 69900ffd3b8e -r 0b884b080bb6 test-data/learnErrors.pdf Binary file test-data/learnErrors.pdf has changed diff -r 69900ffd3b8e -r 0b884b080bb6 test-data/learnErrors_R1.pdf Binary file test-data/learnErrors_R1.pdf has changed