Trimmomatic 0.39 bash script error
1
0
Entering edit mode
3.9 years ago

Hello,

I hope someone can help me out with an error trying to run Trimmomatic from within a bash script

This is the script:

#!/bin/bash 
FORWARD=$1 
REVERSE=$2 
trimmomatic PE -threads 72 $FORWARD $REVERSE paired_forward.fastq.gz unpaired_forward.fastq.gz paired_reverse.fastq.gz unpaired_reverse.fastq.gz ILLUMINACLIP:/opt/trimmomatic/adapters/NexteraPE-PE.fa:2:30:10 SLIDINGWINDOW:4:15 MINLEN:36
(all in one line)

When trying to run:

bash trim_script.sh example_forward.fastq.gz example_reverse.fastq.gz

I get error:

TrimmomaticPE: Started with arguments:
 paired_forward.fastq.gz paired_forward.fastq.gz paired_reverse.fastq.gz unpaired_reverse.fastq.gz ILLUMINACLIP:/opt/trimmomatic/adapters/NexteraPE-PE.fa:2:30:10 SLIDINGWINDOW:4:15 MINLEN:36
Using PrefixPair: 'AGATGTGTATAAGAGACAG' and 'AGATGTGTATAAGAGACAG'
Using Long Clipping Sequence: 'GTCTCGTGGGCTCGGAGATGTGTATAAGAGACAG'
Using Long Clipping Sequence: 'TCGTCGGCAGCGTCAGATGTGTATAAGAGACAG'
Using Long Clipping Sequence: 'CTGTCTCTTATACACATCTCCGAGCCCACGAGAC'
Using Long Clipping Sequence: 'CTGTCTCTTATACACATCTGACGCTGCCGACGA'
ILLUMINACLIP: Using 1 prefix pairs, 4 forward/reverse sequences, 0 forward only sequences, 0 reverse only sequences
"xception in thread "main" java.lang.NumberFormatException: For input string: "36
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:580)
        at java.lang.Integer.parseInt(Integer.java:615)
        at org.usadellab.trimmomatic.trim.MinLenTrimmer.<init>(MinLenTrimmer.java:11)
        at org.usadellab.trimmomatic.trim.TrimmerFactory.makeTrimmer(TrimmerFactory.java:56)
        at org.usadellab.trimmomatic.Trimmomatic.createTrimmers(Trimmomatic.java:59)
        at org.usadellab.trimmomatic.TrimmomaticPE.run(TrimmomaticPE.java:536)
        at org.usadellab.trimmomatic.Trimmomatic.main(Trimmomatic.java:80)

There are no spaces or quotes in the MINLEN:36 step I have manually typed the line but I can't figure out why the error appears. Any help is much appreciated

EDIT: Corrected the repeated file.

trimmomatic bash scipt • 1.4k views
ADD COMMENT
0
Entering edit mode
3.9 years ago
GenoMax 141k

You have the same file name twice in the command paired_forward.fastq.gz paired_forward.fastq.gz try paired_forward.fastq.gz unpaired_forward.fastq.gz.

ADD COMMENT
0
Entering edit mode

After correcting the wrong file name and removing the MINLEN option the scripts gives the same output but this time it cannot find the example_forward.fastq.gz even though I am running the script from within the folder where the file is present.

ADD REPLY
0
Entering edit mode

it just means you mistyped the file name, or the file name is not what you think it is etc

if it is of any consultation trimmomatic has one of the most inefficient command-line interfaces of any tool (other than of the fruit salad called GATK)

ADD REPLY
0
Entering edit mode

The funny thing is that if I copy and paste the same command to the command line directly, it runs successfully.

ADD REPLY
0
Entering edit mode

I suggest you try bbduk.sh from BBMap suite for your scan/trim needs. A guide is available here. Simple to understand options easy to use and multi-threaded.

ADD REPLY

Login before adding your answer.

Traffic: 1997 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6