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
533cc566
Commit
533cc566
authored
Feb 15, 2017
by
Peter van 't Hof
Browse files
Remove close method
parent
18920b58
Changes
6
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
533cc566
...
...
@@ -17,9 +17,9 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
nl.lumc.sasc.biopet.core.MultiSampleQScript.Gender
import
nl.lumc.sasc.biopet.core.summary.
{
Summarizable
,
SummaryQScript
}
import
nl.lumc.sasc.biopet.core.summary.
{
Summarizable
,
SummaryQScript
}
import
nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import
nl.lumc.sasc.biopet.utils.
{
ConfigUtils
,
Logging
}
import
nl.lumc.sasc.biopet.utils.
{
ConfigUtils
,
Logging
}
import
org.broadinstitute.gatk.queue.QScript
import
scala.concurrent.Await
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/SummaryQScript.scala
View file @
533cc566
...
...
@@ -14,10 +14,10 @@
*/
package
nl.lumc.sasc.biopet.core.summary
import
java.io.
{
File
,
PrintWriter
}
import
java.io.
{
File
,
PrintWriter
}
import
nl.lumc.sasc.biopet.core._
import
nl.lumc.sasc.biopet.core.extensions.
{
CheckChecksum
,
Md5sum
}
import
nl.lumc.sasc.biopet.core.extensions.
{
CheckChecksum
,
Md5sum
}
import
nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import
org.broadinstitute.gatk.queue.QScript
import
org.broadinstitute.gatk.queue.engine.JobRunInfo
...
...
@@ -200,10 +200,6 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
addedJobs
=
true
}
override
def
onExecutionDone
(
jobs
:
Map
[
QFunction
,
JobRunInfo
],
success
:
Boolean
)
=
{
SummaryDb
.
closeAll
()
}
}
object
SummaryQScript
{
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
533cc566
...
...
@@ -14,15 +14,15 @@
*/
package
nl.lumc.sasc.biopet.core.summary
import
java.io.
{
File
,
PrintWriter
}
import
java.io.
{
File
,
PrintWriter
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.core._
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.LastCommitHash
import
nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import
org.broadinstitute.gatk.queue.function.
{
InProcessFunction
,
QFunction
}
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
org.broadinstitute.gatk.queue.function.
{
InProcessFunction
,
QFunction
}
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.collection.mutable
import
scala.io.Source
...
...
@@ -60,17 +60,18 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
if
(
qscript
==
root
)
{
// This initialize the database
qscript
match
{
case
s
:
MultiSampleQScript
=>
s
.
initSummaryDb
case
t
:
SampleLibraryTag
=>
t
.
sampleId
.
foreach
{
case
sampleName
=>
val
sampleId
=
Await
.
result
(
db
.
getSamples
(
name
=
Some
(
sampleName
),
runId
=
Some
(
qscript
.
summaryRunId
)).
map
(
_
.
headOption
.
map
(
_
.
id
)),
Duration
.
Inf
).
getOrElse
{
Await
.
result
(
db
.
createSample
(
sampleName
,
qscript
.
summaryRunId
),
Duration
.
Inf
)
}
t
.
libId
.
foreach
{
libName
=>
val
libId
=
Await
.
result
(
db
.
getSamples
(
name
=
Some
(
libName
),
runId
=
Some
(
qscript
.
summaryRunId
),
sampleId
=
Some
(
sampleId
)).
map
(
_
.
headOption
.
map
(
_
.
id
)),
Duration
.
Inf
).
getOrElse
{
Await
.
result
(
db
.
createLibrary
(
libName
,
qscript
.
summaryRunId
,
sampleId
),
Duration
.
Inf
)
case
t
:
SampleLibraryTag
=>
t
.
sampleId
.
foreach
{
case
sampleName
=>
val
sampleId
=
Await
.
result
(
db
.
getSamples
(
name
=
Some
(
sampleName
),
runId
=
Some
(
qscript
.
summaryRunId
)).
map
(
_
.
headOption
.
map
(
_
.
id
)),
Duration
.
Inf
).
getOrElse
{
Await
.
result
(
db
.
createSample
(
sampleName
,
qscript
.
summaryRunId
),
Duration
.
Inf
)
}
t
.
libId
.
foreach
{
libName
=>
val
libId
=
Await
.
result
(
db
.
getSamples
(
name
=
Some
(
libName
),
runId
=
Some
(
qscript
.
summaryRunId
),
sampleId
=
Some
(
sampleId
)).
map
(
_
.
headOption
.
map
(
_
.
id
)),
Duration
.
Inf
).
getOrElse
{
Await
.
result
(
db
.
createLibrary
(
libName
,
qscript
.
summaryRunId
,
sampleId
),
Duration
.
Inf
)
}
}
}
}
case
_
=>
qscript
.
summaryRunId
case
_
=>
qscript
.
summaryRunId
}
}
val
pipelineId
=
Await
.
result
(
db
.
createPipeline
(
qscript
.
summaryName
,
qscript
.
summaryRunId
),
Duration
.
Inf
)
...
...
@@ -163,10 +164,12 @@ 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
{
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
))
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/SummaryToSqlite.scala
View file @
533cc566
...
...
@@ -3,7 +3,7 @@ package nl.lumc.sasc.biopet.tools
import
java.io.File
import
nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import
nl.lumc.sasc.biopet.utils.
{
ConfigUtils
,
ToolCommand
}
import
nl.lumc.sasc.biopet.utils.
{
ConfigUtils
,
ToolCommand
}
import
slick.driver.H2Driver.api._
import
scala.concurrent.Await
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/db/SummaryDb.scala
View file @
533cc566
...
...
@@ -8,7 +8,7 @@ import slick.driver.H2Driver.api._
import
scala.concurrent.ExecutionContext.Implicits.global
import
scala.concurrent.duration.Duration
import
scala.concurrent.
{
Await
,
Future
}
import
scala.concurrent.
{
Await
,
Future
}
/**
* Created by pjvanthof on 05/02/2017.
...
...
@@ -209,7 +209,7 @@ class SummaryDb(db: Database) extends Closeable {
}
def
createOrUpdateSetting
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
sampleId
:
Option
[
Int
]
=
None
,
libId
:
Option
[
Int
]
=
None
,
content
:
String
)
=
{
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
)
...
...
@@ -256,13 +256,13 @@ class SummaryDb(db: Database) extends Closeable {
def
createFile
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
sampleId
:
Option
[
Int
]
=
None
,
libId
:
Option
[
Int
]
=
None
,
key
:
String
,
path
:
String
,
md5
:
String
,
link
:
Boolean
=
false
,
size
:
Long
)
=
{
key
:
String
,
path
:
String
,
md5
:
String
,
link
:
Boolean
=
false
,
size
:
Long
)
=
{
db
.
run
(
files
.
forceInsert
(
Schema
.
File
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
key
,
path
,
md5
,
link
,
size
)))
}
def
createOrUpdateFile
(
runId
:
Int
,
pipelineId
:
Int
,
moduleId
:
Option
[
Int
]
=
None
,
sampleId
:
Option
[
Int
]
=
None
,
libId
:
Option
[
Int
]
=
None
,
key
:
String
,
path
:
String
,
md5
:
String
,
link
:
Boolean
=
false
,
size
:
Long
)
=
{
key
:
String
,
path
:
String
,
md5
:
String
,
link
:
Boolean
=
false
,
size
:
Long
)
=
{
val
filter
=
filesFilter
(
Some
(
runId
),
Some
(
pipelineId
),
Some
(
moduleId
),
Some
(
sampleId
),
Some
(
libId
),
Some
(
key
))
val
r
=
Await
.
result
(
db
.
run
(
filter
.
size
.
result
),
Duration
.
Inf
)
if
(
r
==
0
)
createFile
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libId
,
key
,
path
,
md5
,
link
,
size
)
...
...
biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/summary/db/SummaryDbTest.scala
View file @
533cc566
...
...
@@ -10,8 +10,8 @@ import scala.concurrent.Await
import
scala.concurrent.duration.Duration
/**
* Created by pjvanthof on 14/02/2017.
*/
* Created by pjvanthof on 14/02/2017.
*/
class
SummaryDbTest
extends
TestNGSuite
with
Matchers
{
@Test
...
...
@@ -23,9 +23,9 @@ class SummaryDbTest extends TestNGSuite with Matchers {
Await
.
result
(
db
.
createOrUpdateSetting
(
0
,
0
,
None
,
None
,
None
,
"""{"content": "test" }"""
),
Duration
.
Inf
)
val
bla
=
Await
.
result
(
db
.
getSettings
(
Some
(
0
)),
Duration
.
Inf
)
Await
.
result
(
db
.
getSetting
(
0
,
0
,
None
,
None
,
None
),
Duration
.
Inf
)
shouldBe
Some
(
Map
(
"content"
->
"test"
))
Await
.
result
(
db
.
getSetting
(
0
,
0
,
None
,
None
,
None
),
Duration
.
Inf
)
shouldBe
Some
(
Map
(
"content"
->
"test"
))
Await
.
result
(
db
.
createOrUpdateSetting
(
0
,
0
,
None
,
None
,
None
,
"""{"content": "test2" }"""
),
Duration
.
Inf
)
Await
.
result
(
db
.
getSetting
(
0
,
0
,
None
,
None
,
None
),
Duration
.
Inf
)
shouldBe
Some
(
Map
(
"content"
->
"test2"
))
Await
.
result
(
db
.
getSetting
(
0
,
0
,
None
,
None
,
None
),
Duration
.
Inf
)
shouldBe
Some
(
Map
(
"content"
->
"test2"
))
db
.
close
()
}
...
...
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