BBMap randomreads.sh exact path to ref error: Could not find or load main class
1
0
Entering edit mode
5.9 years ago
Tawny ▴ 180

I am trying to create synthetic reads from a fasta reference using BBMap's randomreads. Using this command from within the BBMap /sh directory:

[cmp07 sh]$ java -ea -Xmx23g -cp /home/mina/tools/BBMap-master/current/align2/RandomReads3.java ref=/home/mina/reference-genomes/N1a1.fasta reads=1258301 length=301 overwrite=f seed=-1 snprate=0.001 maxq=40 midq=30 minq=10 overlap=50

Unfortunately this produces and error:

Error: Could not find or load main class ref=.home.mina.reference-genomes.N1a1.fasta

How do I provide the path to my reference fasta file? Is there something I am missing about how to use this tool? Why are the slashes being converted to dots in the file path in the error message?

BBMap Java • 4.3k views
ADD COMMENT
0
Entering edit mode

If you are not using this program on WIndows, I suggest that you just use randomreads.sh the wrapper script to run this.

ADD REPLY
0
Entering edit mode

@genomax I had tried running randomreads.sh as well using this command:

[cmp07 sh]$ ./randomreads.sh ref=/home/mina/reference-genomes/N1a1.fasta reads=1258301 length=301 overwrite=f seed=-1 length=301 overwrite=f seed=-1 snprate=0.001 maxq=40 midq=30 minq=10 overlap=50

Unfortunately that method give me this error message:

 Error: Could not find or load main class align2.RandomReads3

Which led me to believe that I needed to run it using the original version of the command I asked about.

ADD REPLY
0
Entering edit mode

Have you moved any of the folder contents after downloading BBMap suite?

ADD REPLY
0
Entering edit mode

No, I have not moved any of the folder contents. My first thought is to add the full path to the randomreads.sh script but after trying that still I get an error message. Any ideas on what I could do?

ADD REPLY
0
Entering edit mode

Are you running the latest BBMap version? I just tried your command with BBmap v. 38.22 and was able to get an output file. You seem to be missing out=file.fq.gz in your command line but that should not cause the error you see.

ADD REPLY
0
Entering edit mode

Very good point genomax. I realized I wasn't running the latest version. I downloaded version 38.32 and untarred/zipped the file. Now when running randomreads.sh I get a different error:

[cmp07 bbmap]$ ./randomreads.sh ref = /home/mina/reference-genomes/N1a1.fasta out=/home/mina/reference-genomes/N1a1_synth.fastq length = 171 reads = 1258301 overwrite = f seed = -1 snprate = 0.001 maxq = 40 midq = 30 minq = 10
java -ea -Xmx106951m -cp /home/mina/bbmap/current/ align2.RandomReads3 build=1 ref = /home/mina/reference-genomes/N1a1.fasta out=/home/mina/reference-genomes/N1a1_synth.fastq length = 171 reads = 1258301 overwrite = f seed = -1 snprate = 0.001 maxq = 40 midq = 30 minq = 10
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at shared.PreParser.<init>(PreParser.java:74)
        at shared.PreParser.<init>(PreParser.java:31)
        at align2.RandomReads3.main(RandomReads3.java:39)
ADD REPLY
0
Entering edit mode

Are you using 64-bit java on a 64-bit OS?

ADD REPLY
0
Entering edit mode
java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
ADD REPLY
0
Entering edit mode

I tried your command line with human genome on my machine (albeit with 10G of RAM) and I am able to get an output file without any issues.

Can you try (I assume you have 10G of free memory available):

./randomreads.sh -Xmx10g ref = /home/mina/reference-genomes/N1a1.fasta out=/home/mina/reference-genomes/N1a1_synth.fastq length = 171 reads = 1258301 overwrite = f seed = -1 snprate = 0.001 maxq = 40 midq = 30 minq = 10
ADD REPLY
0
Entering edit mode

I tried your change and still get this error:

[cmp07 bbmap]$ ./randomreads.sh -Xmx10g ref = /home/mina/reference-genomes/N1a1.fasta out= /home/mina/reference-genomes/N1a1-synth.fastq length = 171 reads = 1258301 overwrite = f seed = -1 snprate = 0.001 maxq = 40 midq = 30 minq = 10

java -ea -Xmx10g -cp /home/mina/tools/bbmap/current/ align2.RandomReads3 build=1 -Xmx10g ref = /home/mina/reference-genomes/N1a1.fasta out= /home/mina/reference-genomes/N1a1-synth.fastq length = 171 reads = 1258301 overwrite = f seed = -1 snprate = 0.001 maxq = 40 midq = 30 minq = 10

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at shared.PreParser.<init>(PreParser.java:74)
        at shared.PreParser.<init>(PreParser.java:31)
        at align2.RandomReads3.main(RandomReads3.java:39)
ADD REPLY
0
Entering edit mode

Is N1a1.fasta bigger or smaller than human genome?

ADD REPLY
0
Entering edit mode

N1a1.fastq is much smaller. It is a human mitochondrial genome so ~16.5K base pairs long.

ADD REPLY
0
Entering edit mode

Can you try reducing number of reads to 10000 and see if that works? Since the genome is so small bbmap may be running out sequence in trying to generate the number of reads you are asking of 171 bp length.

ADD REPLY
0
Entering edit mode

I tried reducing the number of reads to 10000 and unfortunately it gave me the same error message referencing the ArrayIndexOutOfBounds Exception.

ADD REPLY
0
Entering edit mode

Not sure what to tell you. I downloaded human mitochondrial genome (~17kb) and tried your original command as well as one for 10,000 reads and both worked without error.

ADD REPLY
0
Entering edit mode

in the github repo, there is no method called at line 39: https://github.com/BioInfoTools/BBMap/blob/master/current/align2/RandomReads3.java#L39 Are you sure you're using the latest version of BBMAP ?

ADD REPLY
0
Entering edit mode

I am using version 38.32 which I downloaded and untarred today. I downloaded this from https://sourceforge.net/projects/bbmap/ . If there is a different version I should be using, please let me know where to find it.

ADD REPLY
2
Entering edit mode
5.9 years ago
Tawny ▴ 180

I finally figured out the issue. I had a space before and or after the = signs in the command. When I removed all spaces around the = signs, the tool worked as expected.

I did download and install the latest version today which was 38.34.

Thank you to @genomax and @Pierre Lindenbaum for their efforts in troubleshooting this for me.

ADD COMMENT

Login before adding your answer.

Traffic: 2173 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