Plugin error from cutadapt returned non-zero exit status 2

Hello

I'm trying to use cutadapt to trim my samples, however it gives me an error

trying to run:

qiime cutadapt trim-paired
--i-demultiplexed-sequences paired-end-demux.qza
--p-adapter-f CCTACGGGNGGCWGCAG
--p-adapter-r GACTACHVGGGTATCTAATCC \
--o-trimmed-sequences Trimmed.qza
--verbose 

verbose gives me the following:

Running external command line application. This may print messages to stdout and/or stderr.
The commands to be run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: cutadapt --cores 1 --error-rate 0.1 --times 1 --overlap 3 --minimum-length 1 -o /tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_9_L001_R1_001.fastq.gz -p /tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_21_L001_R2_001.fastq.gz --adapter CCTACGGGNGGCWGCAG -A GACTACHVGGGTATCTAATCC -A   /tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_9_L001_R1_001.fastq.gz /tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_21_L001_R2_001.fastq.gz

This is cutadapt 4.0 with Python 3.8.13
Command line parameters: --cores 1 --error-rate 0.1 --times 1 --overlap 3 --minimum-length 1 -o /tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_9_L001_R1_001.fastq.gz -p /tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_21_L001_R2_001.fastq.gz --adapter CCTACGGGNGGCWGCAG -A GACTACHVGGGTATCTAATCC -A   /tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_9_L001_R1_001.fastq.gz /tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_21_L001_R2_001.fastq.gz
Run "cutadapt --help" to see command-line options.
See https://cutadapt.readthedocs.io/ for full documentation.

cutadapt: error: Adapter sequence is empty
Traceback (most recent call last):
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2cli/commands.py", line 339, in __call__
    results = action(**arguments)
  File "<decorator-gen-249>", line 2, in trim_paired
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    outputs = self._callable_executor_(scope, callable_args,
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 391, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_cutadapt/_trim.py", line 189, in trim_paired
    run_commands(cmds)
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_cutadapt/_trim.py", line 30, in run_commands
    subprocess.run(cmd, check=True)
  File "/home/vgirelli/miniconda3/envs/qiime2-2022.2/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cutadapt', '--cores', '1', '--error-rate', '0.1', '--times', '1', '--overlap', '3', '--minimum-length', '1', '-o', '/tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_9_L001_R1_001.fastq.gz', '-p', '/tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_21_L001_R2_001.fastq.gz', '--adapter', 'CCTACGGGNGGCWGCAG', '-A', 'GACTACHVGGGTATCTAATCC', '-A', ' ', '/tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_9_L001_R1_001.fastq.gz', '/tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_21_L001_R2_001.fastq.gz']' returned non-zero exit status 2.

Plugin error from cutadapt:

  Command '['cutadapt', '--cores', '1', '--error-rate', '0.1', '--times', '1', '--overlap', '3', '--minimum-length', '1', '-o', '/tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_9_L001_R1_001.fastq.gz', '-p', '/tmp/q2-CasavaOneEightSingleLanePerSampleDirFmt-s31g0mlz/SRR18253047_21_L001_R2_001.fastq.gz', '--adapter', 'CCTACGGGNGGCWGCAG', '-A', 'GACTACHVGGGTATCTAATCC', '-A', ' ', '/tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_9_L001_R1_001.fastq.gz', '/tmp/qiime2-archive-ikikjz6i/6c6e0b15-5471-4274-a339-ac7dfbaa2499/data/SRR18253047_21_L001_R2_001.fastq.gz']' returned non-zero exit status 2.

See above for debug info.

Any idea on what's causing it? I've looked a bit on the forum but similar errors seem to be issues fixed in newer versions

Hi @vgirelli,

Thanks for reaching out! :qiime2:

It looks like this is the source of the error:

Looking through the traceback, it does seem like cutadapt is picking up the primer sequence you've included in your command:

A couple of things that I'm wondering about:

  1. What version of QIIME 2 are you running, what machine are you running it on, and how was it installed (virtual machine, direct conda install, etc)?

  2. Are there any trailing white spaces in either of your primer sequences for --p-adapter-f and --p-adapter-r? I'd try re-running and very carefully adding in your primer sequence for forward and reverse reads to ensure that isn't what's causing the problem here.

Another thing that could be the source of the issue - have you confirmed that the primer sequences you've included are actually at the 3' end of your forward and reverse reads (vs. the 5' end)? Since you've chosen --p-adapter-r and --p-adapter-f this will only look for the primer sequence provided at the 3' end of your reads. If you are unsure of which side your primers are ligated to your reads, I'd recommend using --p-anywhere-r and --p-anywhere-f which will check for the primer sequence on both the 3' and 5' end.

Cheers :lizard:

thank you very much for the answer! it seems my problem was that there was an empty space after my sequences :sweat_smile:

thanks a lot and have a nice day

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.