Skip to content
Snippets Groups Projects
Commit 8d195010 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Small changes on config setup

parent b0317762
No related branches found
No related tags found
No related merge requests found
Showing
with 96 additions and 135 deletions
......@@ -15,7 +15,10 @@ class Config(private var map: Map[String,Any]) extends Logging {
var globalFile: String = System.getenv("QUEUE_CONFIG")
if (globalFile != null) {
var file: File = new File(globalFile)
if (file.exists()) loadConfigFile(file)
if (file.exists()) {
logger.info("Loading config file: " + file)
loadConfigFile(file)
}
else logger.warn("QUEUE_CONFIG value found but file does not exist, no glogal config is loaded")
} else logger.warn("QUEUE_CONFIG value not found, no glogal config is loaded")
}
......
......@@ -10,27 +10,25 @@ class Bwa(val globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "bwa"
val config: Config = globalConfig.getAsConfig("bwa")
logger.debug("Config for " + this.analysisName + ": " + config)
@Argument(doc="Bwa executeble", shortName="bwa_exe", required=false) var bwa_exe: String = _
@Input(doc="The reference file for the bam files.", shortName="R") var referenceFile: File = _
@Argument(doc="Bwa executeble", shortName="bwa_exe", required=false) var bwa_exe: String = config.getAsString("exe", "/usr/local/bin/bwa")
@Input(doc="The reference file for the bam files.", shortName="R") var referenceFile: File = new File(config.getAsString("referenceFile"))
@Input(doc="Fastq file R1", shortName="R1") var R1: File = _
@Input(doc="Fastq file R2", shortName="R2", required=false) var R2: File = _
@Output(doc="Output file SAM", shortName="output") var output: File = _
@Argument(doc="Readgroup header", shortName="RG", required=false) var RG: String = _
@Argument(doc="M", shortName="M", required=false) var M: Boolean = false
@Argument(doc="M", shortName="M", required=false) var M: Boolean = config.getAsBoolean("M", true)
jobResourceRequests :+= "h_vmem=" + config.getAsString("vmem", "6G")
var threads: Int = config.getAsInt("threads", 8)
var maxThreads: Int = config.getAsInt("maxthreads", 24)
if (threads > maxThreads) threads = maxThreads
nCoresRequest = Option(threads)
def init() {
bwa_exe = config.getAsString("exe", "/usr/local/bin/bwa")
M = config.getAsBoolean("M", true)
jobResourceRequests :+= "h_vmem=" + config.getAsString("vmem", "6G")
var threads: Int = config.getAsInt("threads", 8)
var maxThreads: Int = config.getAsInt("maxthreads", 24)
if (threads > maxThreads) threads = maxThreads
nCoresRequest = Option(threads)
referenceFile = new File(config.getAsString("referenceFile"))
this.addJobReportBinding("version", getVersion)
}
......
......@@ -10,6 +10,7 @@ class Fastqc(val globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "fastqc"
val config: Config = globalConfig.getAsConfig("fastqc")
logger.debug("Config for " + this.analysisName + ": " + config)
@Input(doc="fastqc executeble", shortName="Fastqc_Exe")
var fastqc_exe: File = new File(config.getAsString("exe","/usr/local/FastQC/FastQC_v0.10.1/fastqc"))
......@@ -25,10 +26,17 @@ class Fastqc(val globalConfig: Config) extends CommandLineFunction {
@Input(doc="Fastq file", shortName="FQ") var fastqfile: File = _
@Output(doc="Output", shortName="out") var output: File = _
def commandLine = {
if (config.contains("vmem")) jobResourceRequests :+= "h_vmem=" + config.getAsString("vmem")
def init() {
this.addJobReportBinding("version", getVersion)
if (config.contains("fastqc_exe")) fastqc_exe = new File(config.get("fastqc_exe").toString)
this.nCoresRequest = Option(threads)
var maxThreads: Int = config.getAsInt("maxthreads", 24)
if (threads > maxThreads) threads = maxThreads
nCoresRequest = Option(threads)
}
def commandLine = {
init()
required(fastqc_exe) +
optional("--java", java_exe) +
optional("--threads",threads) +
......@@ -43,17 +51,22 @@ class Fastqc(val globalConfig: Config) extends CommandLineFunction {
}
private var version: String = _
def getVersion : String = {
val REG = """FastQC (.*)""".r
if (version == null) for (line <- (fastqc_exe + " --version").!!.split("\n")) {
var versionCommand = fastqc_exe + " --version"
var versionRegex = """FastQC (.*)"""
def getVersion: String = getVersion(versionCommand, versionRegex)
def getVersion(cmd:String, regex:String) : String = {
val REG = regex.r
if (cmd.! != 0) {
logger.warn("Version command: '" + cmd + "' give a none-zero exit code, version not found")
return "NA"
}
for (line <- cmd.!!.split("\n")) {
line match {
case REG(m) => {
version = m
return version
}
case REG(m) => return m
case _ =>
}
}
return version
logger.warn("Version command: '" + cmd + "' give a exit code 0 but no version was found, executeble oke?")
return "NA"
}
}
\ No newline at end of file
......@@ -11,23 +11,28 @@ class Sickle(val globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "sickle"
val config: Config = globalConfig.getAsConfig("sickle")
logger.debug("Config for " + this.analysisName + ": " + config)
@Input(doc="Sickle exe", required=false) var sickle_exe: File = new File("/usr/local/bin/sickle")
@Input(doc="Sickle exe", required=false) var sickle_exe: File = new File(config.getAsString("exe", "/usr/local/bin/sickle"))
@Input(doc="R1 input") var input_R1: File = null
@Input(doc="R2 input", required=false) var input_R2: File = null
@Output(doc="R1 output") var output_R1: File = null
@Output(doc="R2 output", required=false) var output_R2: File = null
@Output(doc="singles output", required=false) var output_singles: File = null
@Output(doc="stats output") var output_stats: File = null
@Input(doc="qualityType file", required=false) var qualityTypeFile: File = null
var qualityType: String = config.getAsString("qualitytype", null)
@Argument(doc="Quality Type", required=false) var qualityType: String = config.getAsString("qualitytype", null)
var defaultQualityType: String = config.getAsString("defaultqualitytype", "sanger")
def commandLine = {
def init() {
this.addJobReportBinding("version", getVersion)
this.getQualityTypeFromFile
if (qualityType == null && defaultQualityType != null) qualityType = defaultQualityType
}
def commandLine = {
init()
var cmd: String = required(sickle_exe)
if (input_R2 != null) {
cmd += required("pe") +
......@@ -54,18 +59,38 @@ class Sickle(val globalConfig: Config) extends CommandLineFunction {
}
}
// private var version: String = _
// def getVersion : String = {
// val REG = """sickle version (.*)""".r
// if (version == null) for (line <- (sickle_exe + " --version").!!.split("\n")) {
// line match {
// case REG(m) => {
// version = m
// return version
// }
// case _ =>
// }
// }
// return version
// }
private var version: String = _
def getVersion : String = {
val REG = """sickle version (.*)""".r
if (version == null) for (line <- (sickle_exe + " --version").!!.split("\n")) {
var versionCommand = sickle_exe + " --version"
var versionRegex = """sickle version (.*)"""
def getVersion: String = getVersion(versionCommand, versionRegex)
def getVersion(cmd:String, regex:String) : String = {
val REG = regex.r
if (cmd.! != 0) {
logger.warn("Version command: '" + cmd + "' give a none-zero exit code, version not found")
return "NA"
}
for (line <- cmd.!!.split("\n")) {
line match {
case REG(m) => {
version = m
return version
}
case REG(m) => return m
case _ =>
}
}
return version
logger.warn("Version command: '" + cmd + "' give a exit code 0 but no version was found, executeble oke?")
return "NA"
}
}
\ No newline at end of file
......@@ -10,30 +10,30 @@ class Star(val globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "STAR"
val config: Config = globalConfig.getAsConfig("star")
logger.debug("Config for " + this.analysisName + ": " + config)
@Argument(doc="STAR executeble", shortName="star_exe", required=false)
var star_exe: String = config.getAsString("exe", "/usr/local/bin/STAR")
@Input(doc="The reference file for the bam files.", shortName="R") var referenceFile: File = new File(config.getAsString("referenceFile"))
@Input(doc="Fastq file R1", shortName="R1") var R1: File = _
@Input(doc="Fastq file R2", shortName="R2", required=false) var R2: File = _
@Argument(doc="Output Directory", shortName="outputDir") var outputDir: String = _
@Argument(doc="GenomeDir", required=false) var genomeDir: String = _
if (genomeDir == null) genomeDir = config.getAsString("genomeDir", referenceFile.getParent + "/star")
@Argument(doc="GenomeDir", required=false) var genomeDir: String = config.getAsString("genomeDir", referenceFile.getParent + "/star")
@Argument(doc="STAR runmode", shortName="runmode", required=false) var runmode: String = _
@Output var outputSam: File = new File(outputDir + "/Aligned.out.sam")
this.addJobReportBinding("version", "NA")
jobResourceRequests :+= "h_vmem=" + config.getAsString("vmem", "6G")
var threads: Int = config.getAsInt("threads", 8)
var maxThreads: Int = config.getAsInt("maxthreads", 24)
if (threads > maxThreads) threads = maxThreads
nCoresRequest = Option(threads)
@Output var outputSam: File = new File(outputDir + "/Aligned.out.sam")
def init() {
this.addJobReportBinding("version", "NA")
}
def commandLine : String= {
//init()
init()
var cmd: String = required("cd",outputDir) + "&&" + required(star_exe)
if (runmode != null && runmode == "genomeGenerate") { // Create index
cmd += required("--runmode", runmode) +
......
......@@ -9,6 +9,7 @@ class Zcat(val globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "zcat"
val config: Config = globalConfig.getAsConfig("zcat")
logger.debug("Config for " + this.analysisName + ": " + config)
@Input(doc="Zipped file") var in: File = _
@Output(doc="Unzipped file") var out: File = _
......
{
"fastqc": { "exe": "/home/pjvan_thof/Downloads/FastQC/fastqc" },
"flexiprep": {
"fastqc": {"exe":"/home/pjvan_thof/pipelines/test/test"},
"cutadapt": {"exe":"/home/pjvan_thof/pipelines/test/test"},
"sickle": {"exe":"/home/pjvan_thof/pipelines/test/test"}
}
}
package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class FastqSync(private var config: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
analysisName = "FastqSync"
@Argument(doc="Pyhton exe", shortName="script") var python_exe: String = "python"
@Input(doc="Pyhton script", shortName="script")
var python_script: File = new File("/home/jfjlaros/projects/ngs-misc/trunk/src/sync_paired_end_reads.py")
@Input(doc="Start fastq") var input_start_fastq: File = _
@Input(doc="R1 input") var input_R1: File = _
@Input(doc="R2 input") var input_R2: File = _
@Output(doc="R1 output") var output_R1: File = _
@Output(doc="R2 output") var output_R2: File = _
@Output(doc="stats output") var output_stats: File = _
def commandLine = {
required(python_exe) +
required(python_script) +
required(input_start_fastq) +
required(input_R1) +
required(input_R2) +
required(output_R1) +
required(output_R2) +
" > " +
required(output_stats)
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class FastqcToContams(private var config: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
analysisName = "getContams"
@Argument(doc="Pyhton exe", shortName="script") var python_exe: String = "python"
@Input(doc="Pyhton script", shortName="script")
var python_script: File = new File("/data/DIV5/SASC/project-057-Florentine/analysis/pipelines/magpie/modules/gatk01/modules/flexiprep/scripts/fastqc_contam.py")
@Input(doc="Fastqc output", shortName="fastqc", required=true) var fastqc_output: File = _
@Input(doc="Contams input", shortName="fastqc", required=true) var contams_file: File = _
@Output(doc="Output file", shortName="out", required=true) var out: File = _
def commandLine = {
required(python_exe) +
required(python_script) +
required(fastqc_output.getParent()) +
required("-c",contams_file) +
" > " +
required(out)
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class FastqcToQualtype(private var config: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
analysisName = "getQualtype"
@Argument(doc="Pyhton exe", shortName="script") var python_exe: String = "python"
@Input(doc="Pyhton script", shortName="script")
var python_script: File = new File("/data/DIV5/SASC/project-057-Florentine/analysis/pipelines/magpie/modules/gatk01/modules/flexiprep/scripts/qual_type_sickle.py")
@Input(doc="Fastqc output", shortName="fastqc", required=true) var fastqc_output: File = _
@Output(doc="Output file", shortName="out", required=true) var out: File = _
def commandLine = {
required(python_exe) +
required(python_script) +
required(fastqc_output.getParent()) +
" > " +
required(out)
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment