Question: BBMap randomreads.sh exact path to ref error: Could not find or load main class
0
gravatar for Tawny
4 weeks ago by
Tawny130
United States
Tawny130 wrote:

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 • 194 views
ADD COMMENTlink modified 14 days ago • written 4 weeks ago by Tawny130

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

ADD REPLYlink written 4 weeks ago by genomax60k

@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 REPLYlink written 4 weeks ago by Tawny130

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

ADD REPLYlink written 4 weeks ago by genomax60k

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 REPLYlink written 4 weeks ago by Tawny130

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 REPLYlink written 4 weeks ago by genomax60k

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 REPLYlink written 4 weeks ago by Tawny130

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

ADD REPLYlink modified 4 weeks ago • written 4 weeks ago by genomax60k
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 REPLYlink written 4 weeks ago by Tawny130

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 REPLYlink written 4 weeks ago by genomax60k

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 REPLYlink written 4 weeks ago by Tawny130

Is N1a1.fasta bigger or smaller than human genome?

ADD REPLYlink written 4 weeks ago by genomax60k

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

ADD REPLYlink written 4 weeks ago by Tawny130

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 REPLYlink modified 4 weeks ago • written 4 weeks ago by genomax60k

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

ADD REPLYlink written 4 weeks ago by Tawny130

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 REPLYlink written 4 weeks ago by genomax60k

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 REPLYlink written 4 weeks ago by Pierre Lindenbaum116k

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 REPLYlink written 4 weeks ago by Tawny130
0
gravatar for Tawny
14 days ago by
Tawny130
United States
Tawny130 wrote:

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 COMMENTlink written 14 days ago by Tawny130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1184 users visited in the last hour