marcelm / cutadapt

Cutadapt removes adapter sequences from sequencing reads
https://cutadapt.readthedocs.io
MIT License
502 stars 125 forks source link

cutadapt.exe error: You provided 3 input file names, but either one or two are expected. #721

Closed ImperialBV closed 9 months ago

ImperialBV commented 11 months ago

Hi - I am having some trouble with trimming the primers from the sequences (I am using foward reads only for the analysis). A previous similar "issue" I read unfortunately didn't help because I have already accounted for the " and /.

I have quoted and used / in the path name to account for the space between "Processing PC3" which I cannot change. I imagine the space there is the issue - would be grateful for your advice on how to rectify this.

path <- "C:/Users/Processing PC3/Desktop/ITS_FFPE2"
list.files(path)

cutadapt <- "C:/Users/Processing PC3/Downloads/cutadapt.exe" system2(cutadapt, args = "--version")

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

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

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

for(i in seq_along(fnFs)) { system2(cutadapt, args = c(R1.flags, "-o", fnFs.cut[i], fnFs.filtN[i])) }

The error message I get is:

This is cutadapt 4.0 with Python 3.9.12 Command line parameters: -g CTTGGTCATTTAGAGGAAGTAA -o C:/Users/Processing PC3/Desktop//ITS_FFPE2/cutadapt/DWE1NegLN_1.fastq.gz C:/Users/Processing PC3/Desktop//ITS_FFPE2/filtN/DWE1NegLN_1.fastq.gz Run "cutadapt --help" to see command-line options. See https://cutadapt.readthedocs.io/ for full documentation.

cutadapt.exe: error: You provided 3 input file names, but either one or two are expected. The file names were:

Thank you

marcelm commented 11 months ago

This is not really a question about Cutadapt, but about R. I don’t use R regularly, but you may be able to solve this problem by adding a call to shQuote. So instead of

system2(cutadapt, args = c(R1.flags, "-o", fnFs.cut[i], fnFs.filtN[i]))

try running this:

system2(cutadapt, args = shQuote(c(R1.flags, "-o", fnFs.cut[i], fnFs.filtN[i])))