Commit b26d817a authored by Peter van 't Hof's avatar Peter van 't Hof

Remove submodules

parent ffe46a1f
/target/
\ No newline at end of file
<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>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet-Framework</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<name>Biopet-Framework</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.1.0</version>
<relativePath>../</relativePath>
</parent>
<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>org.broadinstitute.sting.queue.QCommandLine</app.main.class>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.2</artifactId>
<version>2.0.M4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.broadinstitute.sting</groupId>
<artifactId>queue-package</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<!-- <arg>-make:transitive</arg>-->
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<id>default-test</id>
Disable the default-test by putting it in phase none
<phase>none</phase>
</execution>
</executions>
</plugin>-->
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<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>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
</project>
package nl.lumc.sasc.biopet.core
import scala.util.parsing.json._
import java.io.File
import org.broadinstitute.sting.queue.util.Logging
class Config(var map: Map[String,Any]) extends Logging {
def this() = {
this(Map())
logger.info("Init phase of config")
loadDefaultConfig()
}
def loadDefaultConfig() {
var globalFile: String = System.getenv("QUEUE_CONFIG")
if (globalFile != null) {
var file: File = new File(globalFile)
if (file.exists()) 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")
}
def contains(s:String) : Boolean = map.contains(s)
def loadConfigFile(configFile:File) {
var returnMap: Map[String,Any] = Map()
var configJson = JSON.parseFull(scala.io.Source.fromFile(configFile).mkString)
this.logger.debug("Jsonfile: " + configJson)
returnMap = Config.valueToMap(configJson.get)
map = Config.mergMaps(returnMap, map)
this.logger.debug("config: " + map)
}
def get(s:String) : Any = map(s)
def get(s:String, default:Any) : Any = if (contains(s)) get(s) else default
def getAsString(s:String) : String = map(s).toString
def getAsString(s:String, default:String) : String = if (contains(s)) getAsString(s) else default
def getAsInt(s:String) : Int = {
map(s) match {
case i:Double => return i.toInt
case i:Int => return i
case i:String => {
logger.warn("Value '" + s + "' is a string insteadof int in json file, trying auto convert")
return i.toInt
}
case _ => throw new IllegalStateException("Value '" + s + "' is not an int")
}
}
def getAsInt(s:String, default:Int) : Int = if (contains(s)) getAsInt(s) else default
def getAsDouble(s:String) : Double = {
map(s) match {
case d:Double => return d
case d:Int => return d.toDouble
case d:String => {
logger.warn("Value '" + s + "' is a string insteadof int in json file, trying auto convert")
return d.toDouble
}
case _ => throw new IllegalStateException("Value '" + s + "' is not an int")
}
}
def getAsDouble(s:String, default:Double) : Double = if (contains(s)) getAsDouble(s) else default
def getAsBoolean(s:String) : Boolean = {
map(s) match {
case b:Boolean => b
case b:String => {
logger.warn("Value '" + s + "' is a string insteadof boolean in json file, trying auto convert")
return b.contains("true")
}
case b:Int => {
logger.warn("Value '" + s + "' is a int insteadof boolean in json file, trying auto convert")
(b > 0)
}
case _ => throw new IllegalStateException("Value '" + s + "' is not an boolean")
}
}
def getAsBoolean(s:String, default:Boolean) : Boolean = if (contains(s)) getAsBoolean(s) else default
def getAsList(s:String) : List[Any] = {
map(s) match {
case l:List[_] => return l
case _ => throw new IllegalStateException("Value '" + s + "' is not an List")
}
}
def getAsList(s:String, default:List[Any]) : List[Any] = if (contains(s)) getAsList(s) else default
def getAsListOfStrings(s:String) : List[String] = {
var l: List[String] = Nil
for (v <- getAsList(s)) l :+= v.toString
return l
}
def getAsListOfStrings(s:String, default:List[String]) : List[String] = if (contains(s)) getAsListOfStrings(s) else default
def getAsMap(s:String) : Map[String,Any] = {
map(s) match {
case m:Map[_,_] => return Config.valueToMap(m)
case _ => throw new IllegalStateException("Value '" + s + "' is not an Map")
}
}
def getAsMap(s:String, default:Map[String,Any]) : Map[String,Any] = if (contains(s)) getAsMap(s) else default
def getAsConfig(s:String, default:Map[String,Any]) : Config = if (contains(s)) new Config(getAsMap(s)) else new Config(default)
def getAsConfig(s:String) : Config = if (contains(s)) new Config(getAsMap(s)) else new Config(Map())
override def toString() : String = map.toString
}
object Config {
def valueToMap(input:Any) : Map[String,Any] = {
var ouputMap: Map[String,Any] = Map()
input match {
case m:Map[_, _] => {
for ((k,v) <- m) {
k match {
case s:String => ouputMap += (s -> v)
case _ => throw new IllegalStateException("Key of map '" + m + "' is not an String")
}
}
}
case _ => throw new IllegalStateException("Value '" + input + "' is not an Map")
}
return ouputMap
}
def mergMaps(map1:Map[String,Any],map2:Map[String,Any]) : Map[String,Any] = {
var newMap: Map[String,Any] = Map()
for (key <- map1.keySet.++(map2.keySet)) {
if (map1.contains(key) && !map2.contains(key)) newMap += (key -> map1(key))
else if (!map1.contains(key) && map2.contains(key)) newMap += (key -> map2(key))
else if (map1.contains(key) && map2.contains(key)) {
map1(key) match {
case m1:Map[_,_] => {
map2(key) match {
case m2:Map[_,_] => newMap += (key -> mergMaps(Config.valueToMap(m1),Config.valueToMap(m2)))
case _ => newMap += (key -> map1(key))
}
}
case _ => newMap += (key -> map1(key))
}
}
}
return newMap
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.wrappers
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class Bwa(private var globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "bwa"
var config: Config = globalConfig.getAsConfig("bwa")
@Argument(doc="Bwa executeble", shortName="Bwa_Exe")
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 = _
@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 = config.getAsBoolean("M", true)
def commandLine = {
required(bwa_exe) +
required("mem") +
optional("-t", nCoresRequest) +
optional("-R", RG) +
conditional(M, "-M") +
required(referenceFile) +
required(R1) +
optional(R2) +
" > " + required(output)
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.wrappers
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
import scala.io.Source._
import scala.sys.process._
class Cutadapt(private var globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
analysisName = "cutadapt"
var config: Config = globalConfig.getAsConfig("cutadapt")
@Input(doc="Cutadapt exe", required=false)
var cutadapt_exe: File = new File(config.getAsString("exe","/usr/local/bin/cutadapt"))
@Input(doc="Input fastq file") var fastq_input: File = _
@Input(doc="Fastq contams file", required=false) var contams_file: File = _
@Output(doc="Output fastq file") var fastq_output: File = _
var opt_adapter: Set[String] = config.getAsListOfStrings("adapter", Nil).to[Set]
var opt_anywhere: Set[String] = config.getAsListOfStrings("anywhere", Nil).to[Set]
var opt_front: Set[String] = config.getAsListOfStrings("front", Nil).to[Set]
var opt_discard: Boolean = config.getAsBoolean("discard",false)
var opt_minimum_length: String = config.getAsInt("minimum_length", 1).toString
var opt_maximum_length: String = if (config.contains("maximum_length")) config.getAsInt("maximum_length").toString else null
def commandLine = {
this.addJobReportBinding("version", getVersion)
this.getContamsFromFile
if (!opt_adapter.isEmpty || !opt_anywhere.isEmpty || !opt_front.isEmpty) {
required(cutadapt_exe) +
// options
repeat("-a", opt_adapter) +
repeat("-b", opt_anywhere) +
repeat("-g", opt_front) +
conditional(opt_discard, "--discard") +
optional("-m", opt_minimum_length) +
optional("-M", opt_maximum_length) +
// input / output
required(fastq_input) +
" > " + required(fastq_output)
} else {
"ln -sf " +
required(fastq_input) +
required(fastq_output)
}
}
def getContamsFromFile {
if (contams_file != null) {
if (contams_file.exists()) {
for (line <- fromFile(contams_file).getLines) {
var s: String = line.substring(line.lastIndexOf("\t")+1, line.size)
opt_adapter += s
logger.info("Adapter: " + s + " found in: " + fastq_input)
}
} else logger.warn("File : " + contams_file + " does not exist")
}
}
private var version: String = _
def getVersion : String = {
if (version == null) {
val v: String = (cutadapt_exe + " --version").!!.replace("\n", "")
if (!v.isEmpty) version = v
}
return version
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.wrappers
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
import scala.sys.process._
class Fastqc(private var globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "fastqc"
var config: Config = globalConfig.getAsConfig("fastqc")
@Input(doc="fastqc executeble", shortName="Fastqc_Exe")
var fastqc_exe: File = new File(config.getAsString("exe","/usr/local/FastQC/FastQC_v0.10.1/fastqc"))
@Argument(doc="java vm executeble", shortName="Java_Exe", required=false)
var java_exe: String = globalConfig.getAsConfig("java").getAsString("exe", "java")
@Argument(doc="kmers", required=false) var kmers: Int = config.getAsInt("kmers", 5)
@Argument(doc="threads", required=false) var threads: Int = config.getAsInt("threads", 4)
@Argument(doc="quiet", required=false) var quiet: Boolean = config.getAsBoolean("quiet", false)
@Argument(doc="noextract", required=false) var noextract: Boolean = config.getAsBoolean("noextract", false)
@Argument(doc="nogroup", required=false) var nogroup: Boolean = config.getAsBoolean("nogroup", false)
@Input(doc="Contaminants", required=false)
var contaminants: File = new File(config.getAsString("contaminants",fastqc_exe.getParent() + "/Contaminants/contaminant_list.txt"))
@Input(doc="Fastq file", shortName="FQ") var fastqfile: File = _
@Output(doc="Output", shortName="out") var output: File = _
def commandLine = {
this.addJobReportBinding("version", getVersion)
if (config.contains("fastqc_exe")) fastqc_exe = new File(config.get("fastqc_exe").toString)
this.nCoresRequest = Option(threads)
required(fastqc_exe) +
optional("--java", java_exe) +
optional("--threads",threads) +
optional("--contaminants",contaminants) +
optional("--kmers",kmers) +
conditional(nogroup, "--nogroup") +
conditional(noextract, "--noextract") +
conditional(quiet, "--quiet") +
required("-o",output.getParent()) +
required(fastqfile) +
required(" > ", output, escape=false)
}
private var version: String = _
def getVersion : String = {
val REG = """FastQC (.*)""".r
if (version == null) for (line <- (fastqc_exe + " --version").!!.split("\n")) {
line match {
case REG(m) => {
version = m
return version
}
case _ =>
}
}
return version
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.wrappers
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
import scala.io.Source._
import scala.sys.process._
class Sickle(private var globalConfig: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "sickle"
var config: Config = globalConfig.getAsConfig("sickle")
@Input(doc="Sickle exe", required=false) var sickle_exe: File = new File("/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)
var defaultQualityType: String = config.getAsString("defaultqualitytype", "sanger")
def commandLine = {
this.addJobReportBinding("version", getVersion)
this.getQualityTypeFromFile
if (qualityType == null && defaultQualityType != null) qualityType = defaultQualityType
var cmd: String = required(sickle_exe)
if (input_R2 != null) {
cmd += required("pe") +
required("-r", input_R2) +
required("-p", output_R2) +
required("-s", output_singles)
} else cmd += required("se")
cmd +
required("-f", input_R1) +
required("-f", input_R1) +
required("-t", qualityType) +
required("-o", output_R1) +
" > " + required(output_stats)
}
def getQualityTypeFromFile {
if (qualityType == null && qualityTypeFile != null) {
if (qualityTypeFile.exists()) {
for (line <- fromFile(qualityTypeFile).getLines) {
var s: String = line.substring(0,line.lastIndexOf("\t"))
qualityType = s
}
} else logger.warn("File : " + qualityTypeFile + " does not exist")
}
}
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
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.wrappers
import nl.lumc.sasc.biopet.core._
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline._
import java.io.File
class Zcat(private var config: Config) extends CommandLineFunction {
def this() = this(new Config(Map()))
this.analysisName = "zcat"
@Input(doc="Zipped file") var in: File = _
@Output(doc="Unzipped file") var out: File = _
def commandLine = "zcat %s > %s".format(in, out)
}
\ No newline at end of file
/target/
\ No newline at end of file
<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>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Flexiprep</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<name>Flexiprep</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.1.0</version>
<relativePath>../</relativePath>
</parent>
<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>org.broadinstitute.sting.queue.QCommandLine</app.main.class>
</properties>
<dependencies>
<!-- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.2</artifactId>
<version>2.0.M4</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet-Framework</artifactId>
<version>0.1.0</version>
</dependency>
<!-- <dependency>
<groupId>org.broadinstitute.sting</groupId>
<artifactId>queue-package</artifactId>
<version>3.1</version>
</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<id>default-test</id>
Disable the default-test by putting it in phase none
<phase>none</phase>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<finalName>${project.artifactId}-${project.version}</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>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
#!/bin/bash
JAVA_EXE=java
JAR_FILE=`dirname $0`/target/Flexiprep*.jar
PIPELINE_SCRIPT=`dirname $0`/../flexiprep/src/main/java/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala
$JAVA_EXE $JAVA_OPTIONS -jar $JAR_FILE -S $PIPELINE_SCRIPT $@
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) +