This is a test version of Biostars. For the public version, visit https://www.biostars.org.
error when running bbduk

Hi there,

I'm trying to run bbduk in order to remove adapters from my fastq files:

bbduk.sh in=R1_001.fastq.gz  out=clean_1.fastq.gz ktrim=r k=21 path=adapters.fa

But I've got this error:

/usr/bin/bbduk.sh: line 344: /usr/share/bbmap/calcmem: No such file or directory
/usr/bin/bbduk.sh: line 345: setEnvironment: command not found
/usr/bin/bbduk.sh: line 346: parseXmx: command not found
/usr/bin/bbduk.sh: line 350: freeRam: command not found
java -Xmxm -Xmsm -cp /usr/share/java/bbmap.jar jgi.BBDuk in=1_S1_L001_R1_001.fastq.gz out=clean_1_1.fastq.gz ktrim=r k=21 path=adapters.fa
Invalid maximum heap size: -Xmxm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

PS:

java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Any idea whats wrong?

Thank you!

bbduk

of course I've tried but it doesn't work :/

How did you install bbduk e.g. via conda? It sounds like an installation issue as pointed out in the previous post.

I think there is a problem with the BBMap package installation. Can you double check that?

eg. it should not say : "/usr/share/bbmap/calcmem: No such file or directory" .

Can you run other tools from the package? Is bbduk the only one failing?

if I run it without any parameter eg

bbduk.sh
Written by Brian Bushnell
Last modified November 7, 2019

Description:  Compares reads to the kmers in a reference dataset, optionally 
allowing an edit distance. Splits the reads into two outputs - those that 
match the reference, and those that don't. Can also trim (remove) the matching 
parts of the reads rather than binning the reads.
Please read bbmap/docs/guides/BBDukGuide.txt for more information.

Usage:  bbduk.sh in=<input file> out=<output file> ref=<contaminant files> .....

I've got the usage and the options and everything, to it seems the package is correctly installed, isn't it?

yes, that's on thing already indeed.

Can you then check why it complains on the line I posted above (the calcmem program) ? Is it there?

yes it is, in the same directory too

You have not answered the question "how did you install bbmap suite"? We need to know that to diagnose this properly.

You can also explicitly set the memory and try running as

bbduk.sh -Xmx4g in=R1_001.fastq.gz  out=clean_1.fastq.gz ktrim=r k=21 ref=adapters.fa

yes sorry, what I did was:

  • Download BBTools from Sourceforge
  • tar -xvzf BBMap_(version).tar.gz
  • run the bash file

GenoMax , I've run the code as you suggested and it fails too :/

1 answer

You need to make sure that the directory containing bbmap scripts is in your $PATH. So try

export PATH=$PATH:/path_to_dir_with_bbmap_scripts

and see if that fixes the problem. You can then amend your $PATH permanently via your .bashrc or profile file.

It worked! but still have a warning and error:

Initial:
Memory: max=4294m, total=4294m, free=4266m, used=28m

******  WARNING! A KMER OPERATION WAS CHOSEN BUT NO KMERS WERE LOADED.  ******
******  YOU NEED TO SPECIFY A REFERENCE FILE OR LITERAL SEQUENCE.       ******

Exception in thread "main" java.lang.AssertionError: You can bypass this assertion with the -da flag.
    at jgi.BBDuk.process2(BBDuk.java:1178)
    at jgi.BBDuk.process(BBDuk.java:1082)
    at jgi.BBDuk.main(BBDuk.java:81)

That is because you are using an incorrect option. path= is used when you have a pre-built BBMap index available. You should use ref= when you are starting with a fasta file. So try this:

bbduk.sh -Xmx4g in=R1_001.fastq.gz  out=clean_1.fastq.gz ktrim=r k=21 ref=adapters.fa

my bad, it works now! Thank you and sorry for making loose your time with this silly questions!

Log in to answer this question.