Commit 4355447e authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Merge branch 'waiyi' into 'master'

Waiyi

merge for ticket #54

See merge request !12
parents 4eff4dde fb266355
...@@ -21,9 +21,11 @@ Any value defined here will override the pom.xml file value but is only applicab ...@@ -21,9 +21,11 @@ Any value defined here will override the pom.xml file value but is only applicab
<netbeans.hint.license>apache20</netbeans.hint.license> <netbeans.hint.license>apache20</netbeans.hint.license>
<com-junichi11-netbeans-changelf.enable>true</com-junichi11-netbeans-changelf.enable> <com-junichi11-netbeans-changelf.enable>true</com-junichi11-netbeans-changelf.enable>
<com-junichi11-netbeans-changelf.use-project>true</com-junichi11-netbeans-changelf.use-project> <com-junichi11-netbeans-changelf.use-project>true</com-junichi11-netbeans-changelf.use-project>
<com-junichi11-netbeans-changelf.lf-kind>CRLF</com-junichi11-netbeans-changelf.lf-kind> <com-junichi11-netbeans-changelf.lf-kind>LF</com-junichi11-netbeans-changelf.lf-kind>
<com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global> <com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global>
<netbeans.checkstyle.format>true</netbeans.checkstyle.format> <netbeans.checkstyle.format>true</netbeans.checkstyle.format>
<com-junichi11-netbeans-changelf.show-dialog>true</com-junichi11-netbeans-changelf.show-dialog>
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
</properties> </properties>
</project-shared-configuration> </project-shared-configuration>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<actions> <actions>
<action> <action>
<actionName>run</actionName> <actionName>run</actionName>
<preAction>build-with-dependencies</preAction>
<packagings> <packagings>
<packaging>jar</packaging> <packaging>jar</packaging>
</packagings> </packagings>
......
...@@ -207,6 +207,14 @@ ...@@ -207,6 +207,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
package nl.lumc.sasc.biopet.scripts package nl.lumc.sasc.biopet.extensions
import java.io.File /*
* Wrapper around the seqstat implemented in D
import org.broadinstitute.gatk.utils.commandline.{ Input, Output } *
*/
import argonaut._, Argonaut._ import argonaut._, Argonaut._
import scalaz._, Scalaz._ import scalaz._, Scalaz._
import scala.io.Source import scala.io.Source
import scala.collection.mutable.Map import scala.collection.mutable.Map
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.PythonCommandLineFunction import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class Seqstat(val root: Configurable) extends PythonCommandLineFunction {
setPythonScript("__init__.py", "pyfastqc/")
setPythonScript("seq_stat.py")
@Input(doc = "Fastq input", shortName = "fastqc", required = true) class Seqstat(val root: Configurable) extends BiopetCommandLineFunction {
var input_fastq: File = _ override val defaultVmem = "4G"
@Output(doc = "Output file", shortName = "out", required = true) @Input(doc = "Input FastQ", required = true)
var out: File = _ var input: File = _
var fmt: String = _ @Output(doc = "JSON summary", required = true)
var output: File = _
def cmdLine = { executable = config("exe", default = "fastq-seqstat")
getPythonCommand +
optional("--fmt", fmt) +
required("-o", out) +
required(input_fastq)
}
def cmdLine = required(executable) + required(input) + " > " + required(output)
def getSummary: Json = { def getSummary: Json = {
val json = Parse.parseOption(Source.fromFile(out).mkString) val json = Parse.parseOption(Source.fromFile(output).mkString)
if (json.isEmpty) return jNull if (json.isEmpty) return jNull
else return json.get.fieldOrEmptyObject("stats") else return json.get.fieldOrEmptyObject("stats")
} }
} }
object Seqstat { object Seqstat {
def apply(root: Configurable, input: File, output: File): Seqstat = {
val seqstat = new Seqstat(root)
seqstat.input = input
seqstat.output = output
return seqstat
}
def apply(root: Configurable, fastqfile: File, outDir: String): Seqstat = { def apply(root: Configurable, fastqfile: File, outDir: String): Seqstat = {
val seqstat = new Seqstat(root) val seqstat = new Seqstat(root)
val ext = fastqfile.getName.substring(fastqfile.getName.lastIndexOf(".")) val ext = fastqfile.getName.substring(fastqfile.getName.lastIndexOf("."))
seqstat.input_fastq = fastqfile seqstat.input = fastqfile
seqstat.out = new File(outDir + fastqfile.getName.substring(0, fastqfile.getName.lastIndexOf(".")) + ".seqstats.json") seqstat.output = new File(outDir + fastqfile.getName.substring(0, fastqfile.getName.lastIndexOf(".")) + ".seqstats.json")
return seqstat return seqstat
} }
......
...@@ -24,25 +24,24 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -24,25 +24,24 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction {
@Output(doc = "Output file SAM", shortName = "output") @Output(doc = "Output file SAM", shortName = "output")
var output: File = _ var output: File = _
// options set via API or config // options set via API or config
// var numrecords: String = config("numrecords", default = "all") // var numrecords: String = config("numrecords", default = "all")
var solexa: Boolean = config("solexa", default = false) var solexa: Boolean = config("solexa", default = false)
var solexaold: Boolean = config("solexaold", default = false) var solexaold: Boolean = config("solexaold", default = false)
var sanger: Boolean = config("sanger", default = false) var sanger: Boolean = config("sanger", default = false)
var insertsize: Option[Int] = config("insertsize", default = 250) var insertsize: Option[Int] = config("insertsize", default = 250)
var insertsd: Option[Int] = config("insertsd", default = 60) var insertsd: Option[Int] = config("insertsd", default = 60)
var insertsize2: Option[Int] = config("insertsize2", default = -2000) var insertsize2: Option[Int] = config("insertsize2", default = -2000)
var insertsd2: Option[Int] = config("insertsd2", default = -1) var insertsd2: Option[Int] = config("insertsd2", default = -1)
var sensitive: Boolean = config("sensitive", default = false) var sensitive: Boolean = config("sensitive", default = false)
var fast: Boolean = config("fast", default = false) var fast: Boolean = config("fast", default = false)
var readgroup: String = config("readgroup") var readgroup: String = config("readgroup")
var verbosity: Option[Int] = config("verbosity", default = 2) var verbosity: Option[Int] = config("verbosity", default = 2)
var logfile: String = config("logfile") var logfile: String = config("logfile")
executable = config("exe", default = "stampy.py", freeVar = false) executable = config("exe", default = "stampy.py", freeVar = false)
override val versionRegex = """stampy v(.*) \(.*\), .*""".r override val versionRegex = """stampy v(.*) \(.*\), .*""".r
override val versionExitcode = List(0, 1) override val versionExitcode = List(0, 1)
...@@ -52,33 +51,33 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -52,33 +51,33 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction {
override val defaultThreads = 8 override val defaultThreads = 8
override def versionCommand = executable + " --help" override def versionCommand = executable + " --help"
def cmdLine : String = { def cmdLine: String = {
var cmd: String = required(executable) + var cmd: String = required(executable) +
optional("-t", nCoresRequest) + optional("-t", nCoresRequest) +
conditional(solexa, "--solexa") + conditional(solexa, "--solexa") +
conditional(solexaold, "--solexaold") + conditional(solexaold, "--solexaold") +
conditional(sanger, "--sanger") + conditional(sanger, "--sanger") +
optional("--insertsize", insertsize) + optional("--insertsize", insertsize) +
optional("--insertsd", insertsd) optional("--insertsd", insertsd)
// Optionally start Mate Pair alignment, if set, the aligner will // Optionally start Mate Pair alignment, if set, the aligner will
// assign MP reads as MP, otherwise in PE mode, these reads will // assign MP reads as MP, otherwise in PE mode, these reads will
// be aligned with the bits RR or FF showing a False Inversion event // be aligned with the bits RR or FF showing a False Inversion event
if ( insertsd2.getOrElse(-1) != -1 ) { if (insertsd2.getOrElse(-1) != -1) {
cmd += optional("--insertsize2", insertsize2) + cmd += optional("--insertsize2", insertsize2) +
optional("--insertsd2", insertsd2) optional("--insertsd2", insertsd2)
} }
cmd += conditional(sensitive, "--sensitive") + cmd += conditional(sensitive, "--sensitive") +
conditional(fast, "--fast") + conditional(fast, "--fast") +
optional("--readgroup", readgroup) + optional("--readgroup", readgroup) +
optional("-v", verbosity) + optional("-v", verbosity) +
optional("--logfile", logfile) + optional("--logfile", logfile) +
" -g " + required(genome) + " -g " + required(genome) +
" -h " + required(hash) + " -h " + required(hash) +
" -o " + required(output) + " -o " + required(output) +
" -M " + required(R1) + optional(R2) " -M " + required(R1) + optional(R2)
return cmd return cmd
} }
} }
package nl.lumc.sasc.biopet.extensions.sambamba
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
abstract class Sambamba extends BiopetCommandLineFunction {
override val defaultVmem = "4G"
override val defaultThreads = 2
executable = config("exe", default = "sambamba", submodule = "sambamba", freeVar = false)
override def versionCommand = executable
override val versionRegex = """sambamba v(.*)""".r
override val versionExitcode = List(0, 1)
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions.sambamba
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SambambaFlagstat(val root: Configurable) extends Sambamba {
override val defaultThreads = 2
@Input(doc = "Bam File")
var input: File = _
@Output(doc = "output File")
var output: File = _
def cmdLine = required(executable) +
required("flagstat") +
optional("-t", nCoresRequest) +
required(input) +
" > " +
required(output)
}
object SambambaFlagstat {
def apply(root: Configurable, input: File, output: File): SambambaFlagstat = {
val flagstat = new SambambaFlagstat(root)
flagstat.input = input
flagstat.output = output
return flagstat
}
def apply(root: Configurable, input: File, outputDir: String): SambambaFlagstat = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.getName))
return apply(root, input, outputFile)
}
def apply(root: Configurable, input: File): SambambaFlagstat = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".flagstat"
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions.sambamba
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SambambaIndex(val root: Configurable) extends Sambamba {
override val defaultThreads = 2
@Input(doc = "Bam File")
var input: File = _
@Output(doc = "Output .bai file to")
var output: File = _
def cmdLine = required(executable) +
required("index") +
optional("-t", nCoresRequest) +
required(input) +
required(output)
}
object SambambaIndex {
def apply(root: Configurable, input: File, output: File): SambambaIndex = {
val flagstat = new SambambaIndex(root)
flagstat.input = input
flagstat.output = output
return flagstat
}
def apply(root: Configurable, input: File, outputDir: String): SambambaIndex = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.getName))
return apply(root, input, outputFile)
}
def apply(root: Configurable, input: File): SambambaIndex = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".bam.bai"
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions.sambamba
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SambambaMarkdup(val root: Configurable) extends Sambamba {
override val defaultThreads = 4
@Input(doc = "Bam File")
var input: File = _
@Output(doc = "Markdup output bam")
var output: File = _
var remove_duplicates: Boolean = config("remove_duplicates", default = false)
// @doc: compression_level 6 is average, 0 = no compression, 9 = best
val compression_level: Option[Int] = config("compression_level", default=6)
val hash_table_size: Option[Int] = config("hash-table-size", default=262144)
val overflow_list_size: Option[Int] = config("overflow-list-size", default=200000)
val io_buffer_size: Option[Int] = config("io-buffer-size", default=128)
def cmdLine = required(executable) +
required("markdup") +
conditional(remove_duplicates, "--remove-duplicates") +
optional("-t", nCoresRequest) +
optional("-l", compression_level) +
optional("--hash-table-size=", hash_table_size, spaceSeparated=false ) +
optional("--overflow-list-size=", overflow_list_size, spaceSeparated=false ) +
optional("--io-buffer-size=", io_buffer_size, spaceSeparated=false ) +
required(input) +
required(output)
}
object SambambaMarkdup {
def apply(root: Configurable, input: File, output: File): SambambaMarkdup = {
val flagstat = new SambambaMarkdup(root)
flagstat.input = input
flagstat.output = output
return flagstat
}
def apply(root: Configurable, input: File, outputDir: String): SambambaMarkdup = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.getName))
return apply(root, input, outputFile)
}
def apply(root: Configurable, input: File): SambambaMarkdup = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".bam.bai"
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions.sambamba
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SambambaMerge(val root: Configurable) extends Sambamba {
override val defaultThreads = 4
@Input(doc = "Bam File[s]")
var input: List[File] = Nil
@Output(doc = "Output merged bam PATH")
var output: File = _
// @doc: compression_level 6 is average, 0 = no compression, 9 = best
val compression_level: Option[Int] = config("compression_level", default=6)
def cmdLine = required(executable) +
required("merge") +
optional("-t", nCoresRequest) +
optional("-l", compression_level) +
required(output) +
repeat("", input)
}
object SambambaMerge {
def apply(root: Configurable, input: List[File], output: File): SambambaMerge = {
val flagstat = new SambambaMerge(root)
flagstat.input = input
flagstat.output = output
return flagstat
}
def apply(root: Configurable, input: List[File], outputDir: String): SambambaMerge = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.head.getName))
return apply(root, input, outputFile)
}
def apply(root: Configurable, input: List[File]): SambambaMerge = {
return apply(root, input, new File(swapExtension(input.head.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".merge.bam"
}
//
//object MergeSamFiles {
// def apply(root: Configurable, input: List[File], outputDir: String, sortOrder: String = null): MergeSamFiles = {
// val mergeSamFiles = new MergeSamFiles(root)
// mergeSamFiles.input = input
// mergeSamFiles.output = new File(outputDir, input.head.getName.stripSuffix(".bam").stripSuffix(".sam") + ".merge.bam")
// if (sortOrder == null) mergeSamFiles.sortOrder = "coordinate"
// else mergeSamFiles.sortOrder = sortOrder
// return mergeSamFiles
// }
//}
\ No newline at end of file
...@@ -3,6 +3,7 @@ package nl.lumc.sasc.biopet.extensions.svcallers ...@@ -3,6 +3,7 @@ package nl.lumc.sasc.biopet.extensions.svcallers
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
import nl.lumc.sasc.biopet.core.BiopetQScript import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.core.config.Configurable import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument } import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import java.io.File import java.io.File
...@@ -10,33 +11,34 @@ import java.io.File ...@@ -10,33 +11,34 @@ import java.io.File
class BreakdancerConfig(val root: Configurable) extends BiopetCommandLineFunction { class BreakdancerConfig(val root: Configurable) extends BiopetCommandLineFunction {
executable = config("exe", default = "bam2cfg.pl", freeVar = false) executable = config("exe", default = "bam2cfg.pl", freeVar = false)
@Input(doc = "Bam File") @Input(doc = "Bam File")
var input: File = _ var input: File = _
@Output(doc = "Output File") @Output(doc = "Output File")
var output: File = _ var output: File = _
var MIN_MQ: Option[Int] = config("min_mq", default = 20) // minimum of MQ to consider for taking read into histogram var min_mq: Option[Int] = config("min_mq", default = 20) // minimum of MQ to consider for taking read into histogram
var USE_MQ: Boolean = config("use_mq", default = false) var use_mq: Boolean = config("use_mq", default = false)
var MIN_INSERTSIZE: Option[Int] = config("min_insertsize", default = 450) var min_insertsize: Option[Int] = config("min_insertsize", default = 450)
var SOLID_DATA: Boolean = config("solid", default = false) var solid_data: Boolean = config("solid", default = false)
var SD_CUTOFF: Option[Int] = config("sd_cutoff", default = 4) // Cutoff in unit of standard deviation [4] var sd_cutoff: Option[Int] = config("sd_cutoff", default = 4) // Cutoff in unit of standard deviation [4]
// we set this to a higher number to avoid biases in small numbers in sorted bams // we set this to a higher number to avoid biases in small numbers in sorted bams
var MIN_OBSERVATIONS: Option[Int] = config("min_observations", default = 1000000) // Number of observation required to estimate mean and s.d. insert size [10_000] var min_observations: Option[Int] = config("min_observations", default = 10000) // Number of observation required to estimate mean and s.d. insert size [10_000]
var COEFVAR_CUTOFF: Option[Int] = config("coef_cutoff", default = 1) // Cutoff on coefficients of variation [1] var coefvar_cutoff: Option[Int] = config("coef_cutoff", default = 1) // Cutoff on coefficients of variation [1]
var HISTOGRAM_BINS: Option[Int] = config("histogram_bins", default = 50) // Number of bins in the histogram [50] var histogram_bins: Option[Int] = config("histogram_bins", default = 50) // Number of bins in the histogram [50]
def cmdLine = required(executable) + def cmdLine = required(executable) +
optional("-q", MIN_MQ) + optional("-q", min_mq) +
conditional(USE_MQ, "-m") + conditional(use_mq, "-m") +
optional("-s", MIN_INSERTSIZE) + optional("-s", min_insertsize) +
conditional(SOLID_DATA, "-s") + conditional(solid_data, "-s") +
optional("-c", SD_CUTOFF) + optional("-c", sd_cutoff) +
optional("-n", MIN_OBSERVATIONS) + optional("-n", min_observations) +
optional("-v", COEFVAR_CUTOFF) + optional("-v", coefvar_cutoff) +
optional("-b", HISTOGRAM_BINS) optional("-b", histogram_bins) +
required(input) + " > " + required(output) required(input) + " 1> " + required(output)
} }
object BreakdancerConfig { object BreakdancerConfig {
...@@ -63,43 +65,87 @@ object BreakdancerConfig { ...@@ -63,43 +65,87 @@ object BreakdancerConfig {