Skip to content
GitLab
Menu
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
ed0f3f1a
Commit
ed0f3f1a
authored
Feb 10, 2015
by
Peter van 't Hof
Browse files
Error cache now also works on executables
parent
fbed4e7c
Changes
4
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala
View file @
ed0f3f1a
...
...
@@ -66,7 +66,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
super
.
freezeFieldValues
()
}
protected
def
checkExecutable
{
protected
[
core
]
def
checkExecutable
{
if
(!
BiopetCommandLineFunctionTrait
.
executableMd5Cache
.
contains
(
executable
))
{
try
if
(
executable
!=
null
)
{
if
(!
BiopetCommandLineFunctionTrait
.
executableCache
.
contains
(
executable
))
{
...
...
@@ -79,8 +79,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
val
file
=
new
File
(
executable
)
executable
=
file
.
getCanonicalPath
}
else
{
logger
.
error
(
"executable: '"
+
executable
+
"' not found, please check config"
)
throw
new
QException
(
"executable: '"
+
executable
+
"' not found, please check config"
)
BiopetQScript
.
addError
(
"executable: '"
+
executable
+
"' not found, please check config"
)
}
BiopetCommandLineFunctionTrait
.
executableCache
+=
oldExecutable
->
executable
BiopetCommandLineFunctionTrait
.
executableCache
+=
executable
->
executable
...
...
@@ -101,9 +100,8 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
case
ioe
:
java.io.IOException
=>
logger
.
warn
(
"Could not use 'which', check on executable skipped: "
+
ioe
)
}
}
val
md5
=
BiopetCommandLineFunctionTrait
.
executableMd5Cache
(
executable
)
if
(
md5
==
null
)
addJobReportBinding
(
"md5sum_exe"
,
md5
)
else
addJobReportBinding
(
"md5sum_exe"
,
"None"
)
val
md5
=
BiopetCommandLineFunctionTrait
.
executableMd5Cache
.
get
(
executable
)
addJobReportBinding
(
"md5sum_exe"
,
md5
.
getOrElse
(
"None"
))
}
final
protected
def
preCmdInternal
{
...
...
@@ -120,6 +118,11 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected
val
versionExitcode
=
List
(
0
)
// Can select multiple
private
def
getVersionInternal
:
String
=
{
if
(
versionCommand
==
null
||
versionRegex
==
null
)
return
"N/A"
val
exe
=
new
File
(
versionCommand
.
trim
.
split
(
" "
)(
0
))
if
(!
exe
.
exists
())
{
//BiopetQScript.addError("executable '" + exe + "' does not exist")
return
"N/A"
}
val
stdout
=
new
StringBuffer
()
val
stderr
=
new
StringBuffer
()
def
outputLog
=
"Version command: \n"
+
versionCommand
+
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
ed0f3f1a
...
...
@@ -33,7 +33,7 @@ trait BiopetQScript extends Configurable with GatkLogging {
var
outputDir
:
String
=
{
val
temp
=
Config
.
getValueFromMap
(
Config
.
global
.
map
,
ConfigValueIndex
(
this
.
configName
,
configPath
,
"output_dir"
))
if
(
temp
.
isEmpty
)
throw
new
IllegalArgumentException
(
"No output_dir defined in config"
)
if
(
temp
.
isEmpty
)
""
else
{
val
t
=
temp
.
get
.
value
.
toString
if
(!
t
.
endsWith
(
"/"
))
t
+
"/"
else
t
...
...
@@ -54,7 +54,8 @@ trait BiopetQScript extends Configurable with GatkLogging {
final
def
script
()
{
outputDir
=
config
(
"output_dir"
)
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
if
(
outputDir
.
isEmpty
)
outputDir
=
new
File
(
"."
).
getAbsolutePath
()
else
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
init
biopetScript
...
...
@@ -63,11 +64,15 @@ trait BiopetQScript extends Configurable with GatkLogging {
case
_
=>
}
for
(
function
<-
functions
)
function
match
{
case
f
:
BiopetCommandLineFunctionTrait
=>
f
.
afterGraph
case
f
:
BiopetCommandLineFunctionTrait
=>
{
f
.
checkExecutable
f
.
afterGraph
}
case
_
=>
}
Config
.
global
.
writeReport
(
qSettings
.
runName
,
outputDir
+
".log/"
+
qSettings
.
runName
)
if
(
new
File
(
outputDir
).
canWrite
)
Config
.
global
.
writeReport
(
qSettings
.
runName
,
outputDir
+
".log/"
+
qSettings
.
runName
)
else
BiopetQScript
.
addError
(
"Output dir: '"
+
outputDir
+
"' is not writeable"
)
BiopetQScript
.
checkErrors
}
...
...
@@ -82,15 +87,23 @@ trait BiopetQScript extends Configurable with GatkLogging {
object
BiopetQScript
extends
Logging
{
private
val
errors
:
ListBuffer
[
Exception
]
=
ListBuffer
()
def
addError
(
msg
:
String
)
:
Unit
=
{
def
addError
(
error
:
String
,
debug
:
String
=
null
)
:
Unit
=
{
val
msg
=
error
+
(
if
(
debug
!=
null
&&
logger
.
isDebugEnabled
)
"; "
+
debug
else
""
)
errors
.
append
(
new
Exception
(
msg
))
}
protected
def
checkErrors
:
Unit
=
{
if
(!
errors
.
isEmpty
)
{
for
(
e
<-
errors
)
{
logger
.
error
(
e
.
getMessage
)
logger
.
debug
(
e
.
getStackTrace
.
mkString
(
"Stack trace:\n"
,
"\n"
,
"\n"
))
logger
.
error
(
"*************************"
)
logger
.
error
(
"Biopet found some errors:"
)
if
(
logger
.
isDebugEnabled
)
{
for
(
e
<-
errors
)
{
logger
.
error
(
e
.
getMessage
)
logger
.
debug
(
e
.
getStackTrace
.
mkString
(
"Stack trace:\n"
,
"\n"
,
"\n"
))
}
}
else
{
val
set
=
errors
.
map
(
_
.
getMessage
).
toSet
set
.
toList
.
sorted
.
foreach
(
logger
.
error
(
_
))
}
throw
new
IllegalStateException
(
"Biopet found errors"
)
}
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Fastqc.scala
View file @
ed0f3f1a
...
...
@@ -51,7 +51,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
override
def
afterGraph
{
this
.
checkExecutable
val
fastqcDir
=
executable
.
substring
(
0
,
executable
.
lastIndexOf
(
"/"
))
val
fastqcDir
=
new
File
(
executable
).
getParent
contaminants
=
contaminants
match
{
// user-defined contaminants file take precedence
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/ConfigUtils.scala
View file @
ed0f3f1a
...
...
@@ -335,8 +335,8 @@ object ConfigUtils extends Logging {
val
exist
=
valueExists
(
value
)
if
(!
exist
)
BiopetQScript
.
addError
(
"Value does not exist but is required, key: "
+
value
.
requestIndex
.
key
+
" module: "
+
value
.
requestIndex
.
module
+
(
if
(
value
.
requestIndex
.
path
!=
Nil
)
" path: "
+
value
.
requestIndex
.
path
.
mkString
(
"->"
)
else
""
))
" module: "
+
value
.
requestIndex
.
module
,
(
if
(
value
.
requestIndex
.
path
!=
Nil
)
" path: "
+
value
.
requestIndex
.
path
.
mkString
(
"->"
)
else
null
))
exist
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment