Commit 16a08dfd authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

- Moved constructor to function itself

- Add extract option to fastqc
parent bf372d9a
...@@ -18,13 +18,14 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -18,13 +18,14 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
@Output(doc = "Output", shortName = "out") @Output(doc = "Output", shortName = "out")
var output: File = _ var output: File = _
executable = config("exe", default = "fastqc") executable = config("exe", default = "fastqc")
var java_exe: String = config("exe", default = "java", submodule = "java") var java_exe: String = config("exe", default = "java", submodule = "java")
var kmers: Option[Int] = config("kmers") var kmers: Option[Int] = config("kmers")
var quiet: Boolean = config("quiet") var quiet: Boolean = config("quiet")
var noextract: Boolean = config("noextract") var noextract: Boolean = config("noextract")
var nogroup: Boolean = config("nogroup") var nogroup: Boolean = config("nogroup")
var extract: Boolean = config("extract", default = true)
override val versionRegex = """FastQC (.*)""".r override val versionRegex = """FastQC (.*)""".r
override val defaultThreads = 4 override val defaultThreads = 4
...@@ -45,9 +46,24 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -45,9 +46,24 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
optional("--kmers", kmers) + optional("--kmers", kmers) +
conditional(nogroup, "--nogroup") + conditional(nogroup, "--nogroup") +
conditional(noextract, "--noextract") + conditional(noextract, "--noextract") +
conditional(extract, "--extract") +
conditional(quiet, "--quiet") + conditional(quiet, "--quiet") +
required("-o", output.getParent()) + required("-o", output.getParent()) +
required(fastqfile) + required(fastqfile)
required(" > ", output, escape = false)
} }
} }
object Fastqc {
def apply(root:Configurable, fastqfile: File, outDir: String): Fastqc = {
val fastqcCommand = new Fastqc(root)
fastqcCommand.fastqfile = fastqfile
var filename: String = fastqfile.getName()
if (filename.endsWith(".gz")) filename = filename.substring(0, filename.size - 3)
if (filename.endsWith(".gzip")) filename = filename.substring(0, filename.size - 5)
if (filename.endsWith(".fastq")) filename = filename.substring(0, filename.size - 6)
//if (filename.endsWith(".fq")) filename = filename.substring(0,filename.size - 3)
fastqcCommand.jobOutputFile = new File(outDir + "/" + filename + "_fastqc.zip")
fastqcCommand.afterGraph
return fastqcCommand
}
}
\ No newline at end of file
...@@ -81,13 +81,13 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript { ...@@ -81,13 +81,13 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript {
addSha1sum(outputFiles("fastq_input_R1"), "sha1_R1") addSha1sum(outputFiles("fastq_input_R1"), "sha1_R1")
if (paired) addSha1sum(outputFiles("fastq_input_R2"), "sha1_R2") if (paired) addSha1sum(outputFiles("fastq_input_R2"), "sha1_R2")
var fastqc_R1 = runFastqc(input_R1, outputDir + "/" + R1_name + ".fastqc/") var fastqc_R1 = Fastqc(this, input_R1, outputDir + "/" + R1_name + ".fastqc/")
outputFiles += ("fastqc_R1" -> fastqc_R1.output) outputFiles += ("fastqc_R1" -> fastqc_R1.output)
outputFiles += ("qualtype_R1" -> getQualtype(fastqc_R1, R1_name)) outputFiles += ("qualtype_R1" -> getQualtype(fastqc_R1, R1_name))
outputFiles += ("contams_R1" -> getContams(fastqc_R1, R1_name)) outputFiles += ("contams_R1" -> getContams(fastqc_R1, R1_name))
if (paired) { if (paired) {
var fastqc_R2 = runFastqc(input_R2, outputDir + "/" + R2_name + ".fastqc/") var fastqc_R2 = Fastqc(this, input_R2, outputDir + "/" + R2_name + ".fastqc/")
outputFiles += ("fastqc_R2" -> fastqc_R2.output) outputFiles += ("fastqc_R2" -> fastqc_R2.output)
outputFiles += ("qualtype_R2" -> getQualtype(fastqc_R2, R2_name)) outputFiles += ("qualtype_R2" -> getQualtype(fastqc_R2, R2_name))
outputFiles += ("contams_R2" -> getContams(fastqc_R2, R2_name)) outputFiles += ("contams_R2" -> getContams(fastqc_R2, R2_name))
...@@ -226,9 +226,9 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript { ...@@ -226,9 +226,9 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript {
addSha1sum(R1, "sha1_qc_R1") addSha1sum(R1, "sha1_qc_R1")
if (paired) addSha1sum(R2, "sha1_qc_R2") if (paired) addSha1sum(R2, "sha1_qc_R2")
outputFiles += ("fastqc_R1_final" -> runFastqc(outputFiles("output_R1"), outputDir + "/" + R1_name + ".qc.fastqc/").output) outputFiles += ("fastqc_R1_final" -> Fastqc(this, outputFiles("output_R1"), outputDir + "/" + R1_name + ".qc.fastqc/").output)
if (paired) outputFiles += ("fastqc_R2_final" -> runFastqc(outputFiles("output_R2"), outputDir + "/" + R2_name + ".qc.fastqc/").output) if (paired) outputFiles += ("fastqc_R2_final" -> Fastqc(this, outputFiles("output_R2"), outputDir + "/" + R2_name + ".qc.fastqc/").output)
} }
if (!skipSummary) { if (!skipSummary) {
...@@ -245,20 +245,6 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript { ...@@ -245,20 +245,6 @@ class Flexiprep(val root: Configurable) extends QScript with BiopetQScript {
} }
} }
def runFastqc(fastqfile: File, outDir: String): Fastqc = {
val fastqcCommand = new Fastqc(this)
fastqcCommand.fastqfile = fastqfile
var filename: String = fastqfile.getName()
if (filename.endsWith(".gz")) filename = filename.substring(0, filename.size - 3)
if (filename.endsWith(".gzip")) filename = filename.substring(0, filename.size - 5)
if (filename.endsWith(".fastq")) filename = filename.substring(0, filename.size - 6)
//if (filename.endsWith(".fq")) filename = filename.substring(0,filename.size - 3)
fastqcCommand.output = outDir + "/" + filename + "_fastqc.output"
fastqcCommand.afterGraph
add(fastqcCommand)
return fastqcCommand
}
def extractIfNeeded(file: File, runDir: String): File = { def extractIfNeeded(file: File, runDir: String): File = {
if (file.getName().endsWith(".gz") || file.getName().endsWith(".gzip")) { if (file.getName().endsWith(".gz") || file.getName().endsWith(".gzip")) {
var newFile: File = swapExt(runDir, file, ".gz", "") var newFile: File = swapExt(runDir, file, ".gz", "")
......
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