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
f62be586
Commit
f62be586
authored
Jul 01, 2015
by
Wai Yi Leung
Browse files
Merge branch 'feature-fix_java_version' into 'develop'
Feature fix java version Fix for #144 See merge request !185
parents
9a37f7d6
b563034b
Changes
4
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala
View file @
f62be586
...
...
@@ -37,7 +37,8 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
var
vmem
:
Option
[
String
]
=
config
(
"vmem"
)
protected
val
defaultCoreMemory
:
Double
=
1.0
var
vmemFactor
:
Double
=
config
(
"vmem_factor"
,
default
=
1.5
)
protected
val
defaultVmemFactor
:
Double
=
1.4
var
vmemFactor
:
Double
=
config
(
"vmem_factor"
,
default
=
defaultVmemFactor
)
var
residentFactor
:
Double
=
config
(
"resident_factor"
,
default
=
1.2
)
...
...
@@ -156,7 +157,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected
val
versionExitcode
=
List
(
0
)
/** Executes the version command */
private
def
getVersionInternal
:
Option
[
String
]
=
{
private
[
core
]
def
getVersionInternal
()
:
Option
[
String
]
=
{
if
(
versionCommand
==
null
||
versionRegex
==
null
)
None
else
getVersionInternal
(
versionCommand
,
versionRegex
)
}
/** Executes the version command */
private
[
core
]
def
getVersionInternal
(
versionCommand
:
String
,
versionRegex
:
Regex
)
:
Option
[
String
]
=
{
if
(
versionCommand
==
null
||
versionRegex
==
null
)
return
None
val
exe
=
new
File
(
versionCommand
.
trim
.
split
(
" "
)(
0
))
if
(!
exe
.
exists
())
return
None
...
...
@@ -221,7 +228,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
/** stores global caches */
object
BiopetCommandLineFunctionTrait
{
import
scala.collection.mutable.Map
private
val
versionCache
:
Map
[
String
,
String
]
=
Map
()
private
[
core
]
val
versionCache
:
Map
[
String
,
String
]
=
Map
()
private
[
core
]
val
executableMd5Cache
:
Map
[
String
,
String
]
=
Map
()
private
val
executableCache
:
Map
[
String
,
String
]
=
Map
()
private
[
core
]
val
executableCache
:
Map
[
String
,
String
]
=
Map
()
}
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala
View file @
f62be586
...
...
@@ -25,6 +25,8 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
javaGCHeapFreeLimit
=
config
(
"java_gc_heap_freelimit"
)
javaGCTimeLimit
=
config
(
"java_gc_timelimit"
)
override
protected
val
defaultVmemFactor
:
Double
=
2.0
/** Constructs java opts, this adds scala threads */
override
def
javaOpts
=
super
.
javaOpts
+
optional
(
"-Dscala.concurrent.context.numThreads="
,
threads
,
spaceSeparated
=
false
,
escape
=
false
)
...
...
@@ -37,6 +39,19 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
return
cmd
}
def
javaVersionCommand
:
String
=
executable
+
" -version"
def
getJavaVersion
:
Option
[
String
]
=
{
if
(!
BiopetCommandLineFunctionTrait
.
executableCache
.
contains
(
executable
))
preProcesExecutable
if
(!
BiopetCommandLineFunctionTrait
.
versionCache
.
contains
(
javaVersionCommand
))
getVersionInternal
(
javaVersionCommand
,
"""java version "(.*)""""
.
r
)
match
{
case
Some
(
version
)
=>
BiopetCommandLineFunctionTrait
.
versionCache
+=
javaVersionCommand
->
version
case
_
=>
}
BiopetCommandLineFunctionTrait
.
versionCache
.
get
(
javaVersionCommand
)
}
override
def
setupRetry
()
:
Unit
=
{
super
.
setupRetry
()
javaMemoryLimit
=
memoryLimit
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
f62be586
...
...
@@ -74,11 +74,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
case
f
:
BiopetJavaCommandLineFunction
=>
{
f
.
configName
->
Map
(
"version"
->
f
.
getVersion
.
getOrElse
(
None
),
"java_md5"
->
BiopetCommandLineFunctionTrait
.
executableMd5Cache
.
getOrElse
(
f
.
executable
,
None
),
"jar_md5"
->
SummaryQScript
.
md5sumCache
.
getOrElse
(
f
.
jarFile
,
None
))
"java_version"
->
f
.
getJavaVersion
,
"jar_path"
->
f
.
jarFile
)
}
case
f
:
BiopetCommandLineFunction
=>
{
f
.
configName
->
Map
(
"version"
->
f
.
getVersion
.
getOrElse
(
None
),
"md5"
->
BiopetCommandLineFunctionTrait
.
executableMd5Cache
.
getOrElse
(
f
.
executable
,
None
))
"md5"
->
BiopetCommandLineFunctionTrait
.
executableMd5Cache
.
getOrElse
(
f
.
executable
,
None
),
"path"
->
f
.
executable
)
}
case
_
=>
throw
new
IllegalStateException
(
"This should not be possible"
)
}
...
...
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTrait.scala
View file @
f62be586
...
...
@@ -72,8 +72,8 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
/** Sample specific files to add to summary */
def
summaryFiles
:
Map
[
String
,
File
]
=
{
preProcessBam
match
{
case
Some
(
preProcessBam
)
=>
Map
(
"preProcessBam"
->
preProcessBam
)
case
_
=>
Map
()
case
Some
(
b
)
=>
Map
(
"preProcessBam"
->
b
)
case
_
=>
Map
()
}
}
...
...
@@ -88,9 +88,9 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
/** Library specific files to add to the summary */
def
summaryFiles
:
Map
[
String
,
File
]
=
{
(
bamFile
,
preProcessBam
)
match
{
case
(
Some
(
b
amFile
),
Some
(
p
reProcessBam
))
=>
Map
(
"bamFile"
->
b
amFile
,
"preProcessBam"
->
p
reProcessBam
)
case
(
Some
(
b
amFile
),
_
)
=>
Map
(
"bamFile"
->
b
amFile
)
case
_
=>
Map
()
case
(
Some
(
b
),
Some
(
p
b
))
=>
Map
(
"bamFile"
->
b
,
"preProcessBam"
->
p
b
)
case
(
Some
(
b
),
_
)
=>
Map
(
"bamFile"
->
b
)
case
_
=>
Map
()
}
}
...
...
@@ -116,10 +116,9 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
case
(
false
,
true
)
=>
// Starting from bam file
config
(
"bam_to_fastq"
,
default
=
false
).
asBoolean
match
{
case
true
=>
makeMapping
// bam file will be converted to fastq
case
false
=>
{
case
false
=>
val
file
=
new
File
(
libDir
,
sampleId
+
"-"
+
libId
+
".final.bam"
)
(
None
,
Some
(
file
),
preProcess
(
file
))
}
}
case
_
=>
(
None
,
None
,
None
)
}
...
...
@@ -137,7 +136,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
mapping
.
input_R2
=
config
(
"R2"
)
})
case
(
false
,
true
)
=>
config
(
"bam_to_fastq"
,
default
=
false
).
asBoolean
match
{
case
true
=>
{
case
true
=>
val
samToFastq
=
SamToFastq
(
qscript
,
config
(
"bam"
),
new
File
(
libDir
,
sampleId
+
"-"
+
libId
+
".R1.fastq"
),
new
File
(
libDir
,
sampleId
+
"-"
+
libId
+
".R2.fastq"
))
...
...
@@ -147,8 +146,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
mapping
.
input_R1
=
samToFastq
.
fastqR1
mapping
.
input_R2
=
Some
(
samToFastq
.
fastqR2
)
})
}
case
false
=>
{
case
false
=>
val
inputSam
=
SamReaderFactory
.
makeDefault
.
open
(
config
(
"bam"
))
val
readGroups
=
inputSam
.
getFileHeader
.
getReadGroups
...
...
@@ -157,7 +155,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
if
(
readGroup
.
getLibrary
!=
libId
)
logger
.
warn
(
"Library ID readgroup in bam file is not the same"
)
readGroup
.
getSample
==
sampleId
&&
readGroup
.
getLibrary
==
libId
})
inputSam
.
close
inputSam
.
close
()
if
(!
readGroupOke
)
{
if
(
config
(
"correct_readgroups"
,
default
=
false
).
asBoolean
)
{
...
...
@@ -181,15 +179,13 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
bamLn
.
deps
:+=
baiLn
.
output
add
(
bamLn
)
}
}
}
case
_
=>
logger
.
warn
(
"Sample: "
+
sampleId
+
" Library: "
+
libId
+
", no reads found"
)
}
mapping
.
foreach
(
mapping
=>
{
mapping
.
init
mapping
.
biopetScript
mapping
.
init
()
mapping
.
biopetScript
()
addAll
(
mapping
.
functions
)
// Add functions of mapping to curent function pool
addSummaryQScript
(
mapping
)
})
...
...
@@ -234,13 +230,13 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
}
}
lazy
val
preProcessBam
:
Option
[
File
]
=
addDoublePreProcess
(
libraries
.
m
ap
(
lib
=>
{
lazy
val
preProcessBam
:
Option
[
File
]
=
addDoublePreProcess
(
libraries
.
flatM
ap
(
lib
=>
{
(
lib
.
_2
.
bamFile
,
lib
.
_2
.
preProcessBam
)
match
{
case
(
_
,
Some
(
file
))
=>
Some
(
file
)
case
(
Some
(
file
),
_
)
=>
Some
(
file
)
case
_
=>
None
}
}).
flatten
.
toList
)
}).
toList
)
lazy
val
variantcalling
=
if
(
config
(
"single_sample_variantcalling"
,
default
=
false
).
asBoolean
)
{
Some
(
makeVariantcalling
(
multisample
=
true
))
...
...
@@ -255,8 +251,8 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
bamMetrics
.
sampleId
=
Some
(
sampleId
)
bamMetrics
.
inputBam
=
preProcessBam
.
get
bamMetrics
.
outputDir
=
sampleDir
bamMetrics
.
init
bamMetrics
.
biopetScript
bamMetrics
.
init
()
bamMetrics
.
biopetScript
()
addAll
(
bamMetrics
.
functions
)
addSummaryQScript
(
bamMetrics
)
...
...
@@ -281,7 +277,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
def
addMultiSampleJobs
()
:
Unit
=
{
variantcalling
.
foreach
(
vc
=>
{
vc
.
outputDir
=
new
File
(
outputDir
,
"variantcalling"
)
vc
.
inputBams
=
samples
.
m
ap
(
_
.
_2
.
preProcessBam
).
flatten
.
toList
vc
.
inputBams
=
samples
.
flatM
ap
(
_
.
_2
.
preProcessBam
).
toList
vc
.
init
vc
.
biopetScript
addAll
(
vc
.
functions
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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