Commit 2f0da996 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added basic trait for basis of all pipeline templates

parent f8464310
package nl.lumc.sasc.biopet.core
import nl.lumc.sasc.biopet.utils.{ Question, ToolCommand }
* Created by pjvanthof on 17/12/2016.
trait TemplateTool extends ToolCommand {
import TemplateTool._
case class Args(expert: Boolean = false) extends AbstractArgs
class OptParser extends AbstractOptParser {
opt[Unit]("expert") valueName "<file>" action { (x, c) =>
c.copy(expert = true)
} text "Path to input file"
* Program will split fastq file in multiple fastq files
* @param args the command line arguments
def main(args: Array[String]): Unit = {
val argsParser = new OptParser
val cmdArgs: Args = argsParser.parse(args, Args()) getOrElse (throw new IllegalArgumentException)
val standard: Map[String, Any] = Map("output_dir" -> Question.askValue("Output directory", validation = List(isAbsolutePath, parentIsWritable)))
def pipelineMap(map: Map[String, Any], expert: Boolean): Map[String, Any]
object TemplateTool {
def isAbsolutePath(value: String): Boolean = {
if (new File(value).isAbsolute) true else {
println(s"'$value' must be a absulute path")
def mustExist(value: String): Boolean = {
if (new File(value).exists()) true else {
println(s"'$value' does not exist")
def parentIsWritable(value: String): Boolean = {
val parent = new File(value).getParentFile
if (!parent.exists()) {
println(s"$parent does not exist")
} else if (!parent.canRead) {
println(s"No premision to read $parent")
} else if (!parent.canWrite) {
println(s"No premision to write $parent")
} else true
\ No newline at end of file
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