Commit 92b003d5 authored by bow's avatar bow
Browse files

Wrap Picard dependency list fetch in Option

parent c6e433e2
...@@ -82,25 +82,29 @@ abstract class Picard extends BiopetJavaCommandLineFunction { ...@@ -82,25 +82,29 @@ abstract class Picard extends BiopetJavaCommandLineFunction {
object Picard extends Logging { object Picard extends Logging {
lazy val getBiopetPicardVersion: Option[String] = { lazy val getBiopetPicardVersion: Option[String] = {
val reader = Source.fromInputStream(getClass.getResourceAsStream("/dependency_list.txt")) Option(getClass.getResourceAsStream("/dependency_list.txt")) match {
val dependencies = reader.getLines().map(_.trim.split(":")).filter(_.size == 5).map(line => Map( case Some(src) =>
"groupId" -> line(0), val dependencies = Source.fromInputStream(src)
"artifactId" -> line(1), .getLines().map(_.trim.split(":")).filter(_.size == 5).map(line => Map(
"type" -> line(2), "groupId" -> line(0),
"version" -> line(3), "artifactId" -> line(1),
"scope" -> line(4) "type" -> line(2),
)).toList "version" -> line(3),
"scope" -> line(4)
logger.debug("dependencies: " + dependencies) )).toList
val htsjdk = dependencies.find(dep => dep("groupId") == "samtools" && dep("artifactId") == "htsjdk").collect { logger.debug("dependencies: " + dependencies)
case dep =>
"samtools htsjdk " + dep("version") val htsjdk = dependencies.find(dep => dep("groupId") == "samtools" && dep("artifactId") == "htsjdk").collect {
} case dep =>
"samtools htsjdk " + dep("version")
}
dependencies.find(dep => dep("groupId") == "picard" && dep("artifactId") == "picard").collect { dependencies.find(dep => dep("groupId") == "picard" && dep("artifactId") == "picard").collect {
case dep => case dep =>
"Picard " + dep("version") + " using " + htsjdk.getOrElse("unknown htsjdk") "Picard " + dep("version") + " using " + htsjdk.getOrElse("unknown htsjdk")
}
case otherwise => None
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment