dada2 icon indicating copy to clipboard operation
dada2 copied to clipboard

DADA2 ITS WORKFLOW CUTADAPT ERRORR

Open Bettyajibade opened this issue 2 years ago • 5 comments

I am using the DADA2 ITS (1.8) workflow to analyse my ITS data. I am running the cutadapt command on the reads and there is no output in the created folder. I used the following commands:

#Remove Primers cutadapt <- "C:/Users/User/AppData/Local/Programs/Python/Python310/Scripts/cutadapt.exe" # CHANGE ME to the cutadapt path on your machine system2(cutadapt, args = "--version") # Run shell commands from R

Result

cutadapt <- "C:/Users/User/AppData/Local/Programs/Python/Python310/Scripts/cutadapt.exe" # CHANGE ME to the cutadapt path on your machine system2(cutadapt, args = "--version") 3.6

Command #create output filenames for the cutadapt-ed files path.cut <- file.path(path, "cutadapt") if(!dir.exists(path.cut)) dir.create(path.cut) fnFs.cut <- file.path(path.cut, basename(fnFs)) fnRs.cut <- file.path(path.cut, basename(fnRs))

FWD.RC <- dada2:::rc(FWD) REV.RC <- dada2:::rc(REV)

As a sanity check, we will count the presence of primers in the first cutadapt-ed sample:

rbind(FWD.ForwardReads = sapply(FWD.orients, primerHits, fn = fnFs.cut[[1]]), FWD.ReverseReads = sapply(FWD.orients, primerHits, fn = fnRs.cut[[1]]), REV.ForwardReads = sapply(REV.orients, primerHits, fn = fnFs.cut[[1]]), REV.ReverseReads = sapply(REV.orients, primerHits, fn = fnRs.cut[[1]]))

Trim FWD and the reverse-complement of REV off of R1 (forward reads)

R1.flags <- paste("-g", FWD, "-a", REV.RC)

Trim REV and the reverse-complement of FWD off of R2 (reverse reads)

R2.flags <- paste("-G", REV, "-A", FWD.RC)

Run Cutadapt

for(i in seq_along(fnFs)) { system2(cutadapt, args = c(R1.flags, R2.flags, "-n", 2, # -n 2 required to remove FWD and REV from reads "-o", fnFs.cut[i], "-p", fnRs.cut[i], # output files fnFs.filtN[i], fnRs.filtN[i])) # input files }

#count the presence of primers in the first cutadapt-ed sample: rbind(FWD.ForwardReads = sapply(FWD.orients, primerHits, fn = fnFs.cut[[1]]), FWD.ReverseReads = sapply(FWD.orients, primerHits, fn = fnRs.cut[[1]]), REV.ForwardReads = sapply(REV.orients, primerHits, fn = fnFs.cut[[1]]), REV.ReverseReads = sapply(REV.orients, primerHits, fn = fnRs.cut[[1]])) Results path.cut <- file.path(path, "cutadapt")

if(!dir.exists(path.cut)) dir.create(path.cut) fnFs.cut <- file.path(path.cut, basename(fnFs)) fnRs.cut <- file.path(path.cut, basename(fnRs))

FWD.RC <- dada2:::rc(FWD) REV.RC <- dada2:::rc(REV) rbind(FWD.ForwardReads = sapply(FWD.orients, primerHits, fn = fnFs.cut[[1]]),

  •   FWD.ReverseReads = sapply(FWD.orients, primerHits, fn = fnRs.cut[[1]]), 
    
  •   REV.ForwardReads = sapply(REV.orients, primerHits, fn = fnFs.cut[[1]]), 
    
  •   REV.ReverseReads = sapply(REV.orients, primerHits, fn = fnRs.cut[[1]]))
    

Error in h(simpleError(msg, call)) : error in evaluating the argument 'subject' in selecting a method for function 'vcountPattern': error in evaluating the argument 'object' in selecting a method for function 'sread': Input/Output no input files found dirPath: C:/Users/User/Desktop/qiime2-ITS1/Demux ITS1&2/AMASI-ITS/cutadapt/101A_1_L001_R1_001.fastq.gz pattern: character(0) Called from: h(simpleError(msg, call)) Browse[1]> c

Can someone help with the error, please? Thank you

Bettyajibade avatar Jun 16 '22 21:06 Bettyajibade

What is the output of file.exists("C:/Users/User/Desktop/qiime2-ITS1/Demux ITS1&2/AMASI-ITS/cutadapt/101A_1_L001_R1_001.fastq.gz")?

The message above suggests that file doesn't exist.

benjjneb avatar Jun 20 '22 22:06 benjjneb

Hi Thanks for your help. The above command returned False. I went to the data folder where I have the forward and reverse files but the cutadapt file created was empty. I think the cutadapt folder created is empty (I do not know why).

What must I do?

Bettyajibade avatar Jun 20 '22 23:06 Bettyajibade

I would suggest trying to troubleshoot what is happening on just a subset of your data, maybe even one sample. I would try running through steps 1 by 1, and checking on outputs at each step.

For example, does the input file to cutadapt exist? Or is it lost at the cutadapt output step? Also, I would suggest removing all non-standard characters (e.g. &, spaces) from your file paths. Such characters are notorious for causing problems in command-line settings.

benjjneb avatar Jun 22 '22 15:06 benjjneb

Hi I did as you suggested, but I still experienced the same issue. The cutadapt folder was created but no input was found in it.

If I have to use the forward read alone, at what level should I join the tutorial? Kindly note that I am analysing an ITS 1&2 data.

Thanks for your help.

Betty

Bettyajibade avatar Jun 25 '22 21:06 Bettyajibade

If I have to use the forward read alone, at what level should I join the tutorial?

You can run the tutorial as is, just drop the merging step and the reverse-read parts. When making the sequence table, use makeSequenceTable(dadaFs), instead of the mergers object.

benjjneb avatar Jun 29 '22 21:06 benjjneb