Skip to content

Commit 7a52424

Browse files
committed
Make FastqcRunner more tolerant to HTSJDK version bumps
1 parent f7538d0 commit 7a52424

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/util/FastqcRunner.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ private List<String> getBaseParams() throws FileNotFoundException
368368
throw new RuntimeException("Not found: " + jbzip2.getPath());
369369
}
370370

371-
File htsjdkJar = new File(libDir, "htsjdk-4.0.0.jar");
371+
File htsjdkJar = findJar(libDir, "htsjdk-");
372372
if (!htsjdkJar.exists())
373373
{
374374
throw new RuntimeException("Not found: " + htsjdkJar.getPath());
@@ -403,6 +403,27 @@ private List<String> getBaseParams() throws FileNotFoundException
403403
return params;
404404
}
405405

406+
private File findJar(final File libDir, final String prefix)
407+
{
408+
if (!libDir.exists())
409+
{
410+
throw new RuntimeException("Missing directory: " + libDir);
411+
}
412+
413+
List<String> jarNames = Arrays.stream(libDir.list()).filter(fn -> fn.startsWith(prefix)).sorted().toList();
414+
if (jarNames.isEmpty())
415+
{
416+
throw new RuntimeException("Unable to find JAR with prefix: " + prefix);
417+
}
418+
419+
if (jarNames.size() > 1)
420+
{
421+
_logger.info("More than one JAR found with prefix: " + prefix);
422+
}
423+
424+
return new File(libDir, jarNames.get(jarNames.size() - 1));
425+
}
426+
406427
private int getThreads()
407428
{
408429
return _threads;

0 commit comments

Comments
 (0)