Commit 323c6e1e authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Merge commit '3daaba4b' into feature-sample_config_create

parents 9d7917ea 3daaba4b
......@@ -5,7 +5,8 @@
<configuration>
<option name="compilerLibraryLevel" value="Project" />
<option name="compilerLibraryName" value="Maven: org.scala-lang:scala-compiler-bundle:2.11.2" />
<option name="compilerOptions" value="-dependencyfile $MODULE_DIR$/target/.scala_dependencies" />
<option name="compilerOptions" value="-dependencyfile $MODULE_DIR$/target/.scala_dependencies -feature" />
<option name="deprecationWarnings" value="true" />
<option name="languageLevel" value="Scala 2.11" />
<option name="vmOptions" value="" />
</configuration>
......@@ -29,15 +30,15 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="com.twitter:algebird-core_2.10:0.8.1" level="project" />
<orderEntry type="library" name="gatk-protected" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.testng:testng:6.8" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.beanshell:bsh:2.0b4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.beust:jcommander:1.27" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.yaml:snakeyaml:1.6" level="project" />
<orderEntry type="library" name="Maven: org.scalatest:scalatest_2.11:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-reflect:2.11.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.scalatest:scalatest_2.11:2.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.scala-lang:scala-reflect:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang.modules:scala-xml_2.11:1.0.2" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.broadinstitute.gatk:gatk-queue-package-distribution:3.3" level="project" />
......@@ -49,6 +50,5 @@
<orderEntry type="library" name="Maven: org.biojava:biojava3-sequencing:3.1.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
<orderEntry type="library" name="Maven: com.github.scopt:scopt_2.10:3.2.0" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.5" level="project" />
</component>
</module>
</module>
\ No newline at end of file
{
"bwa": {
"exe": "/usr/local/bwa/bwa-0.7.10/bwa"
},
"seqtk": {
"exe":"/data/DIV5/SASC/common/programs/seqtk/seqtk/seqtk"
},
"sickle": {
"exe":"/data/DIV5/SASC/common/programs/sickle/sickle-1.33/sickle"
},
"clever": {
"exe": "/data/DIV5/SASC/common/programs/clever/clever-toolkit-v2.0rc3/bin/clever",
"version_exe": "/data/DIV5/SASC/common/programs/clever/clever-toolkit-v2.0rc3/bin/ctk-version"
},
"pindel": {
"exe": "/data/DIV5/SASC/common/programs/pindel/pindel-0.2.5/pindel"
},
"breakdancerconfig": {
"exe": "/data/DIV5/SASC/common/programs/breakdancer/breakdancer-v1.4.4/lib/breakdancer-max1.4.4/bam2cfg.pl"
},
"breakdancercaller": {
"exe": "/data/DIV5/SASC/common/programs/breakdancer/breakdancer-v1.4.4/bin/breakdancer-max"
},
"fastqc": {
"exe": "/usr/local/FastQC/FastQC_v0.10.1/fastqc"
},
"seqstat": {
"exe": "/data/DIV5/SASC/common/programs/dQual/fastq-seqstat"
},
"stampy": {
"exe": "/usr/local/stampy/stampy-1.0.23/stampy.py"
},
"sambamba": {
"exe": "/data/DIV5/SASC/common/programs/sambamba/sambamba-0.4.7/build/sambamba"
}
}
......@@ -25,6 +25,5 @@ Any value defined here will override the pom.xml file value but is only applicab
<com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global>
<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>
</properties>
</project-shared-configuration>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.lumc.sasc</groupId>
<artifactId>BiopetFramework</artifactId>
<version>0.2.0-DEV</version>
<packaging>jar</packaging>
<groupId>nl.lumc.sasc</groupId>
<artifactId>BiopetFramework</artifactId>
<version>0.2.0-DEV</version>
<packaging>jar</packaging>
<name>BiopetFramework</name>
<url>http://maven.apache.org</url>
<name>BiopetFramework</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sting.unpack.phase>prepare-package</sting.unpack.phase>
<sting.shade.phase>package</sting.shade.phase>
<app.main.class>nl.lumc.sasc.biopet.core.BiopetExecutable</app.main.class>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sting.unpack.phase>prepare-package</sting.unpack.phase>
<sting.shade.phase>package</sting.shade.phase>
<sting.binary-dist.name>SASC-Pipelines</sting.binary-dist.name>
<app.main.class>nl.lumc.sasc.biopet.core.BiopetExecutable</app.main.class>
</properties>
<repositories>
<repository>
<id>biojava-maven-repo</id>
<name>BioJava repository</name>
<url>http://www.biojava.org/download/maven/</url>
<url>http://www.biojava.org/download/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>2.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
......@@ -68,29 +74,24 @@
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.github.scopt</groupId>
<artifactId>scopt_2.10</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<groupId>com.github.scopt</groupId>
<artifactId>scopt_2.10</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/scripts</directory>
<includes>
<include>**/*</include>
</includes>
<directory>src/main/scripts</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
......@@ -102,7 +103,7 @@
<execution>
<goals>
<goal>revision</goal>
</goals>
</goals>
</execution>
</executions>
......@@ -141,9 +142,10 @@
</goals>
<configuration>
<args>
<!-- <arg>-make:transitive</arg>-->
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
<arg>-deprecation</arg>
<arg>-feature</arg>
</args>
</configuration>
</execution>
......@@ -154,7 +156,7 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
......@@ -163,50 +165,50 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<finalName>Biopet-${project.version}-${git.commit.id.abbrev}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${app.main.class}</Main-Class>
<X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${app.main.class}</Main-Class>
<X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>org.broadinstitute.gatk:gatk-queue-package-distribution</artifact>
<includes>
<include>*/**</include>
<include>org/simpleframework/**</include>
<include>org/jets3t/**</include>
<include>com/sun/**</include>
<include>org/ggf/**</include>
<include>picard/**</include>
<include>htsjdk/**</include>
<include>javassist/**</include>
<include>com/google/**</include>
<include>org/reflections/</include>
<include>org/jgrapht/**</include>
<include>org/broadinstitute/**</include>
<include>org/apache/**</include>
<include>scala/tools/nsc/reporters/**</include>
</includes>
<artifact>org.broadinstitute.gatk:gatk-queue-package-distribution</artifact>
<includes>
<include>*/**</include>
<include>org/simpleframework/**</include>
<include>org/jets3t/**</include>
<include>com/sun/**</include>
<include>org/ggf/**</include>
<include>picard/**</include>
<include>htsjdk/**</include>
<include>javassist/**</include>
<include>com/google/**</include>
<include>org/reflections/</include>
<include>org/jgrapht/**</include>
<include>org/broadinstitute/**</include>
<include>org/apache/**</include>
<include>scala/tools/nsc/reporters/**</include>
</includes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......@@ -221,33 +223,35 @@
<artifactId>scalariform-maven-plugin</artifactId>
<version>0.1.4</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<rewriteArrowSymbols>false</rewriteArrowSymbols>
<alignParameters>true</alignParameters>
<alignSingleLineCaseStatements_maxArrowIndent>40</alignSingleLineCaseStatements_maxArrowIndent>
<alignSingleLineCaseStatements>true</alignSingleLineCaseStatements>
<compactStringConcatenation>false</compactStringConcatenation>
<compactControlReadability>false</compactControlReadability>
<doubleIndentClassDeclaration>false</doubleIndentClassDeclaration>
<formatXml>true</formatXml>
<indentLocalDefs>false</indentLocalDefs>
<indentPackageBlocks>true</indentPackageBlocks>
<indentSpaces>2</indentSpaces>
<placeScaladocAsterisksBeneathSecondAsterisk>false</placeScaladocAsterisksBeneathSecondAsterisk>
<preserveDanglingCloseParenthesis>true</preserveDanglingCloseParenthesis>
<preserveSpaceBeforeArguments>false</preserveSpaceBeforeArguments>
<rewriteArrowSymbols>false</rewriteArrowSymbols>
<spaceBeforeColon>false</spaceBeforeColon>
<spaceInsideBrackets>false</spaceInsideBrackets>
<spaceInsideParentheses>false</spaceInsideParentheses>
<spacesWithinPatternBinders>true</spacesWithinPatternBinders>
</configuration>
</execution>
<execution>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<rewriteArrowSymbols>false</rewriteArrowSymbols>
<alignParameters>true</alignParameters>
<alignSingleLineCaseStatements_maxArrowIndent>40
</alignSingleLineCaseStatements_maxArrowIndent>
<alignSingleLineCaseStatements>true</alignSingleLineCaseStatements>
<compactStringConcatenation>false</compactStringConcatenation>
<compactControlReadability>false</compactControlReadability>
<doubleIndentClassDeclaration>false</doubleIndentClassDeclaration>
<formatXml>true</formatXml>
<indentLocalDefs>false</indentLocalDefs>
<indentPackageBlocks>true</indentPackageBlocks>
<indentSpaces>2</indentSpaces>
<placeScaladocAsterisksBeneathSecondAsterisk>false
</placeScaladocAsterisksBeneathSecondAsterisk>
<preserveDanglingCloseParenthesis>true</preserveDanglingCloseParenthesis>
<preserveSpaceBeforeArguments>false</preserveSpaceBeforeArguments>
<rewriteArrowSymbols>false</rewriteArrowSymbols>
<spaceBeforeColon>false</spaceBeforeColon>
<spaceInsideBrackets>false</spaceInsideBrackets>
<spaceInsideParentheses>false</spaceInsideParentheses>
<spacesWithinPatternBinders>true</spacesWithinPatternBinders>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
......
......@@ -92,7 +92,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected def versionCommand: String = null
protected val versionRegex: Regex = null
protected val versionExitcode = List(0) // Can select multiple
def getVersion: String = {
private def getVersionInternal: String = {
if (versionCommand == null || versionRegex == null) return "N/A"
val stdout = new StringBuffer()
val stderr = new StringBuffer()
......@@ -114,6 +114,12 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
return "N/A"
}
def getVersion: String = {
if (!BiopetCommandLineFunctionTrait.versionCache.contains(executable))
BiopetCommandLineFunctionTrait.versionCache += executable -> getVersionInternal
return BiopetCommandLineFunctionTrait.versionCache(executable)
}
def getThreads(default: Int): Int = {
val maxThreads: Int = config("maxthreads", default = 8)
val threads: Int = config("threads", default = default)
......@@ -128,3 +134,8 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
else return maxThreads
}
}
object BiopetCommandLineFunctionTrait {
import scala.collection.mutable.Map
private val versionCache: Map[String, String] = Map()
}
\ No newline at end of file
package nl.lumc.sasc.biopet.core
import java.util.Properties
import org.apache.log4j.Logger
object BiopetExecutable {
object BiopetExecutable extends Logging {
val modules: Map[String, List[MainCommand]] = Map(
"pipeline" -> List(
......@@ -109,4 +110,17 @@ object BiopetExecutable {
prop.load(getClass.getClassLoader.getResourceAsStream("git.properties"))
prop.getProperty("git.commit.id.abbrev")
}
def checkDirtyBuild(logger: Logger) {
val prop = new Properties()
prop.load(getClass.getClassLoader.getResourceAsStream("git.properties"))
val describeShort = prop.getProperty("git.commit.id.describe-short")
if (describeShort.endsWith("-dirty")) {
logger.warn("**********************************************************")
logger.warn("* This JAR was built while there are uncommited changes. *")
logger.warn("* Reproducible results are *not* guaranteed. *")
logger.warn("**********************************************************")
}
}
checkDirtyBuild(logger)
}
package nl.lumc.sasc.biopet.core
import java.text.SimpleDateFormat
import java.util.Calendar
import org.apache.log4j.Logger
import org.apache.log4j.WriterAppender
import org.apache.log4j.helpers.DateLayout
trait Logging {
protected val logger = Logger.getLogger(getClass.getSimpleName.split("\\$").last)
private[core] val logLayout = new DateLayout() {
val ignoresThrowable = false
def format(event: org.apache.log4j.spi.LoggingEvent): String = {
val calendar: Calendar = Calendar.getInstance
calendar.setTimeInMillis(event.getTimeStamp)
val formatter: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
val formattedDate: String = formatter.format(calendar.getTime)
var logLevel = event.getLevel.toString
while (logLevel.size < 6) logLevel += " "
logLevel + " [" + formattedDate + "] [" + event.getLoggerName + "] " + event.getMessage + "\n"
}
}
private[core] val stderrAppender = new WriterAppender(logLayout, sys.process.stderr)
logger.setLevel(org.apache.log4j.Level.INFO)
logger.addAppender(stderrAppender)
}
package nl.lumc.sasc.biopet.core
import org.broadinstitute.gatk.queue.util.Logging
import org.broadinstitute.gatk.queue.util.{ Logging => GatkLogging }
trait PipelineCommand extends MainCommand with Logging {
trait PipelineCommand extends MainCommand with GatkLogging {
def pipeline = "/" + getClass.getName.stripSuffix("$").replaceAll("\\.", "/") + ".class"
......
package nl.lumc.sasc.biopet.core
import java.text.SimpleDateFormat
import java.util.Calendar
import org.apache.log4j.Logger
import org.apache.log4j.WriterAppender
import org.apache.log4j.helpers.DateLayout
import org.apache.log4j.spi.LoggingEvent
import java.io.File
trait ToolCommand extends MainCommand {
trait ToolCommand extends MainCommand with Logging {
abstract class AbstractArgs {
}
......@@ -45,22 +40,4 @@ trait ToolCommand extends MainCommand {
type Args <: AbstractArgs
type OptParser <: AbstractOptParser
protected val logger = Logger.getLogger(commandName)
private val logLayout = new DateLayout() {
val ignoresThrowable = false
def format(event: org.apache.log4j.spi.LoggingEvent): String = {
val calendar: Calendar = Calendar.getInstance
calendar.setTimeInMillis(event.getTimeStamp)
val formatter: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
val formattedDate: String = formatter.format(calendar.getTime)
var logLevel = event.getLevel.toString
while (logLevel.size < 6) logLevel += " "
logLevel + " [" + formattedDate + "] [" + event.getLoggerName + "] " + event.getMessage + "\n"
}
}
private val stderrAppender = new WriterAppender(logLayout, sys.process.stderr)
logger.setLevel(org.apache.log4j.Level.INFO)
logger.addAppender(stderrAppender)
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package nl.lumc.sasc.biopet.core.config
import java.io.File
import org.broadinstitute.gatk.queue.util.Logging
import scala.language.implicitConversions
trait Configurable extends Logging {
val root: Configurable
......
package nl.lumc.sasc.biopet.extensions
import java.io.File
import scala.sys.process.Process
import scala.sys.process.{ Process, ProcessLogger }
import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import nl.lumc.sasc.biopet.core.config.Configurable
......@@ -71,15 +71,21 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
if (relative) {
// workaround until we have `ln` that works with relative path (i.e. `ln -r`)
"ln -s '" + inRelative + "' '" + outCanonical + "'"
"ln -s " + inRelative + " " + outCanonical
} else {
"ln -s '" + inCanonical + "' '" + outCanonical + "'"
"ln -s " + inCanonical + " " + outCanonical
}
}
override def run {
val process = Process(cmd).run
logger.info("cmd: '" + cmd + "', exitcode: " + process.exitValue)
val stdout = new StringBuffer()
val stderr = new StringBuffer()
val process = Process(cmd).run(ProcessLogger(stdout append _ + "\n", stderr append _ + "\n"))
val exitcode = process.exitValue
if (exitcode != 0) {
throw new Exception("Error creating symbolic link, this was the original message: \n" + stderr)
}
logger.info("cmd: '" + cmd + "', exitcode: " + exitcode)
}
}
......
package nl.lumc.sasc.biopet.extensions
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import java.io.File
class Raxml(val root: Configurable) extends BiopetCommandLineFunction {
override val defaultThreads = 4
override def versionCommand = executable + " -v"
override val versionRegex = """.*version \w* .*""".r
@Input(doc = "Input phy/fasta file", required = true)
var input: File = _
@Argument(doc = "Model", required = true)
var m: String = _
@Argument(doc = "Parsimony seed", required = false)
var p: Option[Int] = config("p")
@Argument(doc = "Bootstrapping seed", required = false)
var b: Option[Int] = config("b")
@Argument(doc = "Number of runs", required = false)
var N: Option[Int] = config("N")
@Argument(doc = "Name of output files", required = true)
var n: String = _
@Argument(doc = "Name of output files", required = true)
var f: String = "d"
@Argument(doc = "Output directory", required = false)
var w: String = jobLocalDir.getAbsolutePath
@Input(required = false)
var t: File = _
@Input(required = false)
var z: File = _
@Output(doc = "Output files", required = false)
private var out: List[File] = Nil