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
385c71e9
Commit
385c71e9
authored
Jul 13, 2017
by
Peter van 't Hof
Browse files
Biopet core code inspection round
parent
c181bccd
Changes
74
Hide whitespace changes
Inline
Side-by-side
Jenkinsfile
View file @
385c71e9
...
...
@@ -29,7 +29,7 @@ node('local') {
sh
'mkdocs build --clean --strict'
}
if
(
currentBuild
.
result
==
null
||
"SUCCESS"
.
equals
(
currentBuild
.
result
)
)
{
if
(
currentBuild
.
result
==
null
||
"SUCCESS"
==
currentBuild
.
result
)
{
currentBuild
.
result
=
"SUCCESS"
slackSend
(
color:
'#00FF00'
,
message:
"${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)"
,
channel:
'#biopet-bot'
,
teamDomain:
'lumc'
,
tokenCredentialId:
'lumc'
)
}
else
{
...
...
@@ -37,7 +37,7 @@ node('local') {
}
}
catch
(
e
)
{
if
(
currentBuild
.
result
==
null
||
"FAILED"
.
equals
(
currentBuild
.
result
)
)
{
if
(
currentBuild
.
result
==
null
||
"FAILED"
==
currentBuild
.
result
)
{
currentBuild
.
result
=
"FAILED"
}
slackSend
(
color:
'#FF0000'
,
message:
"${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)"
,
channel:
'#biopet-bot'
,
teamDomain:
'lumc'
,
tokenCredentialId:
'lumc'
)
...
...
biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/ext/css/bootstrap_dashboard.css
View file @
385c71e9
...
...
@@ -150,10 +150,9 @@ body {
float
:
right
;
width
:
0
;
height
:
0
;
border-color
:
transparent
;
border-style
:
solid
;
border-width
:
5px
0
5px
5px
;
border-left-color
:
#cccccc
;
border
:
5px
solid
transparent
;
border-right-width
:
0
;
border-left-color
:
#cccccc
;
margin-top
:
5px
;
margin-right
:
-10px
;
}
...
...
biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/ext/css/sortable-theme-bootstrap.css
View file @
385c71e9
...
...
@@ -46,9 +46,7 @@ table[data-sortable] th:after {
vertical-align
:
inherit
;
height
:
0
;
width
:
0
;
border-width
:
5px
;
border-style
:
solid
;
border-color
:
transparent
;
border
:
5px
solid
transparent
;
margin-right
:
1px
;
margin-left
:
10px
;
float
:
right
;
...
...
biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/files.ssp
View file @
385c71e9
...
...
@@ -31,9 +31,9 @@
<tbody>
#for (file <- files)
<tr><td>${allPipelines.find(_.id == file.pipelineId).map(_.name)}</td>
<td>${file.moduleId.
m
ap(id => allModules.find(x => x.pipelineId == file.pipelineId && file.moduleId == id).map(_.name)).
flatten.
getOrElse(
(
"-")
)
}</td>
<td>${file.sampleId.
m
ap(id => allSamples.find(_.id == id).map(_.name)).
flatten.
getOrElse(
(
"-")
)
}</td>
<td>${file.libraryId.
m
ap(id => allLibraries.find(_.id == id).map(_.name)).
flatten.
getOrElse(
(
"-")
)
}</td>
<td>${file.moduleId.
flatM
ap(id => allModules.find(x => x.pipelineId == file.pipelineId && file.moduleId == id).map(_.name)).getOrElse("-")}</td>
<td>${file.sampleId.
flatM
ap(id => allSamples.find(_.id == id).map(_.name)).getOrElse("-")}</td>
<td>${file.libraryId.
flatM
ap(id => allLibraries.find(_.id == id).map(_.name)).getOrElse("-")}</td>
<td>${file.key}</td>
<td>${file.path}</td>
<td>${file.md5}</td></tr>
...
...
biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/main.ssp
View file @
385c71e9
...
...
@@ -42,7 +42,7 @@
val tabIndex = if (first) " tabindex='-1'" else ""
// val listGroupA = if(subPage._2.subPages.nonEmpty) "list-group-item" else ""
va
r
menuItem: String = "
<li
class=
'%s'
>
".format(listSubmenu) +
va
l
menuItem: String = "
<li
class=
'%s'
>
".format(listSubmenu) +
"
<a
href=
'%s'
class=
'%s'
%
s
>
".format(href, "", tabIndex) +
"%s".format(subPageName) +
"
</a>
" +
...
...
@@ -93,7 +93,7 @@
<script
language=
"JavaScript"
>
<!--
$
(
document
).
ready
(
function
()
{
Sortable
.
init
()
Sortable
.
init
()
;
$
(
'
body
'
).
scrollspy
({
target
:
'
.bs-sidebar
'
...
...
@@ -135,14 +135,14 @@
<a
href=
"${rootPath}index.html"
>
Home
#if (iPage.subPages.nonEmpty)
<b
class=
"caret"
></b>
#end
</a>
${unescape(createMenu(iPage, Nil, false))}
${unescape(createMenu(iPage, Nil,
first =
false))}
</li>
#else
<li
class=
"root #if (t == path.size) active #end"
>
<a
href=
"${rootPath}${path.slice(0,t).mkString("
",
"/",
"/")}
index.html
"
>
${path( t - 1 )}
#if (getSubPage(path.slice(0, t)).subPages.nonEmpty)
<b
class=
"caret"
></b>
#end
</a>
${unescape(createMenu(getSubPage(path.slice(0, t)), path.slice(0, t), false))}
${unescape(createMenu(getSubPage(path.slice(0, t)), path.slice(0, t),
first =
false))}
</li>
#end
#end
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala
View file @
385c71e9
...
...
@@ -60,10 +60,10 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
/**
*
This value is used to let you job wait a x number of second after it finish.
*
This is ionly used when having storage delay issues
* This value is used to let you job wait a x number of second after it finish.
* This is ionly used when having storage delay issues
*/
va
r
jobDelayTime
:
Option
[
Int
]
=
config
(
"job_delay_time"
)
va
l
jobDelayTime
:
Option
[
Int
]
=
config
(
"job_delay_time"
)
// This overrides the default "sh" from queue. For Biopet the default is "bash"
updateJobRun
=
{
...
...
@@ -147,9 +147,9 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
private
[
core
]
var
_inputAsStdin
=
false
def
inputAsStdin
=
_inputAsStdin
def
inputAsStdin
:
Boolean
=
_inputAsStdin
private
[
core
]
var
_outputAsStdout
=
false
def
outputAsStdout
=
_outputAsStdout
def
outputAsStdout
:
Boolean
=
_outputAsStdout
/**
* This operator sends stdout to `that` and combine this into 1 command line function
...
...
@@ -212,13 +212,13 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
maxGroups
:
Int
=
0
)
:
String
=
{
if
(
values
.
size
%
groupSize
!=
0
)
Logging
.
addError
(
s
"Arg '$
{
argName
}
' values: '$
{
values
}
' does not fit to a groupSize of $
{
groupSize
}
"
)
s
"Arg '$argName' values: '$values' does not fit to a groupSize of $groupSize"
)
val
groups
=
values
.
size
/
groupSize
if
(
groups
<
minGroups
)
Logging
.
addError
(
s
"Args '$
{
argName
}
' need atleast $minGroups with size $groupSize"
)
Logging
.
addError
(
s
"Args '$argName' need atleast $minGroups with size $groupSize"
)
if
(
maxGroups
>
0
&&
groups
>
maxGroups
)
Logging
.
addError
(
s
"Args '$
{
argName
}
' may only have $maxGroups with size $groupSize"
)
if
(
values
.
nonEmpty
)
required
(
argName
)
+
values
.
map
(
required
(
_
)
).
mkString
Logging
.
addError
(
s
"Args '$argName' may only have $maxGroups with size $groupSize"
)
if
(
values
.
nonEmpty
)
required
(
argName
)
+
values
.
map
(
required
).
mkString
else
""
}
...
...
@@ -251,7 +251,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
private
[
core
]
var
_pipesJobs
:
List
[
BiopetCommandLineFunction
]
=
Nil
def
pipesJobs
=
_pipesJobs
def
pipesJobs
:
List
[
BiopetCommandLineFunction
]
=
_pipesJobs
def
addPipeJob
(
job
:
BiopetCommandLineFunction
)
{
_pipesJobs
:+=
job
_pipesJobs
=
_pipesJobs
.
distinct
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala
View file @
385c71e9
...
...
@@ -30,7 +30,7 @@ trait BiopetJavaCommandLineFunction
override
def
defaultVmemFactor
:
Double
=
2.0
/** Constructs java opts, this adds scala threads */
override
def
javaOpts
=
override
def
javaOpts
:
String
=
super
.
javaOpts
+
optional
(
"-Dscala.concurrent.context.numThreads="
,
threads
,
spaceSeparated
=
false
)
+
optional
(
"-Dscala.concurrent.context.maxThreads="
,
threads
,
spaceSeparated
=
false
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetPipe.scala
View file @
385c71e9
...
...
@@ -30,14 +30,14 @@ class BiopetPipe(val commands: List[BiopetCommandLineFunction]) extends BiopetCo
lazy
val
input
:
List
[
File
]
=
try
{
commands
.
flatMap
(
_
.
inputs
)
}
catch
{
case
e
:
Exception
=>
Nil
case
_
:
Exception
=>
Nil
}
@Output
lazy
val
output
:
List
[
File
]
=
try
{
commands
.
flatMap
(
_
.
outputs
)
}
catch
{
case
e
:
Exception
=>
Nil
case
_
:
Exception
=>
Nil
}
_pipesJobs
:::=
commands
...
...
@@ -74,7 +74,7 @@ class BiopetPipe(val commands: List[BiopetCommandLineFunction]) extends BiopetCo
override
def
defaultThreads
=
0
val
parent
:
Configurable
=
commands
.
head
.
parent
override
def
configNamespace
=
commands
.
map
(
_
.
configNamespace
).
mkString
(
"-"
)
override
def
configNamespace
:
String
=
commands
.
map
(
_
.
configNamespace
).
mkString
(
"-"
)
def
cmdLine
:
String
=
{
"("
+
commands
.
head
.
cmdLine
+
(
if
(
commands
.
head
.
stdinFile
.
isDefined
)
{
" < "
+
required
(
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
385c71e9
...
...
@@ -221,7 +221,7 @@ object BiopetQScript {
try
{
Some
(
function
.
inputs
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
@@ -229,7 +229,7 @@ object BiopetQScript {
try
{
Some
(
function
.
outputs
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
@@ -237,7 +237,7 @@ object BiopetQScript {
try
{
Some
(
function
.
doneOutputs
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
@@ -245,7 +245,7 @@ object BiopetQScript {
try
{
Some
(
function
.
failOutputs
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
@@ -253,7 +253,7 @@ object BiopetQScript {
try
{
Some
(
function
.
isDone
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
@@ -261,7 +261,7 @@ object BiopetQScript {
try
{
Some
(
function
.
isFail
)
}
catch
{
case
e
:
NullPointerException
=>
None
case
_
:
NullPointerException
=>
None
}
}
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/CommandLineResources.scala
View file @
385c71e9
...
...
@@ -32,7 +32,7 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
def
defaultThreads
=
1
/** This method will get and set the cores requested */
final
def
threads
=
nCoresRequest
match
{
final
def
threads
:
Int
=
nCoresRequest
match
{
case
Some
(
i
)
=>
i
case
_
=>
val
t
=
getThreads
...
...
@@ -47,14 +47,15 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
def
defaultCoreMemory
:
Double
=
2.0
def
defaultVmemFactor
:
Double
=
1.4
def
defaultResidentFactor
:
Double
=
1.2
var
vmemFactor
:
Double
=
config
(
"vmem_factor"
,
default
=
defaultVmemFactor
)
val
vmemFactor
:
Double
=
config
(
"vmem_factor"
,
default
=
defaultVmemFactor
)
val
useSge
:
Boolean
=
config
(
"use_sge"
,
default
=
true
)
va
r
residentFactor
:
Double
=
config
(
"resident_factor"
,
default
=
defaultResidentFactor
)
va
l
residentFactor
:
Double
=
config
(
"resident_factor"
,
default
=
defaultResidentFactor
)
private
var
_coreMemory
:
Double
=
2.0
def
coreMemory
=
_coreMemory
def
coreMemory
:
Double
=
_coreMemory
/** This value is for SGE and is defined in seconds */
wallTime
=
config
(
"max_walltime"
)
...
...
@@ -92,7 +93,7 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
val
firstOutput
=
try
{
this
.
firstOutput
}
catch
{
case
e
:
NullPointerException
=>
null
case
_
:
NullPointerException
=>
null
}
nCoresRequest
=
Option
(
threads
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
385c71e9
...
...
@@ -25,6 +25,7 @@ import org.broadinstitute.gatk.queue.QScript
import
scala.concurrent.Await
import
scala.concurrent.duration.Duration
import
scala.concurrent.ExecutionContext.Implicits.global
import
scala.util.matching.Regex
/** This trait creates a structured way of use multisample pipelines */
trait
MultiSampleQScript
extends
SummaryQScript
{
qscript
:
QScript
=>
...
...
@@ -84,7 +85,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
namespace
=
libId
,
path
=
List
(
"samples"
,
sampleId
,
"libraries"
))
def
sampleId
=
sample
.
sampleId
def
sampleId
:
String
=
sample
.
sampleId
lazy
val
libGroups
:
List
[
String
]
=
libTags
.
get
(
"groups"
)
match
{
case
Some
(
g
:
List
[
_
])
=>
g
.
map
(
_
.
toString
)
...
...
@@ -109,19 +110,19 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
namespace
=
sampleId
,
path
=
List
(
"samples"
))
lazy
val
gender
=
{
lazy
val
gender
:
MultiSampleQScript.Gender.Value
=
{
val
g
:
Option
[
String
]
=
sampleTags
.
get
(
"gender"
).
map
(
_
.
toString
)
g
.
map
(
_
.
toLowerCase
)
match
{
case
Some
(
"male"
)
=>
Gender
.
Male
case
Some
(
"female"
)
=>
Gender
.
Female
case
Some
(
s
)
=>
case
Some
(
_
)
=>
logger
.
warn
(
s
"Could not convert '$g' to a gender"
)
Gender
.
Unknown
case
_
=>
Gender
.
Unknown
}
}
lazy
val
father
=
{
lazy
val
father
:
Option
[
String
]
=
{
val
g
:
Option
[
String
]
=
sampleTags
.
get
(
"father"
).
map
(
_
.
toString
)
g
.
foreach
{
father
=>
if
(
sampleId
==
father
)
Logging
.
addError
(
s
"Father for $sampleId can not be itself"
)
...
...
@@ -133,7 +134,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
g
}
lazy
val
mother
=
{
lazy
val
mother
:
Option
[
String
]
=
{
val
g
:
Option
[
String
]
=
sampleTags
.
get
(
"mother"
).
map
(
_
.
toString
)
g
.
foreach
{
mother
=>
if
(
sampleId
==
mother
)
Logging
.
addError
(
s
"mother for $sampleId can not be itself"
)
...
...
@@ -199,7 +200,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
/** function add all libraries in one call */
protected
final
def
addPerLibJobs
()
:
Unit
=
{
for
((
libId
,
library
)
<-
libraries
)
{
for
((
_
,
library
)
<-
libraries
)
{
library
.
addAndTrackJobs
()
}
}
...
...
@@ -228,8 +229,8 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
protected
def
sampleIds
:
Set
[
String
]
=
ConfigUtils
.
any2map
(
globalConfig
.
map
.
getOrElse
(
"samples"
,
Map
())).
keySet
protected
lazy
val
nameRegex
=
"""^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$"""
.
r
protected
lazy
val
nameError
=
"has an invalid name. "
+
protected
lazy
val
nameRegex
:
Regex
=
"""^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$"""
.
r
protected
lazy
val
nameError
:
String
=
"has an invalid name. "
+
"Sample names must have at least 3 characters, "
+
"must begin and end with an alphanumeric character, "
+
"and must not have whitespace and special characters. "
+
...
...
@@ -281,7 +282,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
sample
:::
lib
:::
super
.
configFullPath
}
def
initSummaryDb
:
Unit
=
{
def
initSummaryDb
()
:
Unit
=
{
val
db
=
SummaryDb
.
openSqliteSummary
(
summaryDbFile
)
val
namesOld
=
Await
.
result
(
db
.
getSamples
(
runId
=
Some
(
summaryRunId
)).
map
(
_
.
map
(
_
.
name
).
toSet
),
Duration
.
Inf
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PedigreeQscript.scala
View file @
385c71e9
...
...
@@ -201,10 +201,7 @@ trait PedigreeQscript extends MultiSampleQScript { qscript: QScript =>
}
val
affectedField
=
p
.
affectedPhenotype
match
{
case
Some
(
b
)
=>
b
match
{
case
true
=>
"2"
case
_
=>
"1"
}
if
(
b
)
"2"
else
"1"
case
_
=>
"0"
}
val
mainLine
:
String
=
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala
View file @
385c71e9
...
...
@@ -30,11 +30,11 @@ trait PipelineCommand extends MainCommand with GatkLogging with ImplicitConversi
* Gets location of compiled class of pipeline
* @return path from classPath to class file
*/
def
pipeline
=
"/"
+
getClass
.
getName
.
takeWhile
(
_
!=
'$'
).
replaceAll
(
"\\."
,
"/"
)
+
".class"
def
pipeline
:
String
=
"/"
+
getClass
.
getName
.
takeWhile
(
_
!=
'$'
).
replaceAll
(
"\\."
,
"/"
)
+
".class"
def
pipelineName
=
getClass
.
getName
.
takeWhile
(
_
!=
'$'
).
split
(
"\\."
).
last
.
toLowerCase
def
pipelineName
:
String
=
getClass
.
getName
.
takeWhile
(
_
!=
'$'
).
split
(
"\\."
).
last
.
toLowerCase
protected
val
globalConfig
=
Config
.
global
protected
val
globalConfig
:
Config
=
Config
.
global
/** Class can be used directly from java with -cp option */
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/Reference.scala
View file @
385c71e9
...
...
@@ -16,6 +16,7 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
htsjdk.samtools.SAMSequenceDictionary
import
htsjdk.samtools.reference.IndexedFastaSequenceFile
import
nl.lumc.sasc.biopet.core.summary.
{
Summarizable
,
SummaryQScript
}
import
nl.lumc.sasc.biopet.utils._
...
...
@@ -50,15 +51,15 @@ trait Reference extends Configurable {
}
}
def
referenceDict
=
FastaUtils
.
getCachedDict
(
referenceFasta
())
def
referenceDict
:
SAMSequenceDictionary
=
FastaUtils
.
getCachedDict
(
referenceFasta
())
/** All config values will get a prefix */
override
def
subPath
=
{
override
def
subPath
:
List
[
String
]
=
{
referenceConfigPath
:::
super
.
subPath
}
lazy
val
geneAnnotationVersion
:
Option
[
String
]
=
config
(
"gene_annotation_name"
)
lazy
val
geneAnnotationSubPath
=
lazy
val
geneAnnotationSubPath
:
List
[
String
]
=
geneAnnotationVersion
.
map
(
List
(
"gene_annotations"
,
_
)).
getOrElse
(
Nil
)
lazy
val
dbsnpVersion
:
Option
[
String
]
=
config
(
"dbsnp_version"
)
lazy
val
dbsnpSubPath
:
List
[
String
]
=
...
...
@@ -66,7 +67,7 @@ trait Reference extends Configurable {
def
dbsnpVcfFile
:
Option
[
File
]
=
config
(
"dbsnp_vcf"
,
extraSubPath
=
dbsnpSubPath
)
/** Returns the reference config path */
def
referenceConfigPath
=
{
def
referenceConfigPath
:
List
[
String
]
=
{
List
(
"references"
,
referenceSpecies
,
referenceName
)
}
...
...
@@ -74,7 +75,7 @@ trait Reference extends Configurable {
def
faiRequired
=
false
/** When set override this on true the pipeline with raise an exception when dict index is not found */
def
dictRequired
=
this
.
isInstanceOf
[
Summarizable
]
||
this
.
isInstanceOf
[
SummaryQScript
]
def
dictRequired
:
Boolean
=
this
.
isInstanceOf
[
Summarizable
]
||
this
.
isInstanceOf
[
SummaryQScript
]
/** Returns the dict file belonging to the fasta file */
def
referenceDictFile
=
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/TemplateTool.scala
View file @
385c71e9
...
...
@@ -42,7 +42,7 @@ trait TemplateTool extends ToolCommand {
opt
[
File
](
't'
,
"template"
)
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
template
=
Some
(
x
))
}
text
"Path to template. By default it will try to fetch this from the ENV value 'BIOPET_SCRIPT_TEMPLATE'"
opt
[
Unit
](
"expert"
)
action
{
(
x
,
c
)
=>
opt
[
Unit
](
"expert"
)
action
{
(
_
,
c
)
=>
c
.
copy
(
expert
=
true
)
}
text
"This enables expert options / questions"
}
...
...
@@ -149,7 +149,6 @@ object TemplateTool {
val
files
=
configFile
::
currentList
if
(
files
.
size
>
1
)
{
val
configs
=
files
.
map
(
f
=>
new
Summary
(
ConfigUtils
.
fileToConfigMap
(
f
)))
val
sizes
=
configs
.
map
(
x
=>
(
x
.
samples
.
size
,
x
.
libraries
.
map
(
_
.
_2
.
size
).
sum
))
val
samples
=
configs
.
flatMap
(
_
.
samples
.
toList
)
val
libs
=
configs
.
flatMap
(
_
.
libraries
.
flatMap
{
case
(
s
,
libs
)
=>
libs
.
toList
.
map
(
l
=>
(
s
,
l
))
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommandFunction.scala
View file @
385c71e9
...
...
@@ -16,6 +16,8 @@ package nl.lumc.sasc.biopet.core
import
nl.lumc.sasc.biopet.FullVersion
import
scala.util.matching.Regex
/**
* Created by pjvanthof on 11/09/15.
*/
...
...
@@ -23,7 +25,7 @@ trait ToolCommandFunction extends BiopetJavaCommandLineFunction with Version {
def
toolObject
:
Object
def
versionCommand
=
""
def
versionRegex
=
""
.
r
def
versionRegex
:
Regex
=
""
.
r
override
def
getVersion
=
Some
(
"Biopet "
+
FullVersion
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/Version.scala
View file @
385c71e9
...
...
@@ -66,8 +66,8 @@ object Version extends Logging {
private
[
core
]
def
getVersionInternal
(
versionCommand
:
String
,
versionRegex
:
Regex
,
versionExitcode
:
List
[
Int
]
=
List
(
0
))
:
Option
[
String
]
=
{
if
(
versionCache
.
contains
(
versionCommand
))
return
versionCache
.
get
(
versionCommand
)
else
if
(
versionCommand
==
null
||
versionRegex
==
null
)
return
None
if
(
versionCache
.
contains
(
versionCommand
))
versionCache
.
get
(
versionCommand
)
else
if
(
versionCommand
==
null
||
versionRegex
==
null
)
None
else
{
val
stdout
=
new
StringBuffer
()
val
stderr
=
new
StringBuffer
()
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/extensions/CheckChecksum.scala
View file @
385c71e9
...
...
@@ -36,7 +36,7 @@ class CheckChecksum extends InProcessFunction {
var
checksum
:
String
=
_
/** Exits whenever the input md5sum is not the same as the output md5sum */
def
run
:
Unit
=
{
def
run
()
:
Unit
=
{
val
outputChecksum
=
WriteSummary
.
parseChecksum
(
checksumFile
).
toLowerCase
if
(
outputChecksum
!=
checksum
.
toLowerCase
)
{
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/extensions/Md5sum.scala
View file @
385c71e9
...
...
@@ -16,10 +16,12 @@ package nl.lumc.sasc.biopet.core.extensions
import
java.io.File
import
nl.lumc.sasc.biopet.core.
{
Version
,
BiopetCommandLineFunction
}
import
nl.lumc.sasc.biopet.core.
{
BiopetCommandLineFunction
,
Version
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.util.matching.Regex
/** Extension for md5sum */
class
Md5sum
(
val
parent
:
Configurable
)
extends
BiopetCommandLineFunction
with
Version
{
mainFunction
=
false
...
...
@@ -32,11 +34,11 @@ class Md5sum(val parent: Configurable) extends BiopetCommandLineFunction with Ve
executable
=
config
(
"exe"
,
default
=
"md5sum"
)
def
versionRegex
=
"""md5sum \(GNU coreutils\) (.*)"""
.
r
def
versionCommand
=
executable
+
" --version"
def
versionRegex
:
Regex
=
"""md5sum \(GNU coreutils\) (.*)"""
.
r
def
versionCommand
:
String
=
executable
+
" --version"
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
required
(
input
)
+
" > "
+
required
(
output
)
def
cmdLine
:
String
=
required
(
executable
)
+
required
(
input
)
+
" > "
+
required
(
output
)
}
/** Object for constructors for md5sum */
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
View file @
385c71e9
...
...
@@ -74,7 +74,7 @@ trait ReportBuilderExtension extends ToolCommandFunction {
trait
ReportBuilder
extends
ToolCommand
{
implicit
lazy
val
ec
=
ReportBuilder
.
ec
implicit
lazy
val
ec
:
ExecutionContextExecutor
=
ReportBuilder
.
ec
implicit
def
toOption
[
T
](
x
:
T
)
:
Option
[
T
]
=
Option
(
x
)
implicit
def
autoWait
[
T
](
x
:
Future
[
T
])
:
T
=
Await
.
result
(
x
,
Duration
.
Inf
)
...
...
@@ -242,9 +242,8 @@ trait ReportBuilder extends ToolCommand {
try
{
Await
.
result
(
Future
.
sequence
(
futures
),
Duration
.
fromNanos
(
30000000000L
))
}
catch
{
case
e
:
TimeoutException
=>
case
_
:
TimeoutException
=>
}
val
dones
=
futures
.
filter
(
_
.
isCompleted
)
val
notDone
=
futures
.
filter
(!
_
.
isCompleted
)
done
+=
futures
.
size
-
notDone
.
size
if
(
notDone
.
nonEmpty
)
{
...
...
@@ -364,8 +363,7 @@ trait ReportBuilder extends ToolCommand {
dbFiles
.
map
(
x
=>
x
.
get
(
pipelinelineId
.
get
)
.
getOrElse
(
Seq
())
x
.
getOrElse
(
pipelinelineId
.
get
,
Seq
())
.
filter
(
_
.
moduleId
.
isEmpty
)))
modulePages
...
...
@@ -398,7 +396,7 @@ trait ReportBuilder extends ToolCommand {
object
ReportBuilder
{
implicit
lazy
val
ec
=
ExecutionContext
.
global
implicit
lazy
val
ec
:
ExecutionContextExecutor
=
ExecutionContext
.
global
/** Single template render engine, this will have a cache for all compile templates */
protected
val
engine
=
new
TemplateEngine
()
...
...
Prev
1
2
3
4
Next
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