Kneaddata installed with conda is not available

hi! I used conda to install KneadData, but it didn’t work. The error message appears to be related to Trimmomatic. I’ve left the necessary code below. Thank you.

(kneaddata) t010208@bio3-Horsea-12U:~/Chengtao/meta/test$     kneaddata -i1 seq/C1_1.fq.gz -i2 seq/C1_2.fq.gz \
>       -o temp/qc -v -t 20 --remove-intermediate-output \
>       --trimmomatic ${soft}/envs/kneaddata/share/trimmomatic/ \
>       --trimmomatic-options "ILLUMINACLIP:${soft}/envs/kneaddata/share/trimmomatic/adapters/TruSeq2-PE.fa:2:40:15 SLIDINGWINDOW:4:20 MINLEN:50" \
>       --reorder --bowtie2-options "--very-sensitive --dovetail" \
>       -db ${db}/kneaddata/human_genome/hg37dec_v0.1
Decompressing gzipped file ...

Decompressing gzipped file ...

Reformatting file sequence identifiers ...

Reformatting file sequence identifiers ...

Initial number of reads ( /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers556tnqui_decompressed_rg4eb61__C1_1 ): 75000.0
Initial number of reads ( /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers1l3tuc73_decompressed_0kz7yoj5_C1_2 ): 75000.0
Running Trimmomatic ... 

java -Xmx500m -jar /home/data/t010208/miniconda3/envs/kneaddata/share/trimmomatic/trimmomatic PE -threads 20 -phred33 /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers556tnqui_decompressed_rg4eb61__C1_1 /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers1l3tuc73_decompressed_0kz7yoj5_C1_2 /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.1.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.single.1.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.2.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.single.2.fastq ILLUMINACLIP:/home/data/t010208/miniconda3/envs/kneaddata/share/trimmomatic/adapters/TruSeq2-PE.fa:2:40:15 SLIDINGWINDOW:4:20 MINLEN:50

CRITICAL ERROR: Error executing: java -Xmx500m -jar /home/data/t010208/miniconda3/envs/kneaddata/share/trimmomatic/trimmomatic PE -threads 20 -phred33 /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers556tnqui_decompressed_rg4eb61__C1_1 /home/data/t010208/Chengtao/meta/test/temp/qc/reformatted_identifiers1l3tuc73_decompressed_0kz7yoj5_C1_2 /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.1.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.single.1.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.2.fastq /home/data/t010208/Chengtao/meta/test/temp/qc/C1_1_kneaddata.trimmed.single.2.fastq ILLUMINACLIP:/home/data/t010208/miniconda3/envs/kneaddata/share/trimmomatic/adapters/TruSeq2-PE.fa:2:40:15 SLIDINGWINDOW:4:20 MINLEN:50

Error message returned from Trimmomatic :
Error: Invalid or corrupt jarfile /home/data/t010208/miniconda3/envs/kneaddata/share/trimmomatic/trimmomatic

(kneaddata) t010208@bio3-Horsea-12U:~$ kneaddata --version
kneaddata v0.12.0
(kneaddata) t010208@bio3-Horsea-12U:~$ conda list
# packages in environment at /home/data/t010208/miniconda3/envs/kneaddata:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bowtie2                   2.4.5           py310h8d7afc0_4    bioconda
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.9.24            ha878542_0    conda-forge
curl                      7.83.1               h2283fc2_0    conda-forge
expat                     2.4.9                h27087fc_0    conda-forge
fastqc                    0.11.9               hdfd78af_1    bioconda
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
fontconfig                2.14.0               hc2a2eb6_1    conda-forge
freetype                  2.12.1               hca18f0e_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kneaddata                 0.12.0             pyhdfd78af_0    bioconda
krb5                      1.19.3               h08a2579_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libcurl                   7.83.1               h2283fc2_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libnghttp2                1.47.0               hff17c54_1    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libpng                    1.6.38               h753d276_0    conda-forge
libsqlite                 3.39.3               h753d276_0    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libzlib                   1.2.12               h166bdaf_3    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
openjdk                   8.0.332              h166bdaf_0    conda-forge
openssl                   3.0.5                h166bdaf_2    conda-forge
perl                      5.32.1          2_h7f98852_perl5    conda-forge
pip                       22.2.2             pyhd8ed1ab_0    conda-forge
python                    3.10.6          ha86cf86_0_cpython    conda-forge
python_abi                3.10                    2_cp310    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
samtools                  1.6                  h3f2fef4_8    bioconda
setuptools                65.4.0             pyhd8ed1ab_0    conda-forge
tbb                       2021.6.0             h924138e_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
trf                       4.09.1               hec16e2b_2    bioconda
trimmomatic               0.39                 hdfd78af_2    bioconda
tzdata                    2022d                h191b570_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zlib                      1.2.12               h166bdaf_3    conda-forge
zstd                      1.5.2                h6239696_4    conda-forge

try edit [trimmomatic_jar=“trimmomatic*” to “trimmomatic.jar”] in python script [~/miniconda3/envs/kneaddata/lib/python3.7/site-packages/kneaddata/config.py]

1 Like

I have the same issue as Roy_Cheng mentioned. I tried edit the [trimmomatic_jar=“trimmomatic*” to “trimmomatic.jar”] in the “config.py”. However, it still doesn’t work. Any ideas? Thanks

This was a weird one. Here is a solution:

mkdir trim_tools
cp -r ~/miniconda3/envs/$MYENV/share/trimmomatic/adapters trim_tools/
cp ~/miniconda3/envs/$MYENV/share/trimmomatic/trimmomatic.jar trim_tools/

Replace $MYENV with the name of your conda environment.

Then, include the argument --trimmomatic $PWD/trim_tools every time you run the kneaddata command. ($PWD is obviously a stand in for the full path of wherever you made the trim_tools directory)

I’ve come across this error as well. It is due to a conflict between the biobakery workflows and the conda install. If you look at the file $MYENV/bin/trimmomatic you can see it is just a plain text wrapper for a java file. The first comment is “Wrapper script for Java Conda packages that ensures that the java runtime”

However, biobakery_workflows is trying to call this plain text file as the jar file, visible in the error message Err: CRITICAL ERROR: Error executing: java -Xmx500m -jar $MYENV/bin/trimmomatic SE -threads 1 ...

I found the jar file that the wrapper script is calling, and replaced the wrapper script with it. First I backed up the wrapper script so it can still be used with the command “trimmomatic_cmdline”

cp $MYENV/bin/trimmomatic $MYENV/bin/trimmomatic_cmdline
ln -s $MYENV/share/trimmomatic/trimmomatic.jar $MYENV/bin/trimmomatic
ln -s $MYENV/share/trimmomatic/trimmomatic.jar $MYENV/bin/trimmomatic.jar

Then, you can use the tools as normal, and use trimmomatic_cmdline if needed.
$MYENV should be replaced with the path to your conda environment.

1 Like

This is great, Ben. Thanks for sharing. I had to modify your first line to make this work:

mv $MYENV/bin/trimmomatic $MYENV/bin/cmdline_trimmomatic
  • I changed cp to mv so that ln didn’t complain about the destination already existing
  • Having the file trimmomatic_cmdline still caused an error:
Error: Invalid or corrupt jarfile /home/litichev/mambaforge/envs/humann3/bin/trimmomatic_cmdline

But renaming the file to cmdline_trimmomatic fixed this.

Ok, here is the shortest path to getting it working:

conda activate kneaddata
cd $CONDA_PREFIX/bin
ln -s ../share/trimmomatic/trimmomatic.jar .
sed -i 's/trimmomatic_jar="trimmomatic\*"/trimmomatic_jar="trimmomatic.jar"/' ../lib/python3.10/site-p
ackages/kneaddata/config.py
python ../lib/python3.10/site-packages/kneaddata/config.py

Then you should be good to go. You can still run trimmomatic standalone as well.

1 Like

it works, one nice solution! niubi!