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
23bdc5b2
Commit
23bdc5b2
authored
Jul 25, 2017
by
Peter van 't Hof
Committed by
GitHub
Jul 25, 2017
Browse files
Merge pull request #166 from biopet/fix-BIOPET-718
Removing sample/library variantcalling
parents
c913b602
f3071de2
Changes
4
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
View file @
23bdc5b2
...
...
@@ -177,6 +177,11 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
val
libId
=
tag
.
libId
.
flatMap
(
name
=>
sampleId
.
flatMap
(
sampleId
=>
Await
.
result
(
db
.
getLibraryId
(
qscript
.
summaryRunId
,
sampleId
,
name
),
Duration
.
Inf
)))
if
(
tag
.
sampleId
.
isDefined
)
require
(
sampleId
.
isDefined
,
s
"Sample '${tag.sampleId.get}' is not found in database yet"
)
if
(
tag
.
libId
.
isDefined
)
require
(
libId
.
isDefined
,
s
"Library '${tag.libId.get}' for '${tag.sampleId}' is not found in database yet"
)
for
((
key
,
file
)
<-
qscript
.
summaryFiles
.
par
)
Await
.
result
(
WriteSummary
.
createFile
(
db
,
qscript
.
summaryRunId
,
...
...
@@ -353,7 +358,10 @@ object WriteSummary {
/** Retrive checksum from file */
def
parseChecksum
(
checksumFile
:
File
)
:
String
=
{
Source
.
fromFile
(
checksumFile
).
getLines
().
toList
.
head
.
split
(
" "
)(
0
)
val
reader
=
Source
.
fromFile
(
checksumFile
)
val
lines
=
reader
.
getLines
().
toList
reader
.
close
()
lines
.
head
.
split
(
" "
)(
0
)
}
def
createFile
(
db
:
SummaryDbWrite
,
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/db/Schema.scala
View file @
23bdc5b2
...
...
@@ -110,8 +110,6 @@ object Schema {
def
*
=
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
,
content
)
<>
(
Stat
.
tupled
,
Stat
.
unapply
)
def
idx
=
index
(
"idx_stats"
,
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
),
unique
=
true
)
}
val
stats
=
TableQuery
[
Stats
]
...
...
@@ -131,9 +129,6 @@ object Schema {
def
*
=
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
,
content
)
<>
(
Setting
.
tupled
,
Setting
.
unapply
)
def
idx
=
index
(
"idx_settings"
,
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
),
unique
=
true
)
}
val
settings
=
TableQuery
[
Settings
]
...
...
@@ -163,7 +158,7 @@ object Schema {
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
,
key
,
path
,
md5
,
link
,
size
)
<>
(
File
.
tupled
,
File
.
unapply
)
def
idx
=
index
(
"idx_files"
,
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
,
key
)
,
unique
=
true
)
index
(
"idx_files"
,
(
runId
,
pipelineId
,
moduleId
,
sampleId
,
libraryId
,
key
))
}
val
files
=
TableQuery
[
Files
]
...
...
shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/Shiva.scala
View file @
23bdc5b2
...
...
@@ -101,17 +101,13 @@ class Shiva(val parent: Configurable)
/** Sample specific settings */
override
def
summarySettings
:
Map
[
String
,
Any
]
=
super
.
summarySettings
++
Map
(
"single_sample_variantcalling"
->
variantcalling
.
isDefined
,
"use_indel_realigner"
->
useIndelRealigner
)
Map
(
"use_indel_realigner"
->
useIndelRealigner
)
/** Class to generate jobs for a library */
class
Library
(
libId
:
String
)
extends
super
.
Library
(
libId
)
{
override
def
summaryFiles
:
Map
[
String
,
File
]
=
super
.
summaryFiles
++
variantcalling
.
map
(
"final"
->
_
.
finalFile
)
++
bqsrFile
.
map
(
"baserecal"
->
_
)
++
bqsrAfterFile
.
map
(
"baserecal_after"
->
_
)
...
...
@@ -140,20 +136,10 @@ class Shiva(val parent: Configurable)
/** Library specific settings */
override
def
summarySettings
:
Map
[
String
,
Any
]
=
super
.
summarySettings
++
Map
(
"library_variantcalling"
->
variantcalling
.
isDefined
,
"use_base_recalibration"
->
useBaseRecalibration
,
"useAnalyze_covariates"
->
useAnalyzeCovariates
)
lazy
val
variantcalling
:
Option
[
ShivaVariantcalling
with
QScript
]
=
if
(
config
(
"library_variantcalling"
,
default
=
false
).
asBoolean
&&
(
bamFile
.
isDefined
||
preProcessBam
.
isDefined
))
{
Some
(
makeVariantcalling
(
multisample
=
false
,
sample
=
Some
(
sampleId
),
library
=
Some
(
libId
)))
}
else
None
/** This will add jobs for this library */
override
def
addJobs
()
:
Unit
=
{
super
.
addJobs
()
...
...
@@ -164,15 +150,6 @@ class Shiva(val parent: Configurable)
useIndelRealigner
||
libraries
.
size
>
1
,
usePrintReads
)
}
variantcalling
.
foreach
(
vc
=>
{
vc
.
sampleId
=
Some
(
sampleId
)
vc
.
libId
=
Some
(
libId
)
vc
.
outputDir
=
new
File
(
libDir
,
"variantcalling"
)
if
(
preProcessBam
.
isDefined
)
vc
.
inputBams
=
Map
(
sampleId
->
preProcessBam
.
get
)
else
vc
.
inputBams
=
Map
(
sampleId
->
bamFile
.
get
)
add
(
vc
)
})
}
/** Adds base recalibration jobs */
...
...
@@ -220,11 +197,6 @@ class Shiva(val parent: Configurable)
}
}
lazy
val
variantcalling
:
Option
[
ShivaVariantcalling
with
QScript
]
=
if
(
config
(
"single_sample_variantcalling"
,
default
=
false
).
asBoolean
)
{
Some
(
makeVariantcalling
(
multisample
=
false
,
sample
=
Some
(
sampleId
)))
}
else
None
override
def
keepMergedFiles
:
Boolean
=
config
(
"keep_merged_files"
,
default
=
!
useIndelRealigner
)
...
...
@@ -235,9 +207,6 @@ class Shiva(val parent: Configurable)
bamFile
.
map
(
swapExt
(
sampleDir
,
_
,
".bam"
,
".realign.bam"
))
}
else
bamFile
override
def
summaryFiles
:
Map
[
String
,
File
]
=
super
.
summaryFiles
++
variantcalling
.
map
(
"final"
->
_
.
finalFile
)
/** This will add sample jobs */
override
def
addJobs
()
:
Unit
=
{
super
.
addJobs
()
...
...
@@ -245,15 +214,6 @@ class Shiva(val parent: Configurable)
if
(
useIndelRealigner
)
{
addIndelRealign
(
bamFile
.
get
,
sampleDir
,
isIntermediate
=
false
)
}
preProcessBam
.
foreach
{
bam
=>
variantcalling
.
foreach
(
vc
=>
{
vc
.
sampleId
=
Some
(
sampleId
)
vc
.
outputDir
=
new
File
(
sampleDir
,
"variantcalling"
)
vc
.
inputBams
=
Map
(
sampleId
->
bam
)
add
(
vc
)
})
}
}
}
// End of sample
...
...
shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTest.scala
View file @
23bdc5b2
...
...
@@ -60,8 +60,6 @@ trait ShivaTestTrait extends TestNGSuite with Matchers {
def
realignProvider
=
Array
(
false
,
true
)
def
baseRecalibrationProvider
=
Array
(
false
,
true
)
def
multisampleCalling
:
Boolean
=
true
def
sampleCalling
=
false
def
libraryCalling
=
false
def
dbsnp
=
true
def
svCalling
=
false
def
cnvCalling
=
false
...
...
@@ -86,8 +84,6 @@ trait ShivaTestTrait extends TestNGSuite with Matchers {
ConfigUtils
.
mergeMaps
(
Map
(
"multisample_variantcalling"
->
multisampleCalling
,
"single_sample_variantcalling"
->
sampleCalling
,
"library_variantcalling"
->
libraryCalling
,
"use_indel_realigner"
->
realign
,
"use_base_recalibration"
->
baseRecalibration
,
"sv_calling"
->
svCalling
,
...
...
@@ -133,26 +129,24 @@ trait ShivaTestTrait extends TestNGSuite with Matchers {
pipeline
.
samples
foreach
{
case
(
_
,
sample
)
=>
sample
.
summarySettings
.
get
(
"single_sample_variantcalling"
)
shouldBe
Some
(
sampleCalling
)
sample
.
summarySettings
.
get
(
"single_sample_variantcalling"
)
shouldBe
None
sample
.
summarySettings
.
get
(
"use_indel_realigner"
)
shouldBe
Some
(
realign
)
sample
.
libraries
.
foreach
{
case
(
_
,
lib
)
=>
lib
.
summarySettings
.
get
(
"library_variantcalling"
)
shouldBe
Some
(
libraryCalling
)
lib
.
summarySettings
.
get
(
"library_variantcalling"
)
shouldBe
None
lib
.
summarySettings
.
get
(
"use_indel_realigner"
)
shouldBe
None
// Should not exist anymore
lib
.
summarySettings
.
get
(
"use_base_recalibration"
)
shouldBe
Some
(
baseRecalibration
&&
dbsnp
)
}
}
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
VcfStats
])
shouldBe
((
if
(
multisampleCalling
)
2
else
0
)
+
(
if
(
sampleCalling
)
numberSamples
*
2
else
0
)
+
(
if
(
libraryCalling
)
numberLibs
*
2
else
0
))
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
VcfStats
])
shouldBe
(
if
(
multisampleCalling
)
2
else
0
)
}
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
@AfterClass
def
removeTempOutputDir
()
:
Unit
=
{
dirs
.
filter
(
_
.
exists
()).
foreach
{
dir
=>
try
{
FileUtils
.
deleteDirectory
(
dir
)
...
...
@@ -175,20 +169,6 @@ class ShivaNoPrintReadsTest extends ShivaTestTrait {
override
def
realignProvider
=
Array
(
x
=
false
)
override
def
usePrintReads
=
false
}
class
ShivaLibraryCallingTest
extends
ShivaTestTrait
{
override
def
sample1
=
Array
(
true
,
false
)
override
def
sample2
=
Array
(
false
,
true
)
override
def
realignProvider
=
Array
(
x
=
false
)
override
def
baseRecalibrationProvider
=
Array
(
x
=
false
)
override
def
libraryCalling
=
true
}
class
ShivaSampleCallingTest
extends
ShivaTestTrait
{
override
def
sample1
=
Array
(
true
,
false
)
override
def
sample2
=
Array
(
false
,
true
)
override
def
realignProvider
=
Array
(
x
=
false
)
override
def
baseRecalibrationProvider
=
Array
(
x
=
false
)
override
def
sampleCalling
=
true
}
class
ShivaWithSvCallingTest
extends
ShivaTestTrait
{
override
def
sample1
=
Array
(
x
=
true
)
override
def
sample2
=
Array
(
x
=
false
)
...
...
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