Commit 7bea0e95 authored by Sander Bollen's avatar Sander Bollen
Browse files

manwe wrapper fixes

parent f632d128
package nl.lumc.sasc.biopet.pipelines.toucan
import java.io.File
import nl.lumc.sasc.biopet.extensions.manwe.{ ManweAnnotateVcf, ManweSamplesActivate, ManweSamplesImport }
import nl.lumc.sasc.biopet.utils.config.Configurable
......@@ -24,13 +26,39 @@ class ManweActivateAfterAnnotImport(root: Configurable,
override def beforeCmd: Unit = {
super.beforeCmd
if (imported.output.exists()) {
val reader = Source.fromFile(imported.output)
this.uri = reader.getLines().toList.head.split(' ').last
reader.close()
this.uri = getUri
}
def getUriFromFile(f: File): String = {
val r = if (f.exists()) {
val reader = Source.fromFile(f)
val it = reader.getLines()
if (it.isEmpty) {
throw new IllegalArgumentException("Empty manwe stderr file")
}
it.filter(_.contains("Added sample")).toList.head.split(" ").last
} else {
this.uri = ""
""
}
r
}
def getUri: String = {
val err: Option[File] = Some(imported.jobOutputFile)
uri = err match {
case None => ""
case Some(s) => s match {
case null => ""
case other => getUriFromFile(other)
}
case _ => ""
}
uri
}
override def subCommand = {
required("samples") + required("activate") + getUri
}
}
......@@ -22,13 +22,39 @@ class ManweDownloadAfterAnnotate(root: Configurable,
override def beforeCmd: Unit = {
super.beforeCmd
if (annotate.output.exists()) {
val reader = Source.fromFile(annotate.output)
this.uri = reader.getLines().toList.head.split(' ').last
reader.close()
this.uri = getUri
}
def getUriFromFile(f: File): String = {
val r = if (f.exists()) {
val reader = Source.fromFile(f)
val it = reader.getLines()
if (it.isEmpty) {
throw new IllegalArgumentException("Empty manwe stderr file")
}
it.filter(_.contains("Annotated VCF file")).toList.head.split(" ").last
} else {
this.uri = ""
""
}
r
}
def getUri: String = {
val err: Option[File] = Some(annotate.jobOutputFile)
uri = err match {
case None => ""
case Some(s) => s match {
case null => ""
case other => getUriFromFile(other)
}
case _ => ""
}
uri
}
override def subCommand = {
required("data-sources") + required("download") + getUri
}
}
Supports Markdown
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