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
c4ae1eb9
Commit
c4ae1eb9
authored
Feb 09, 2017
by
Peter van 't Hof
Browse files
Adding pipeline and modules during init
parent
17cbd8cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
c4ae1eb9
...
...
@@ -28,6 +28,9 @@ import scala.collection.mutable
import
scala.io.Source
import
slick.driver.H2Driver.api._
import
scala.concurrent.Await
import
scala.concurrent.duration.Duration
/**
* This will collect and write the summary
*
...
...
@@ -59,10 +62,11 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
case
s
:
MultiSampleQScript
=>
s
.
initSummaryDb
case
_
=>
qscript
.
summaryRunId
}
val
db
=
SummaryDb
.
openSqliteSummary
(
qscript
.
summaryDbFile
)
db
.
close
()
}
val
db
=
SummaryDb
.
openSqliteSummary
(
qscript
.
summaryDbFile
)
val
pipelineId
=
Await
.
result
(
db
.
createPipeline
(
qscript
.
summaryName
,
qscript
.
summaryRunId
),
Duration
.
Inf
)
qscript
.
summarizables
.
map
(
x
=>
Await
.
result
(
db
.
createModule
(
x
.
_1
.
_1
,
qscript
.
summaryRunId
,
pipelineId
),
Duration
.
Inf
))
db
.
close
()
for
(
q
<-
qscript
.
summaryQScripts
)
deps
:+=
q
.
summaryFile
for
((
_
,
l
)
<-
qscript
.
summarizables
;
s
<-
l
)
{
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/SummaryToSqlite.scala
View file @
c4ae1eb9
...
...
@@ -62,7 +62,7 @@ object SummaryToSqlite extends ToolCommand {
println
(
Await
.
result
(
summary
.
getLibraries
(),
Duration
.
Inf
))
val
pipelineId
=
Await
.
result
(
summary
.
c
reatePipeline
(
"pipelineName"
,
runId
),
Duration
.
Inf
)
val
pipelineId
=
Await
.
result
(
summary
.
forceC
reatePipeline
(
"pipelineName"
,
runId
),
Duration
.
Inf
)
println
(
Await
.
result
(
summary
.
getPipelines
(),
Duration
.
Inf
))
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/SummaryDb.scala
View file @
c4ae1eb9
...
...
@@ -91,11 +91,19 @@ class SummaryDb(db: Database) extends Closeable {
.
map
(
_
.
headOption
.
flatten
.
map
(
ConfigUtils
.
jsonTextToMap
))
}
def
c
reatePipeline
(
name
:
String
,
runId
:
Int
)
:
Future
[
Int
]
=
{
def
forceC
reatePipeline
(
name
:
String
,
runId
:
Int
)
:
Future
[
Int
]
=
{
val
id
=
Await
.
result
(
db
.
run
(
pipelines
.
size
.
result
),
Duration
.
Inf
)
db
.
run
(
pipelines
.
forceInsert
(
Pipeline
(
id
,
name
,
runId
))).
map
(
_
=>
id
)
}
def
createPipeline
(
name
:
String
,
runId
:
Int
)
:
Future
[
Int
]
=
{
getPipelines
(
name
=
Some
(
name
),
runId
=
Some
(
runId
))
.
flatMap
{
case
m
=>
if
(
m
.
isEmpty
)
forceCreatePipeline
(
name
,
runId
)
else
Future
(
m
.
head
.
id
)
}
}
def
getPipelines
(
pipelineId
:
Option
[
Int
]
=
None
,
name
:
Option
[
String
]
=
None
,
runId
:
Option
[
Int
]
=
None
)
=
{
val
q
=
pipelines
.
filter
{
lib
=>
List
(
...
...
@@ -104,14 +112,22 @@ class SummaryDb(db: Database) extends Closeable {
name
.
map
(
lib
.
name
===
_
)
).
collect
({
case
Some
(
criteria
)
=>
criteria
}).
reduceLeftOption
(
_
&&
_
).
getOrElse
(
true
:
Rep
[
Boolean
])
}
db
.
run
(
q
.
map
(
x
=>
(
x
.
id
,
x
.
name
,
x
.
runId
)).
result
)
db
.
run
(
q
.
result
)
}
def
c
reateModule
(
name
:
String
,
runId
:
Int
,
pipelineId
:
Int
)
:
Future
[
Int
]
=
{
def
forceC
reateModule
(
name
:
String
,
runId
:
Int
,
pipelineId
:
Int
)
:
Future
[
Int
]
=
{
val
id
=
Await
.
result
(
db
.
run
(
modules
.
size
.
result
),
Duration
.
Inf
)
db
.
run
(
modules
.
forceInsert
(
Module
(
id
,
name
,
runId
,
pipelineId
))).
map
(
_
=>
id
)
}
def
createModule
(
name
:
String
,
runId
:
Int
,
pipelineId
:
Int
)
:
Future
[
Int
]
=
{
getModules
(
name
=
Some
(
name
),
runId
=
Some
(
runId
),
pipelineId
=
Some
(
pipelineId
))
.
flatMap
{
case
m
=>
if
(
m
.
isEmpty
)
forceCreateModule
(
name
,
runId
,
pipelineId
)
else
Future
(
m
.
head
.
id
)
}
}
def
getModules
(
moduleId
:
Option
[
Int
]
=
None
,
name
:
Option
[
String
]
=
None
,
runId
:
Option
[
Int
]
=
None
,
pipelineId
:
Option
[
Int
]
=
None
)
=
{
val
q
=
modules
.
filter
{
lib
=>
List
(
...
...
@@ -121,7 +137,7 @@ class SummaryDb(db: Database) extends Closeable {
name
.
map
(
lib
.
name
===
_
)
).
collect
({
case
Some
(
criteria
)
=>
criteria
}).
reduceLeftOption
(
_
&&
_
).
getOrElse
(
true
:
Rep
[
Boolean
])
}
db
.
run
(
q
.
map
(
x
=>
(
x
.
id
,
x
.
name
,
x
.
runId
)).
result
)
db
.
run
(
q
.
result
)
}
def
createStat
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
...
...
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