I am try to trim the reads using Trimmomatic 0.39. But I am encountering error saying command not found. I am invoking it using command:
java -jar Trimmomatic-0.39/trimmomatic-0.39.jar
After that I am getting:
Usage:
PE [-version] [-threads <threads>] [-phred33|-phred64] [-trimlog <trimLogFile>] [-summary <statsSummaryFile>] [-quiet] [-validatePairs] [-basein <inputBase> | <inputFile1> <inputFile2>] [-baseout <outputBase> | <outputFile1P> <outputFile1U> <outputFile2P> <outputFile2U>] <trimmer1>...
or:
SE [-version] [-threads <threads>] [-phred33|-phred64] [-trimlog <trimLogFile>] [-summary <statsSummaryFile>] [-quiet] <inputFile> <outputFile> <trimmer1>...
or:
-version
After the following command, I am getting the mentioned error:
trimmomatic PE threads 4 mycoplasma_pneumoniae_F_100K.fastq m ycoplasma_pneumoniae_R_100K.fastq./trimmomatic-out/mycoplasma_pneumoniae_F_paired_100K.fastq/trimmomatic-out/mycoplasm a_pneumoniae_F_unpaired_100K.fastq./trimmomatic-out/mycoplasma_pneumoniae_R_paired_100K.fastq./trimmomatic-out/mycoplas ma_pneumoniae_R_unpaired_100K.fastq ILLUMINACLIP: all_adapters.fa:2:30:10 LEADING:3 TRAILING: 3 SLIDINGWINDOW:4:20 CROP:240 HEADCROP:19 MINLEN:50
I am aware of anaconda/conda. But this method should also work.
I searched for executables and also defined the PATH. But still getting the same problem.
Any suggestion would be highly appreciated. Thanks!
1 answer
Trimmomatic is a Java program that needs to be run as described in the README on github https://github.com/usadellab/Trimmomatic
This is how java programs are run (java -jar ...).
That trimmomatic can be run - in some environments - by simply typing trimmomatic is because the conda packages contain a wrapper that conda places in your $PATH. If you just downloaded the the code from github, then you will not have an executable.
The simplest shell wrapper that would (mostly) accomplish is something like this is (call the file trimmomatic and make it executable):
#!/bin/sh
<path-to-java/>java -jar <path-to-trimmomatic/>Trimmomatic-0.39/trimmomatic-0.39.jar $@
replace <path-to-.../> with the full path to java and trimmomatic.
With this crude wrapper, you will also have to give the full path to the adapter files or trimmomatic will not find them.
The conda java wrapper is a python program that takes care of many more cases and also allows to set java VM args eg. -Xmx. If you need this functionality, install the program with conda/mamba/micromamba or if you cannot use conda for some reason, copy the code of the wrapper from a conda install.
As a side-note, I think there is now better trimming software that I would prefer for ease of use, e.g. fastp, Cutadapt, or BBduk
Log in to answer this question.
Do you get a valid directory path after running
which trimmomatic.If your
$PATHis correctly set then you should get theusageto print (as above) if you just runtrimmomatic. If you don't then your$PATHis not set right.You also need to make sure you have spaces in the correct delimiting positions and
-in front of options likethreadsand no space beteween:and filename below.which trimmomatic does not returns anything. But, whereis trimmomatic works. I am getting usage after calling trimmomatic (means I have set path correctly).
Even trimmomatic -version gives command not found error.
The zip from github does not contain any executable, just the
./trimmomatic-0.39.jarandadaptersdir. Compare the output:whereis java=>java: /path/to/java_executablevswhereis trimmomatic trimmomatic: (nothing here)So most likely there is no
trimmomaticcommand anywhere on your system, not just on your PATH unless you installed it not from the zip but from another source