Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
cc8b2760
Commit
cc8b2760
authored
Oct 28, 2014
by
Peter van 't Hof
Browse files
Build with scaliform
parent
180f28e7
Changes
81
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala
View file @
cc8b2760
...
...
@@ -66,13 +66,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
logger
.
error
(
"executable: '"
+
executable
+
"' not found, please check config"
)
throw
new
QException
(
"executable: '"
+
executable
+
"' not found, please check config"
)
}
val
is
=
new
FileInputStream
(
executable
)
val
cnt
=
is
.
available
val
bytes
=
Array
.
ofDim
[
Byte
](
cnt
)
is
.
read
(
bytes
)
is
.
close
()
val
md5
:
String
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
bytes
).
map
(
"%02X"
.
format
(
_
)).
mkString
.
toLowerCase
val
md5
:
String
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
bytes
).
map
(
"%02X"
.
format
(
_
)).
mkString
.
toLowerCase
addJobReportBinding
(
"md5sum_exe"
,
md5
)
}
catch
{
...
...
@@ -107,7 +107,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
for
(
line
<-
stdout
.
toString
.
split
(
"\n"
)
++
stderr
.
toString
.
split
(
"\n"
))
{
line
match
{
case
versionRegex
(
m
)
=>
return
m
case
_
=>
case
_
=>
}
}
logger
.
warn
(
"getVersion give a exit code "
+
process
.
exitValue
+
" but no version was found, executable correct? \n"
+
outputLog
)
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala
View file @
cc8b2760
...
...
@@ -35,7 +35,7 @@ object BiopetExecutable {
nl
.
lumc
.
sasc
.
biopet
.
tools
.
SageCreateLibrary
,
nl
.
lumc
.
sasc
.
biopet
.
tools
.
SageCreateTagCounts
)
)
/**
* @param args the command line arguments
*/
...
...
@@ -83,7 +83,7 @@ object BiopetExecutable {
args
match
{
case
Array
(
"version"
)
=>
{
println
(
"version: "
+
getVersion
)
println
(
"version: "
+
getVersion
)
}
case
Array
(
module
,
name
,
passArgs
@
_
*)
=>
{
getCommand
(
module
,
name
).
main
(
passArgs
.
toArray
)
...
...
@@ -98,11 +98,11 @@ object BiopetExecutable {
}
}
}
def
getVersion
=
{
getClass
.
getPackage
.
getImplementationVersion
+
" ("
+
getCommitHash
+
")"
}
def
getCommitHash
=
{
val
prop
=
new
Properties
()
prop
.
load
(
getClass
.
getClassLoader
.
getResourceAsStream
(
"git.properties"
))
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala
View file @
cc8b2760
...
...
@@ -8,7 +8,7 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
override
def
afterGraph
{
memoryLimit
=
config
(
"memory_limit"
)
}
override
def
commandLine
:
String
=
{
preCmdInternal
val
cmd
=
super
.
commandLine
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala
View file @
cc8b2760
...
...
@@ -274,16 +274,16 @@ class BiopetQCommandLine extends CommandLineProgram with Logging {
}
private
def
createQueueHeader
()
:
Seq
[
String
]
=
{
Seq
(
"Biopet version: "
+
BiopetExecutable
.
getVersion
,
""
,
"Based on GATK Queue"
,
// String.format("Queue v%s, Compiled %s", getQueueVersion, getBuildTimestamp),
"Copyright (c) 2012 The Broad Institute"
,
"For support and documentation go to http://www.broadinstitute.org/gatk"
)
Seq
(
"Biopet version: "
+
BiopetExecutable
.
getVersion
,
""
,
"Based on GATK Queue"
,
// String.format("Queue v%s, Compiled %s", getQueueVersion, getBuildTimestamp),
"Copyright (c) 2012 The Broad Institute"
,
"For support and documentation go to http://www.broadinstitute.org/gatk"
)
}
private
def
getQueueVersion
:
String
=
{
val
stingResources
:
ResourceBundle
=
TextFormattingUtils
.
loadResourceBundle
(
"StingText"
)
if
(
stingResources
.
containsKey
(
"org.broadinstitute.sting.queue.QueueVersion.version"
))
{
stingResources
.
getString
(
"org.broadinstitute.sting.queue.QueueVersion.version"
)
}
else
{
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
cc8b2760
...
...
@@ -23,15 +23,15 @@ trait BiopetQScript extends Configurable {
def
biopetScript
var
functions
:
Seq
[
QFunction
]
final
def
script
()
{
for
(
file
<-
configfiles
)
globalConfig
.
loadConfigFile
(
file
)
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
init
biopetScript
for
(
function
<-
functions
)
function
match
{
case
f
:
BiopetCommandLineFunctionTrait
=>
f
.
afterGraph
case
_
=>
case
f
:
BiopetCommandLineFunctionTrait
=>
f
.
afterGraph
case
_
=>
}
val
configReport
=
globalConfig
.
getReport
val
configReportFile
=
new
File
(
outputDir
+
qSettings
.
runName
+
".configreport.txt"
)
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
cc8b2760
...
...
@@ -5,18 +5,18 @@ import nl.lumc.sasc.biopet.core.config.Configurable
trait
MultiSampleQScript
extends
BiopetQScript
{
type
LibraryOutput
<:
AbstractLibraryOutput
type
SampleOutput
<:
AbstractSampleOutput
abstract
class
AbstractLibraryOutput
abstract
class
AbstractSampleOutput
{
var
libraries
:
Map
[
String
,
LibraryOutput
]
=
Map
()
def
getAllLibraries
=
libraries
def
getLibrary
(
key
:
String
)
=
libraries
(
key
)
def
getLibrary
(
key
:
String
)
=
libraries
(
key
)
}
var
samplesConfig
:
Map
[
String
,
Any
]
=
Map
()
var
samplesOutput
:
Map
[
String
,
SampleOutput
]
=
Map
()
def
globalSampleDir
:
String
=
outputDir
+
"samples/"
final
def
runSamplesJobs
()
{
samplesConfig
=
config
(
"samples"
)
if
(
samplesConfig
==
null
)
samplesConfig
=
Map
()
...
...
@@ -25,8 +25,7 @@ trait MultiSampleQScript extends BiopetQScript {
if
(!
sample
.
contains
(
"ID"
))
sample
+=
(
"ID"
->
key
)
if
(
sample
(
"ID"
)
==
key
)
{
samplesOutput
+=
key
->
runSingleSampleJobs
(
sample
)
}
else
logger
.
warn
(
"Key is not the same as ID on value for sample"
)
}
else
logger
.
warn
(
"Key is not the same as ID on value for sample"
)
}
else
logger
.
warn
(
"No Samples found in config"
)
}
...
...
@@ -46,8 +45,7 @@ trait MultiSampleQScript extends BiopetQScript {
if
(!
library
.
contains
(
"ID"
))
library
+=
(
"ID"
->
key
)
if
(
library
(
"ID"
)
==
key
)
{
output
+=
key
->
runSingleLibraryJobs
(
library
,
sampleConfig
)
}
else
logger
.
warn
(
"Key is not the same as ID on value for run of sample: "
+
sampleID
)
}
else
logger
.
warn
(
"Key is not the same as ID on value for run of sample: "
+
sampleID
)
}
}
else
logger
.
warn
(
"No runs found in config for sample: "
+
sampleID
)
return
output
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala
View file @
cc8b2760
...
...
@@ -11,51 +11,55 @@ import java.io.File
trait
ToolCommand
extends
MainCommand
{
abstract
class
AbstractArgs
{
}
abstract
class
AbstractOptParser
extends
scopt
.
OptionParser
[
Args
](
commandName
)
{
opt
[
Unit
](
"log_nostderr"
)
foreach
{
_
=>
logger
.
removeAppender
(
stderrAppender
)
}
text
(
"No output to stderr"
)
logger
.
removeAppender
(
stderrAppender
)
}
text
(
"No output to stderr"
)
opt
[
File
](
"log_file"
)
foreach
{
x
=>
logger
.
addAppender
(
new
WriterAppender
(
logLayout
,
new
java
.
io
.
PrintStream
(
x
)))
}
text
(
"Log file"
)
valueName
(
"<file>"
)
logger
.
addAppender
(
new
WriterAppender
(
logLayout
,
new
java
.
io
.
PrintStream
(
x
)))
}
text
(
"Log file"
)
valueName
(
"<file>"
)
opt
[
String
](
'l'
,
"log_level"
)
foreach
{
x
=>
x
.
toLowerCase
match
{
case
"debug"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
DEBUG
)
case
"info"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
INFO
)
case
"warn"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
WARN
)
case
"error"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
ERROR
)
case
_
=>
}
}
text
(
"Log level"
)
validate
{
x
=>
x
match
{
case
"debug"
|
"info"
|
"warn"
|
"error"
=>
success
case
_
=>
failure
(
"Log level must be <debug/info/warn/error>"
)
}
}
x
.
toLowerCase
match
{
case
"debug"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
DEBUG
)
case
"info"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
INFO
)
case
"warn"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
WARN
)
case
"error"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
ERROR
)
case
_
=>
}
}
text
(
"Log level"
)
validate
{
x
=>
x
match
{
case
"debug"
|
"info"
|
"warn"
|
"error"
=>
success
case
_
=>
failure
(
"Log level must be <debug/info/warn/error>"
)
}
}
opt
[
Unit
](
'h'
,
"help"
)
foreach
{
_
=>
System
.
err
.
println
(
this
.
usage
)
sys
.
exit
(
1
)
}
text
(
"Print usage"
)
}
text
(
"Print usage"
)
opt
[
Unit
](
'v'
,
"version"
)
foreach
{
_
=>
System
.
err
.
println
(
"Version: "
+
BiopetExecutable
.
getVersion
)
sys
.
exit
(
1
)
}
text
(
"Print version"
)
}
text
(
"Print version"
)
}
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"
}
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
)
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Config.scala
View file @
cc8b2760
...
...
@@ -44,9 +44,9 @@ class Config(var map: Map[String, Any]) extends Logging {
protected
[
config
]
var
defaultCache
:
Map
[
ConfigValueIndex
,
ConfigValue
]
=
Map
()
def
contains
(
s
:
String
)
:
Boolean
=
map
.
contains
(
s
)
def
contains
(
requestedIndex
:
ConfigValueIndex
,
freeVar
:
Boolean
)
:
Boolean
=
contains
(
requestedIndex
.
module
,
requestedIndex
.
path
,
requestedIndex
.
key
,
freeVar
)
def
contains
(
requestedIndex
:
ConfigValueIndex
,
freeVar
:
Boolean
)
:
Boolean
=
contains
(
requestedIndex
.
module
,
requestedIndex
.
path
,
requestedIndex
.
key
,
freeVar
)
def
contains
(
requestedIndex
:
ConfigValueIndex
)
:
Boolean
=
contains
(
requestedIndex
.
module
,
requestedIndex
.
path
,
requestedIndex
.
key
,
true
)
def
contains
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
freeVar
:
Boolean
=
true
)
:
Boolean
=
{
def
contains
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
freeVar
:
Boolean
=
true
)
:
Boolean
=
{
val
requestedIndex
=
ConfigValueIndex
(
module
,
path
,
key
,
freeVar
)
if
(
notFoundCache
.
contains
(
requestedIndex
))
return
false
else
if
(
foundCache
.
contains
(
requestedIndex
))
return
true
...
...
@@ -62,7 +62,7 @@ class Config(var map: Map[String, Any]) extends Logging {
}
}
protected
[
config
]
def
apply
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
default
:
Any
=
null
,
freeVar
:
Boolean
=
true
)
:
ConfigValue
=
{
protected
[
config
]
def
apply
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
default
:
Any
=
null
,
freeVar
:
Boolean
=
true
)
:
ConfigValue
=
{
val
requestedIndex
=
ConfigValueIndex
(
module
,
path
,
key
)
if
(
contains
(
requestedIndex
,
freeVar
))
return
foundCache
(
requestedIndex
)
else
if
(
default
!=
null
)
{
...
...
@@ -133,7 +133,7 @@ object Config {
}
def
mergeConfigs
(
config1
:
Config
,
config2
:
Config
)
:
Config
=
new
Config
(
mergeMaps
(
config1
.
map
,
config2
.
map
))
private
def
jsonToMap
(
json
:
Json
)
:
Map
[
String
,
Any
]
=
{
var
output
:
Map
[
String
,
Any
]
=
Map
()
if
(
json
.
isObject
)
{
...
...
@@ -159,8 +159,8 @@ object Config {
else
return
num
.
toLong
}
else
throw
new
IllegalStateException
(
"Config value type not supported, value: "
+
json
)
}
private
def
getMapFromPath
(
map
:
Map
[
String
,
Any
],
path
:
List
[
String
])
:
Map
[
String
,
Any
]
=
{
private
def
getMapFromPath
(
map
:
Map
[
String
,
Any
],
path
:
List
[
String
])
:
Map
[
String
,
Any
]
=
{
var
returnMap
:
Map
[
String
,
Any
]
=
map
for
(
m
<-
path
)
{
if
(!
returnMap
.
contains
(
m
))
return
Map
()
...
...
@@ -168,8 +168,8 @@ object Config {
}
return
returnMap
}
def
getValueFromMap
(
map
:
Map
[
String
,
Any
],
index
:
ConfigValueIndex
)
:
Option
[
ConfigValue
]
=
{
def
getValueFromMap
(
map
:
Map
[
String
,
Any
],
index
:
ConfigValueIndex
)
:
Option
[
ConfigValue
]
=
{
var
submodules
=
index
.
path
.
reverse
while
(!
submodules
.
isEmpty
)
{
var
submodules2
=
submodules
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/ConfigValueIndex.scala
View file @
cc8b2760
package
nl.lumc.sasc.biopet.core.config
class
ConfigValueIndex
(
val
module
:
String
,
val
path
:
List
[
String
],
val
key
:
String
,
val
freeVar
:
Boolean
=
true
)
{
class
ConfigValueIndex
(
val
module
:
String
,
val
path
:
List
[
String
],
val
key
:
String
,
val
freeVar
:
Boolean
=
true
)
{
override
def
toString
=
"Module = "
+
module
+
", path = "
+
path
+
", key = "
+
key
+
", freeVar = "
+
freeVar
}
object
ConfigValueIndex
{
private
var
cache
:
Map
[(
String
,
List
[
String
]
,
String
)
,
ConfigValueIndex
]
=
Map
()
def
apply
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
freeVar
:
Boolean
=
true
)
:
ConfigValueIndex
=
{
def
apply
(
module
:
String
,
path
:
List
[
String
],
key
:
String
,
freeVar
:
Boolean
=
true
)
:
ConfigValueIndex
=
{
if
(!
cache
.
contains
(
module
,
path
,
key
))
cache
+=
((
module
,
path
,
key
)
->
new
ConfigValueIndex
(
module
,
path
,
key
,
freeVar
))
return
cache
(
module
,
path
,
key
)
}
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
View file @
cc8b2760
...
...
@@ -9,13 +9,13 @@ trait Configurable extends Logging {
def
configPath
:
List
[
String
]
=
if
(
root
!=
null
)
root
.
configFullPath
else
List
()
protected
lazy
val
configName
=
getClass
.
getSimpleName
.
toLowerCase
protected
lazy
val
configFullPath
=
configName
::
configPath
var
defaults
:
scala.collection.mutable.Map
[
String
,
Any
]
=
if
(
root
!=
null
)
scala
.
collection
.
mutable
.
Map
(
root
.
defaults
.
toArray
:_
*
)
else
scala
.
collection
.
mutable
.
Map
()
var
defaults
:
scala.collection.mutable.Map
[
String
,
Any
]
=
if
(
root
!=
null
)
scala
.
collection
.
mutable
.
Map
(
root
.
defaults
.
toArray
:
_
*
)
else
scala
.
collection
.
mutable
.
Map
()
val
config
=
new
ConfigFuntions
protected
class
ConfigFuntions
{
def
apply
(
key
:
String
,
default
:
Any
=
null
,
submodule
:
String
=
null
,
required
:
Boolean
=
false
,
freeVar
:
Boolean
=
true
)
:
ConfigValue
=
{
def
apply
(
key
:
String
,
default
:
Any
=
null
,
submodule
:
String
=
null
,
required
:
Boolean
=
false
,
freeVar
:
Boolean
=
true
)
:
ConfigValue
=
{
val
m
=
if
(
submodule
!=
null
)
submodule
else
configName
val
p
=
if
(
submodule
!=
null
)
configName
::
configPath
else
configPath
val
d
=
{
...
...
@@ -31,15 +31,15 @@ trait Configurable extends Logging {
if
(
d
==
null
)
return
globalConfig
(
m
,
p
,
key
,
freeVar
)
else
return
globalConfig
(
m
,
p
,
key
,
d
,
freeVar
)
}
def
contains
(
key
:
String
,
submodule
:
String
=
null
,
freeVar
:
Boolean
=
true
)
=
{
def
contains
(
key
:
String
,
submodule
:
String
=
null
,
freeVar
:
Boolean
=
true
)
=
{
val
m
=
if
(
submodule
!=
null
)
submodule
else
configName
val
p
=
if
(
submodule
!=
null
)
configName
::
configPath
else
configPath
globalConfig
.
contains
(
m
,
p
,
key
,
freeVar
)
||
!(
Config
.
getValueFromMap
(
defaults
.
toMap
,
ConfigValueIndex
(
m
,
p
,
key
,
freeVar
))
==
None
)
}
}
implicit
def
configValue2file
(
value
:
ConfigValue
)
:
File
=
if
(
value
!=
null
)
new
File
(
Configurable
.
any2string
(
value
.
value
))
else
null
implicit
def
configValue2string
(
value
:
ConfigValue
)
:
String
=
if
(
value
!=
null
)
Configurable
.
any2string
(
value
.
value
)
else
null
implicit
def
configValue2long
(
value
:
ConfigValue
)
:
Long
=
if
(
value
!=
null
)
Configurable
.
any2long
(
value
.
value
)
else
0
...
...
@@ -104,7 +104,7 @@ object Configurable extends Logging {
case
_
=>
throw
new
IllegalStateException
(
"Value '"
+
any
+
"' is not an int"
)
}
}
def
any2float
(
any
:
Any
)
:
Float
=
{
any
match
{
case
f
:
Double
=>
return
f
.
toFloat
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Cufflinks.scala
View file @
cc8b2760
...
...
@@ -16,7 +16,7 @@ import nl.lumc.sasc.biopet.core.config.Configurable
* Written based on cufflinks version v2.2.1.
*/
class
Cufflinks
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
/** default executable */
executable
=
config
(
"exe"
,
default
=
"cufflinks"
)
...
...
@@ -177,7 +177,7 @@ class Cufflinks(val root: Configurable) extends BiopetCommandLineFunction {
override
def
versionCommand
=
executable
def
cmdLine
=
{
required
(
executable
)
+
required
(
executable
)
+
required
(
"--output-dir"
,
output_dir
)
+
optional
(
"--num-threads"
,
num_threads
)
+
optional
(
"--seed"
,
seed
)
+
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Fastqc.scala
View file @
cc8b2760
...
...
@@ -11,7 +11,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
@Input
(
doc
=
"Contaminants"
,
required
=
false
)
var
contaminants
:
File
=
_
@Input
(
doc
=
"Adapters"
,
required
=
false
)
var
adapters
:
File
=
_
...
...
@@ -39,11 +39,11 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
val
fastqcDir
=
executable
.
substring
(
0
,
executable
.
lastIndexOf
(
"/"
))
val
defaultContams
=
getVersion
match
{
case
"v0.11.2"
=>
new
File
(
fastqcDir
+
"/Configuration/contaminant_list.txt"
)
case
_
=>
new
File
(
fastqcDir
+
"/Contaminants/contaminant_list.txt"
)
case
_
=>
new
File
(
fastqcDir
+
"/Contaminants/contaminant_list.txt"
)
}
val
defaultAdapters
=
getVersion
match
{
case
"v0.11.2"
=>
new
File
(
fastqcDir
+
"/Configuration/adapter_list.txt"
)
case
_
=>
null
case
_
=>
null
}
contaminants
=
config
(
"contaminants"
,
default
=
defaultContams
)
}
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala
View file @
cc8b2760
...
...
@@ -83,12 +83,12 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
}
}
object
Ln
{
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
,
relative
:
Boolean
=
true
)
:
Ln
=
{
val
ln
=
new
Ln
(
root
)
ln
.
in
=
input
ln
.
out
=
output
ln
.
relative
=
relative
return
ln
}
}
object
Ln
{
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
,
relative
:
Boolean
=
true
)
:
Ln
=
{
val
ln
=
new
Ln
(
root
)
ln
.
in
=
input
ln
.
out
=
output
ln
.
relative
=
relative
return
ln
}
}
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Seqstat.scala
View file @
cc8b2760
...
...
@@ -27,7 +27,7 @@ class Seqstat(val root: Configurable) extends BiopetCommandLineFunction {
executable
=
config
(
"exe"
,
default
=
"fastq-seqstat"
)
def
cmdLine
=
required
(
executable
)
+
required
(
input
)
+
" > "
+
required
(
output
)
def
getSummary
:
Json
=
{
val
json
=
Parse
.
parseOption
(
Source
.
fromFile
(
output
).
mkString
)
if
(
json
.
isEmpty
)
return
jNull
...
...
@@ -42,7 +42,7 @@ object Seqstat {
seqstat
.
output
=
output
return
seqstat
}
def
apply
(
root
:
Configurable
,
fastqfile
:
File
,
outDir
:
String
)
:
Seqstat
=
{
val
seqstat
=
new
Seqstat
(
root
)
val
ext
=
fastqfile
.
getName
.
substring
(
fastqfile
.
getName
.
lastIndexOf
(
"."
))
...
...
@@ -52,7 +52,7 @@ object Seqstat {
}
def
mergeSummaries
(
jsons
:
List
[
Json
])
:
Json
=
{
def
addJson
(
json
:
Json
,
total
:
Map
[
String
,
Long
])
{
def
addJson
(
json
:
Json
,
total
:
Map
[
String
,
Long
])
{
for
(
key
<-
json
.
objectFieldsOrEmpty
)
{
if
(
json
.
field
(
key
).
get
.
isObject
)
addJson
(
json
.
field
(
key
).
get
,
total
)
else
if
(
json
.
field
(
key
).
get
.
isNumber
)
{
...
...
@@ -63,53 +63,52 @@ object Seqstat {
}
else
if
(
key
==
"len_max"
)
{
if
(
total
(
key
)
<
number
)
total
(
key
)
=
number
}
else
total
(
key
)
+=
number
}
else
total
+=
(
key
->
number
)
}
else
total
+=
(
key
->
number
)
}
}
}
var
basesTotal
:
Map
[
String
,
Long
]
=
Map
()
var
readsTotal
:
Map
[
String
,
Long
]
=
Map
()
var
encoding
:
Set
[
Json
]
=
Set
()
for
(
json
<-
jsons
)
{
encoding
+=
json
.
fieldOrEmptyString
(
"qual_encoding"
)
val
bases
=
json
.
fieldOrEmptyObject
(
"bases"
)
addJson
(
bases
,
basesTotal
)
val
reads
=
json
.
fieldOrEmptyObject
(
"reads"
)
addJson
(
reads
,
readsTotal
)
}
return
(
"bases"
:=
(
(
"num_n"
:=
basesTotal
(
"num_n"
))
->:
(
"num_total"
:=
basesTotal
(
"num_total"
))
->:
(
"num_qual_gte"
:=
(
(
"1"
:=
basesTotal
(
"1"
))
->:
(
"10"
:=
basesTotal
(
"10"
))
->:
(
"20"
:=
basesTotal
(
"20"
))
->:
(
"30"
:=
basesTotal
(
"30"
))
->:
(
"40"
:=
basesTotal
(
"40"
))
->:
(
"50"
:=
basesTotal
(
"50"
))
->:
(
"60"
:=
basesTotal
(
"60"
))
->:
jEmptyObject
)
)
->:
jEmptyObject
))
->:
(
"reads"
:=
(
(
"num_with_n"
:=
readsTotal
(
"num_with_n"
))
->:
(
"num_total"
:=
readsTotal
(
"num_total"
))
->:
(
"len_min"
:=
readsTotal
(
"len_min"
))
->:
(
"len_max"
:=
readsTotal
(
"len_max"
))
->:
(
"num_mean_qual_gte"
:=
(
(
"1"
:=
readsTotal
(
"1"
))
->:
(
"10"
:=
readsTotal
(
"10"
))
->:
(
"20"
:=
readsTotal
(
"20"
))
->:
(
"30"
:=
readsTotal
(
"30"
))
->:
(
"40"
:=
readsTotal
(
"40"
))
->:
(
"50"
:=
readsTotal
(
"50"
))
->:
(
"60"
:=
readsTotal
(
"60"
))
->:
jEmptyObject
)
)
->:
jEmptyObject
))
->:
(
"qual_encoding"
:=
encoding
.
head
)
->:
jEmptyObject
(
"num_n"
:=
basesTotal
(
"num_n"
))
->:
(
"num_total"
:=
basesTotal
(
"num_total"
))
->:
(
"num_qual_gte"
:=
(
(
"1"
:=
basesTotal
(
"1"
))
->:
(
"10"
:=
basesTotal
(
"10"
))
->:
(
"20"
:=
basesTotal
(
"20"
))
->:
(
"30"
:=
basesTotal
(
"30"
))
->:
(
"40"
:=
basesTotal
(
"40"
))
->:
(
"50"
:=
basesTotal
(
"50"
))
->:
(
"60"
:=
basesTotal
(
"60"
))
->:
jEmptyObject
)
)
->:
jEmptyObject
))
->:
(
"reads"
:=
(
(
"num_with_n"
:=
readsTotal
(
"num_with_n"
))
->:
(
"num_total"
:=
readsTotal
(
"num_total"
))
->:
(
"len_min"
:=
readsTotal
(
"len_min"
))
->:
(
"len_max"
:=
readsTotal
(
"len_max"
))
->:
(
"num_mean_qual_gte"
:=
(
(
"1"
:=
readsTotal
(
"1"
))
->:
(
"10"
:=
readsTotal
(
"10"
))
->:
(
"20"
:=
readsTotal
(
"20"
))
->:
(
"30"
:=
readsTotal
(
"30"
))
->:
(
"40"
:=
readsTotal
(
"40"
))
->:
(
"50"
:=
readsTotal
(
"50"
))
->:
(
"60"
:=
readsTotal
(
"60"
))
->:
jEmptyObject
)
)
->:
jEmptyObject
))
->:
(
"qual_encoding"
:=
encoding
.
head
)
->:
jEmptyObject
}
}
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/aligners/Bowtie.scala
View file @
cc8b2760
...
...
@@ -22,7 +22,7 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction {
override
val
versionRegex
=
""".*[Vv]ersion:? (.*)"""
.
r
override
val
versionExitcode
=
List
(
0
,
1
)
override
def
versionCommand
=
executable
+
" --version"
override
val
defaultVmem
=
"6G"
override
val
defaultThreads
=
8
...
...
@@ -36,7 +36,7 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction {
var
maxbts
:
Option
[
Int
]
=
config
(
"maxbts"
)
var
strata
:
Boolean
=
config
(
"strata"
)
var
maqerr
:
Option
[
Int
]
=
config
(
"maqerr"
)
def
cmdLine
=
{
required
(
executable
)
+
optional
(
"--threads"
,
nCoresRequest
)
+
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/aligners/Star.scala
View file @
cc8b2760
...
...
@@ -81,7 +81,7 @@ class Star(val root: Configurable) extends BiopetCommandLineFunction {
}