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
a32ce842
Commit
a32ce842
authored
Feb 13, 2017
by
Peter van 't Hof
Browse files
Added executables
parent
eb3a77c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
a32ce842
...
...
@@ -129,8 +129,6 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
Await
.
result
(
createFile
(
db
,
qscript
.
summaryRunId
,
pipelineId
,
Some
(
moduleId
),
sampleId
,
libId
,
key
,
file
,
outputDir
),
Duration
.
Inf
)
}
//TODO: Add executables
qscript
match
{
case
tag
:
SampleLibraryTag
=>
val
sampleId
=
tag
.
sampleId
.
flatMap
(
name
=>
Await
.
result
(
db
.
getSampleId
(
qscript
.
summaryRunId
,
name
),
Duration
.
Inf
))
...
...
@@ -165,6 +163,21 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
db
.
createOrUpdateSetting
(
qscript
.
summaryRunId
,
pipelineId
,
None
,
None
,
None
,
ConfigUtils
.
mapToJson
(
q
.
summarySettings
).
nospaces
)
}
for
((
name
,
f
)
<-
qscript
.
functions
.
flatMap
(
_
match
{
case
c
:
Configurable
with
Version
=>
Some
(
c
)
case
_
=>
None
}).
groupBy
(
_
.
configNamespace
))
yield
{
f
match
{
case
f
:
BiopetJavaCommandLineFunction
with
Version
=>
db
.
createOrUpdateExecutable
(
qscript
.
summaryRunId
,
name
,
f
.
getVersion
,
f
.
getJavaVersion
,
javaMd5
=
BiopetCommandLineFunction
.
executableMd5Cache
.
get
(
f
.
executable
),
jarPath
=
Some
(
f
.
jarFile
.
getAbsolutePath
))
case
f
:
BiopetCommandLineFunction
with
Version
=>
db
.
createOrUpdateExecutable
(
qscript
.
summaryRunId
,
name
,
f
.
getVersion
,
Option
(
f
.
executable
))
case
f
:
Configurable
with
Version
=>
db
.
createOrUpdateExecutable
(
qscript
.
summaryRunId
,
name
,
f
.
getVersion
)
case
_
=>
None
}
}
db
.
close
()
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/SummaryDb.scala
View file @
a32ce842
...
...
@@ -272,6 +272,31 @@ class SummaryDb(db: Database) extends Closeable {
if
(
r
==
0
)
createFile
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
key
,
path
,
md5
,
link
,
size
)
else
db
.
run
(
filter
.
update
(
File
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
key
,
path
,
md5
,
link
,
size
)))
}
def
executablesFilter
(
runId
:
Option
[
Int
],
toolName
:
Option
[
String
])
=
{
val
l
:
List
[
Option
[
Query
[
Executables
,
Executables
#
TableElementType
,
Seq
]
=>
Query
[
Executables
,
Executables
#
TableElementType
,
Seq
]]]
=
List
(
runId
.
map
(
x
=>
y
=>
y
.
filter
(
_
.
runId
===
x
)),
toolName
.
map
(
x
=>
y
=>
y
.
filter
(
_
.
toolName
===
x
))
)
l
.
flatten
.
foldLeft
(
executables
.
subquery
)((
a
,
b
)
=>
b
(
a
))
}
def
getFiles
(
runId
:
Option
[
Int
],
toolName
:
Option
[
String
])
=
{
db
.
run
(
executablesFilter
(
runId
,
toolName
).
result
)
}
def
createExecutable
(
runId
:
Int
,
toolName
:
String
,
version
:
Option
[
String
]
=
None
,
path
:
Option
[
String
]
=
None
,
javaVersion
:
Option
[
String
]
=
None
,
exeMd5
:
Option
[
String
]
=
None
,
javaMd5
:
Option
[
String
]
=
None
,
jarPath
:
Option
[
String
]
=
None
)
=
{
db
.
run
(
executables
.
forceInsert
(
Executable
(
runId
,
toolName
,
version
,
path
,
javaVersion
,
exeMd5
,
javaMd5
,
jarPath
)))
}
def
createOrUpdateExecutable
(
runId
:
Int
,
toolName
:
String
,
version
:
Option
[
String
]
=
None
,
path
:
Option
[
String
]
=
None
,
javaVersion
:
Option
[
String
]
=
None
,
exeMd5
:
Option
[
String
]
=
None
,
javaMd5
:
Option
[
String
]
=
None
,
jarPath
:
Option
[
String
]
=
None
)
=
{
val
filter
=
executablesFilter
(
Some
(
runId
),
Some
(
toolName
))
val
r
=
Await
.
result
(
db
.
run
(
filter
.
size
.
result
),
Duration
.
Inf
)
if
(
r
==
0
)
createExecutable
(
runId
,
toolName
,
version
,
javaVersion
,
exeMd5
,
javaMd5
)
else
db
.
run
(
filter
.
update
(
Executable
(
runId
,
toolName
,
version
,
path
,
javaVersion
,
exeMd5
,
javaMd5
,
jarPath
)))
}
}
object
SummaryDb
{
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/db/Schema.scala
View file @
a32ce842
...
...
@@ -118,16 +118,18 @@ object Schema {
}
val
files
=
TableQuery
[
Files
]
case
class
Executable
(
runId
:
Int
,
toolName
:
String
,
version
:
Option
[
String
],
javaVersion
:
Option
[
String
],
exeMd5
:
Option
[
String
],
javaMd5
:
Option
[
String
])
case
class
Executable
(
runId
:
Int
,
toolName
:
String
,
version
:
Option
[
String
],
path
=
Option
[
String
],
javaVersion
:
Option
[
String
],
exeMd5
:
Option
[
String
],
javaMd5
:
Option
[
String
],
jarPath
:
Option
[
String
])
class
Executables
(
tag
:
Tag
)
extends
Table
[
Executable
](
tag
,
"Executables"
)
{
def
runId
=
column
[
Int
](
"runId"
)
def
toolName
=
column
[
String
](
"toolName"
)
def
version
=
column
[
Option
[
String
]](
"version"
)
def
path
=
column
[
Option
[
String
]](
"path"
)
def
javaVersion
=
column
[
Option
[
String
]](
"javaVersion"
)
def
exeMd5
=
column
[
Option
[
String
]](
"exeMd5"
)
def
javaMd5
=
column
[
Option
[
String
]](
"javaMd5"
)
def
jarPath
=
column
[
Option
[
String
]](
"jarPath"
)
def
*
=
(
runId
,
toolName
,
version
,
javaVersion
,
exeMd5
,
javaMd5
)
<>
(
Executable
.
tupled
,
Executable
.
unapply
)
def
*
=
(
runId
,
toolName
,
version
,
path
,
javaVersion
,
exeMd5
,
javaMd5
,
jarPath
)
<>
(
Executable
.
tupled
,
Executable
.
unapply
)
def
idx
=
index
(
"idx_executables"
,
(
runId
,
toolName
),
unique
=
true
)
}
...
...
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