This is a test version of Biostars. For the public version, visit https://www.biostars.org.
picard tools installation problems

Hello,

I have been trying to run this command on my own desktop pc, a command that I have run in my old server (where everything was already installed) and I am massively struggling with debugging the errors that keep popping every time I try to run anything.

I am simply trying to run CollectHsMetrics on just one sample to see if it works, and the idea is that I'd run it on the rest of my samples using a loop once it works, but I am failing to get it done.

The command (that runs perfectly fine on the server) is the following:

PicardCommandLine CollectHsMetrics I=PN0193.bam BAIT_INTERVALS=target.intervals_list TARGET_INTERVALS=target.intervals_list OUTPUT=output.txt REFERENCE_SEQUENCE=genome.fa

I have, on the same directory - just for ease of use - all the following files:

  • .bam file and .bai file
  • the target.intervals_list file that I am using for both BAIT and TARGET
  • the reference genome and the index, created with samtools faidx

In my own pc, however, the same command returns, after processing all the reads (I cut it a bit for easiness of use)

INFO    2022-04-29 00:34:08     CollectHsMetrics        Processed    33,000,000 records.  Elapsed time: 00:03:23s.  Time for last 1,000,000:    5s.  Last read position: MT:14,619
[Fri Apr 29 00:34:10 IST 2022] picard.analysis.directed.CollectHsMetrics done. Elapsed time: 3.81 minutes.
Runtime.totalMemory()=3386900480
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/math3/random/RandomGenerator
        at picard.analysis.directed.TargetMetricsCollector$PerUnitTargetMetricCollector.calculateTheoreticalHetSensitivity(TargetMetricsCollector.java:732)
        at picard.analysis.directed.TargetMetricsCollector$PerUnitTargetMetricCollector.finish(TargetMetricsCollector.java:629)
        at picard.metrics.MultiLevelCollector$AllReadsDistributor.finish(MultiLevelCollector.java:208)
        at picard.metrics.MultiLevelCollector.finish(MultiLevelCollector.java:324)
        at picard.analysis.directed.CollectTargetedMetrics.doWork(CollectTargetedMetrics.java:159)
        at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:295)
        at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
        at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.math3.random.RandomGenerator
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 8 more

I am begging if someone has any idea or can help me, please answer this post, because I am resourceless right now.

picard-tools collecthsmetrics

1 answer

this PicardCommandLine is not part of the official release of picard. the 'jar archive' of picard picard;jar should be downloaded from https://github.com/broadinstitute/picard/releases and invoked like:

java -jar picard.jar CollectHsMetrics (...)

Athough I still don't understand why it worked in one computer and didn't on another, this solution worked and I have managed to sort my problem. Many thanks!!!

Log in to answer this question.