Commit e653337b authored by bow's avatar bow
Browse files

Fix bug in JAR run caused by copying entire resource folder

parent c0064f43
......@@ -22,20 +22,28 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
class TopHat(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "FastQ file R1", shortName = "R1")
var R1: File = _
@Input(doc = "FastQ file R2", shortName = "R2", required = false)
var R2: File = _
@Input(doc = "FastQ file(s) R1", shortName = "R1")
var R1: List[File] = List.empty[File]
@Input(doc = "Bowtie index", shortName = "bti")
var bowtie_index: File = config("bowtie_index")
@Input(doc = "FastQ file(s) R2", shortName = "R2", required = false)
var R2: List[File] = List.empty[File]
@Argument(doc = "Output Directory")
var outputDir: String = _
/** output files, computed automatically from output directory */
@Output(doc = "Output file SAM", shortName = "output")
var output: File = _
@Output(doc = "Output SAM/BAM file")
lazy val outputGtf: File = {
require(R1.nonEmpty && output_dir != null,
"Read 1 input(s) are defined and output directory is defined")
// cufflinks always outputs a transcripts.gtf file in the output directory
new File(output_dir, "accepted_hits.bam")
}
@Argument(doc = "Bowtie index", shortName = "bti", required = true)
var bowtie_index: String = config("bowtie_index")
/** write all output files to this directory [./] */
var output_dir: File = config("output_dir", default = new File("tophat_out"))
// options set via API or config
// var numrecords: String = config("numrecords", default = "all")
......@@ -56,25 +64,18 @@ class TopHat(val root: Configurable) extends BiopetCommandLineFunction {
// var logfile: String = config("logfile")
executable = config("exe", default = "tophat", freeVar = false)
override val versionRegex = """TopHat v(.*)""".r
override val versionExitcode = List(0, 1)
override def versionCommand = executable + " --version"
override val defaultVmem = "4G"
override val defaultThreads = 8
override def versionCommand = executable + " --version"
override def beforeGraph() {
if (!outputDir.endsWith("/")) outputDir += "/"
output = new File(outputDir + "accepted_hits.bam")
}
//override def beforeGraph = {}
def cmdLine: String = {
var cmd: String = required(executable) +
optional("-p", nCoresRequest) +
"--no-convert-bam" +
required(bowtie_index) +
required(R1) + optional(R2)
return cmd
}
def cmdLine: String = required(executable) +
required(bowtie_index) +
required(R1.mkString(",")) +
optional(R2.mkString(","))
}
......@@ -6,9 +6,9 @@
package nl.lumc.sasc.biopet.pipelines.gentrap.scripts
import java.io.File
import java.io.{ File, FileOutputStream }
import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import nl.lumc.sasc.biopet.core.config.Configurable
......@@ -19,10 +19,6 @@ import nl.lumc.sasc.biopet.extensions.PythonCommandLineFunction
*/
class PdfReportTemplateWriter(val root: Configurable) extends PythonCommandLineFunction {
val templateResDir: File = new File(getClass.getResource("/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf").toURI)
val templateWorkDir: File = new File(".queue/tmp/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf")
val imgWorkDir: File = new File(templateWorkDir, "img")
@Input(doc = "Input summary file", required = true)
var summaryFile: File = null
......@@ -30,13 +26,34 @@ class PdfReportTemplateWriter(val root: Configurable) extends PythonCommandLineF
def mainTemplateFile: File = new File(templateWorkDir, "main.tex")
@Input(doc = "Main report logo", required = true) // def since we hard-code the logo
def logoFile: File = new File(imgWorkDir, "gentrap_front.png")
def logoFile: File = new File(templateWorkDir, "gentrap_front.png")
@Output(doc = "Output file", required = true)
var output: File = null
protected def prepTemplate(): Unit = {
FileUtils.copyDirectory(templateResDir, templateWorkDir)
val templateWorkDir: File = new File(".queue/tmp/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf")
val templateFiles: Seq[String] = Seq(
"main.tex", "gentrap_front.png",
"sample.tex", "sample_mapping.tex",
"lib.tex", "lib_seqeval.tex", "lib_mapping.tex"
)
protected def prepTemplate(name: String,
subPackage: String = "/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf"): Unit = {
val target = new File(".queue/tmp" + subPackage, name)
if (!target.getParentFile.exists) target.getParentFile.mkdirs()
val is = getClass.getResourceAsStream(subPackage + "/" + name)
val os = new FileOutputStream(target)
org.apache.commons.io.IOUtils.copy(is, os)
os.close()
//python_script_name = script
//python_script = new File(".queue/tmp/" + subpackage + python_script_name)
//if (!python_script.getParentFile.exists) python_script.getParentFile.mkdirs
//val is = getClass.getResourceAsStream(subpackage + python_script_name)
//val os = new FileOutputStream(python_script)
//org.apache.commons.io.IOUtils.copy(is, os)
//os.close()
}
def cmdLine = {
......@@ -48,5 +65,5 @@ class PdfReportTemplateWriter(val root: Configurable) extends PythonCommandLineF
}
setPythonScript("pdf_report.py")
prepTemplate()
templateFiles.foreach(t => prepTemplate(t))
}
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