Commit 02729a98 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixed filters

parent eb34a798
......@@ -36,8 +36,8 @@ class DownloadNcbiAssembly(val root: Configurable) extends ToolCommandFunction {
var nameHeader: Option[String] = None
var mustHaveOne: Map[String, String] = Map()
var mustNotHave: Map[String, String] = Map()
var mustHaveOne: List[String] = Nil
var mustNotHave: List[String] = Nil
override def defaultCoreMemory = 4.0
......@@ -46,7 +46,7 @@ class DownloadNcbiAssembly(val root: Configurable) extends ToolCommandFunction {
required("--report", outputReport) +
required("-o", output) +
optional("--nameHeader", nameHeader) +
repeat("--mustHaveOne", mustHaveOne.map(x => s"${x._1}=${x._2}")) +
repeat("--mustNotHave", mustNotHave.map(x => s"${x._1}=${x._2}"))
repeat("--mustHaveOne", mustHaveOne) +
repeat("--mustNotHave", mustNotHave)
}
......@@ -15,8 +15,8 @@ object DownloadNcbiAssembly extends ToolCommand {
outputFile: File = null,
reportFile: Option[File] = None,
contigNameHeader: Option[String] = None,
mustHaveOne: Map[String, String] = Map(),
mustNotHave: Map[String, String] = Map()) extends AbstractArgs
mustHaveOne: List[(String, String)] = List(),
mustNotHave: List[(String, String)] = List()) extends AbstractArgs
class OptParser extends AbstractOptParser {
opt[String]('a', "assembly id") required () valueName "<file>" action { (x, c) =>
......@@ -32,10 +32,10 @@ object DownloadNcbiAssembly extends ToolCommand {
c.copy(contigNameHeader = Some(x))
}
opt[(String, String)]("mustHaveOne") valueName "<string>" action { (x, c) =>
c.copy(mustHaveOne = c.mustHaveOne + (x._1 -> x._2))
c.copy(mustHaveOne = (x._1, x._2) :: c.mustHaveOne)
}
opt[(String, String)]("mustNotHave") valueName "<string>" action { (x, c) =>
c.copy(mustNotHave = c.mustNotHave + (x._1 -> x._2))
c.copy(mustNotHave = (x._1, x._2) :: c.mustNotHave)
}
}
......
......@@ -17,8 +17,8 @@ package nl.lumc.sasc.biopet.pipelines.generateindexes
import java.util
import nl.lumc.sasc.biopet.core.extensions.Md5sum
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.extensions.{ Cat, Curl, Zcat }
import nl.lumc.sasc.biopet.core.{BiopetQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.{Cat, Curl, Zcat}
import nl.lumc.sasc.biopet.extensions.tools.DownloadNcbiAssembly
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.config.Configurable
......@@ -61,14 +61,16 @@ class DownloadGenomes(val root: Configurable) extends QScript with BiopetQScript
val downloadAssembly = new DownloadNcbiAssembly(this)
downloadAssembly.assemblyId = assemblyID
downloadAssembly.output = fastaFile
downloadAssembly.outputReport = new File(genomeDir, s"$speciesName-$genomeName.assamble.report")
downloadAssembly.nameHeader = referenceConfig.get("ncbi_assembly_header_name").map(_.toString)
downloadAssembly.mustHaveOne = referenceConfig.get("ncbi_assembly_must_have_one")
.map(_.asInstanceOf[Map[String, String]])
.getOrElse(Map())
downloadAssembly.mustNotHave = referenceConfig.get("ncbi_assembly_must_not_have")
.map(_.asInstanceOf[Map[String, String]])
.getOrElse(Map())
downloadAssembly.outputReport = new File(genomeDir, s"$speciesName-$genomeName.assembly.report")
downloadAssembly.nameHeader = genomeConfig.get("ncbi_assembly_header_name").map(_.toString)
downloadAssembly.mustHaveOne = genomeConfig.get("ncbi_assembly_must_have_one")
.map(_.asInstanceOf[util.ArrayList[util.LinkedHashMap[String, String]]])
.getOrElse(new util.ArrayList()).flatMap(x => x.map(y => y._1 + "=" + y._2))
.toList
downloadAssembly.mustNotHave = genomeConfig.get("ncbi_assembly_must_not_have")
.map(_.asInstanceOf[util.ArrayList[util.LinkedHashMap[String, String]]])
.getOrElse(new util.ArrayList()).flatMap(x => x.map(y => y._1 + "=" + y._2))
.toList
add(downloadAssembly)
}
case _ => {
......
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