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

Added bz2 support

parent f54fc743
No related branches found
No related tags found
No related merge requests found
package nl.lumc.sasc.biopet.function
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.core.config._
//import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class Pbzip2(val root:Configurable) extends BiopetCommandLineFunction {
@Input(doc="Zipped file")
var input: File = _
@Output(doc="Unzipped file")
var output: File = _
executeble = config("exe", "pbzip2")
var decomrpess = true
var memory: Int = config("memory", 1000)
override val defaultVmem = (memory * 2 / 1000) + "G"
override val defaultThreads = 2
def cmdLine = required(executeble) +
conditional(decomrpess, "-d") +
conditional(!decomrpess, "-z") +
optional("-p", threads, spaceSeparated=false) +
optional("-m", memory, spaceSeparated=false) +
required("-c", output) +
required(input)
}
object Pbzip2 {
def apply(root:Configurable, input:File, output:File): Pbzip2 = {
val pbzip2 = new Pbzip2(root)
pbzip2.input = input
pbzip2.output = output
return pbzip2
}
}
\ No newline at end of file
......@@ -16,4 +16,13 @@ class Zcat(val root:Configurable) extends BiopetCommandLineFunction {
executeble = config("exe", "zcat")
def cmdLine = required(executeble) + required(input) + " > " + required(output)
}
object Zcat {
def apply(root:Configurable, input:File, output:File): Zcat = {
val zcat = new Zcat(root)
zcat.input = input
zcat.output = output
return zcat
}
}
\ No newline at end of file
{
"fastqc": { "exe": "/home/pjvan_thof/Downloads/FastQC/fastqc" },
"gatk": {"flexiprep": { "sdfg": { "exe": "gatk" }}},
"pbzip2": { "exe": "/home/pjvan_thof/pipelines/test/test" },
"flexiprep": {
"fastqc": { "exe": "/home/pjvan_thof/pipelines/test/test" },
"cutadapt": {"exe":"/home/pjvan_thof/pipelines/test/test"},
......
......@@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......@@ -25,7 +25,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
......@@ -41,7 +41,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......
......@@ -60,8 +60,8 @@ class Flexiprep(val root:Configurable) extends QScript with BiopetQScript {
def biopetScript() {
runInitialFastqc()
outputFiles += ("fastq_input_R1" -> zcatIfNeeded(input_R1,outputDir))
if (paired) outputFiles += ("fastq_input_R2" -> zcatIfNeeded(input_R2,outputDir))
outputFiles += ("fastq_input_R1" -> extractIfNeeded(input_R1,outputDir))
if (paired) outputFiles += ("fastq_input_R2" -> extractIfNeeded(input_R2,outputDir))
addSeqstat(outputFiles("fastq_input_R1"), "seqstat_R1")
if (paired) addSeqstat(outputFiles("fastq_input_R2"), "seqstat_R2")
......@@ -237,17 +237,20 @@ class Flexiprep(val root:Configurable) extends QScript with BiopetQScript {
return fastqcCommand
}
def zcatIfNeeded(file:File, runDir:String) : File = {
def extractIfNeeded(file:File, runDir:String) : File = {
if (file.getName().endsWith(".gz") || file.getName().endsWith(".gzip")) {
var newFile: File = swapExt(file,".gz","")
if (file.getName().endsWith(".gzip")) newFile = swapExt(file,".gzip","")
val zcatCommand = new Zcat(this)
zcatCommand.input = file
zcatCommand.output = new File(runDir + newFile)
//zcatCommand.jobOutputFile = outputDir + "." + file.getName + ".out"
var newFile: File = swapExt(runDir, file,".gz","")
if (file.getName().endsWith(".gzip")) newFile = swapExt(runDir, file,".gzip","")
val zcatCommand = Zcat(this, file, newFile)
if (!this.skipClip || !this.skipTrim) zcatCommand.isIntermediate = true
add(zcatCommand)
return zcatCommand.output
return newFile
} else if (file.getName().endsWith(".bz2")) {
var newFile = swapExt(runDir, file,".bz2","")
val pbzip2 = Pbzip2(this,file, newFile)
if (!this.skipClip || !this.skipTrim) pbzip2.isIntermediate = true
add(pbzip2)
return newFile
} else return 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