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
43d7c6f1
Commit
43d7c6f1
authored
Feb 13, 2017
by
Peter van 't Hof
Browse files
Adding update method for setting
parent
a327c58d
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
43d7c6f1
...
...
@@ -114,11 +114,12 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
sampleId
=
sampleId
.
map
(
Await
.
result
(
_
,
Duration
.
Inf
))).
map
(
_
.
head
.
id
))
db
.
createOrUpdateStat
(
qscript
.
summaryRunId
,
pipelineId
,
Some
(
Await
.
result
(
moduleId
,
Duration
.
Inf
)),
sampleId
.
map
(
Await
.
result
(
_
,
Duration
.
Inf
)),
libId
.
map
(
Await
.
result
(
_
,
Duration
.
Inf
)),
stats
.
nospaces
)
}
//TODO: Add Files
//TODO: Add Settings
//TODO: Add executables
db
.
close
()
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/SummaryDb.scala
View file @
43d7c6f1
...
...
@@ -191,8 +191,8 @@ class SummaryDb(db: Database) extends Closeable {
db
.
run
(
settings
.
forceInsert
(
Setting
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
content
)))
}
def
getS
ettings
(
runId
:
Option
[
Int
]
=
None
,
pipelineId
:
Option
[
Int
]
=
None
,
moduleId
:
Option
[
Option
[
Int
]]
=
None
,
sampleId
:
Option
[
Option
[
Int
]]
=
None
,
libId
:
Option
[
Option
[
Int
]]
=
None
)
=
{
def
s
ettings
Filter
(
runId
:
Option
[
Int
]
=
None
,
pipelineId
:
Option
[
Int
]
=
None
,
moduleId
:
Option
[
Option
[
Int
]]
=
None
,
sampleId
:
Option
[
Option
[
Int
]]
=
None
,
libId
:
Option
[
Option
[
Int
]]
=
None
)
=
{
val
l
:
List
[
Option
[
Query
[
Settings
,
Settings
#
TableElementType
,
Seq
]
=>
Query
[
Settings
,
Settings
#
TableElementType
,
Seq
]]]
=
List
(
runId
.
map
(
x
=>
y
=>
y
.
filter
(
_
.
runId
===
x
)),
pipelineId
.
map
(
x
=>
y
=>
y
.
filter
(
_
.
pipelineId
===
x
)),
...
...
@@ -200,9 +200,20 @@ class SummaryDb(db: Database) extends Closeable {
sampleId
.
map
(
x
=>
y
=>
(
if
(
x
.
isDefined
)
y
.
filter
(
_
.
sampleId
===
x
)
else
y
.
filter
(
_
.
sampleId
.
isEmpty
))),
libId
.
map
(
x
=>
y
=>
(
if
(
x
.
isDefined
)
y
.
filter
(
_
.
libraryId
===
x
)
else
y
.
filter
(
_
.
libraryId
.
isEmpty
)))
)
val
q
=
l
.
flatten
.
foldLeft
(
settings
.
subquery
)((
a
,
b
)
=>
b
(
a
))
l
.
flatten
.
foldLeft
(
settings
.
subquery
)((
a
,
b
)
=>
b
(
a
))
}
db
.
run
(
q
.
result
)
def
createOrUpdateSetting
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
sampleId
:
Option
[
Int
]
=
None
,
libId
:
Option
[
Int
]
=
None
,
content
:
String
)
=
{
val
filter
=
settingsFilter
(
Some
(
runId
),
Some
(
pipelineId
),
Some
(
moduleId
),
Some
(
sampleId
),
Some
(
libId
))
val
r
=
Await
.
result
(
db
.
run
(
filter
.
size
.
result
),
Duration
.
Inf
)
if
(
r
==
0
)
createSetting
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
content
)
else
db
.
run
(
filter
.
map
(
_
.
content
).
update
(
content
))
}
def
getSettings
(
runId
:
Option
[
Int
]
=
None
,
pipelineId
:
Option
[
Int
]
=
None
,
moduleId
:
Option
[
Option
[
Int
]]
=
None
,
sampleId
:
Option
[
Option
[
Int
]]
=
None
,
libId
:
Option
[
Option
[
Int
]]
=
None
)
=
{
db
.
run
(
settingsFilter
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
).
result
)
}
def
getSetting
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
...
...
Write
Preview
Markdown
is supported
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