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

Refactor Reference so dict and fai file becomes accessable as a method

parent b8b1779f
......@@ -73,6 +73,15 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
def beforeGraph() {}
override def freezeFieldValues() {
this match {
case r:Reference =>
if (r.dictRequired) deps :+= r.referenceDict
if (r.faiRequired) deps :+= r.referenceFai
deps = deps.distinct
case _ =>
}
preProcessExecutable()
beforeGraph()
internalBeforeGraph()
......
......@@ -61,25 +61,25 @@ trait Reference extends Configurable {
}
/** When set override this on true the pipeline with raise an exception when fai index is not found */
protected def faiRequired = false
def faiRequired = false
/** When set override this on true the pipeline with raise an exception when dict index is not found */
protected def dictRequired = this.isInstanceOf[Summarizable] || this.isInstanceOf[SummaryQScript]
def dictRequired = this.isInstanceOf[Summarizable] || this.isInstanceOf[SummaryQScript]
/** Returns the dict file belonging to the fasta file */
def referenceDict = new File(referenceFasta().getAbsolutePath
.stripSuffix(".fa")
.stripSuffix(".fasta")
.stripSuffix(".fna") + ".dict")
/** Returns the fai file belonging to the fasta file */
def referenceFai = new File(referenceFasta().getAbsolutePath + ".fai")
/** Returns the fasta file */
def referenceFasta(): File = {
val file: File = config("reference_fasta")
if (config.contains("reference_fasta")) {
checkFasta(file)
val dict = new File(file.getAbsolutePath.stripSuffix(".fa").stripSuffix(".fasta").stripSuffix(".fna") + ".dict")
val fai = new File(file.getAbsolutePath + ".fai")
this match {
case c: BiopetCommandLineFunction => c.deps :::= dict :: fai :: Nil
case _ =>
}
} else {
if (config.contains("reference_fasta")) checkFasta(file)
else {
val defaults = ConfigUtils.mergeMaps(this.defaults, this.internalDefaults)
def getReferences(map: Map[String, Any]): Set[(String, String)] = (for (
......
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