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
091f86da
Commit
091f86da
authored
Jan 09, 2015
by
Peter van 't Hof
Browse files
Extended sample handing in multisample qscript
parent
3230d5d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
protected/biopet-gatk-pipelines/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkPipeline.scala
View file @
091f86da
...
...
@@ -62,7 +62,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
}
val
multisampleVariantcalling
=
new
GatkVariantcalling
(
this
)
{
override
protected
lazy
val
configName
=
"gatkvariantcalling"
override
def
configName
=
"gatkvariantcalling"
override
def
configPath
:
List
[
String
]
=
"multisample"
::
super
.
configPath
}
...
...
@@ -97,7 +97,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
val
allRawVcfFiles
=
for
((
sampleID
,
sampleOutput
)
<-
samplesOutput
)
yield
sampleOutput
.
variantcalling
.
rawFilterVcfFile
val
gatkVariantcalling
=
new
GatkVariantcalling
(
this
)
{
override
protected
lazy
val
configName
=
"gatkvariantcalling"
override
def
configName
=
"gatkvariantcalling"
override
def
configPath
:
List
[
String
]
=
"multisample"
::
super
.
configPath
}
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
091f86da
...
...
@@ -15,7 +15,7 @@
*/
package
nl.lumc.sasc.biopet.core
import
nl.lumc.sasc.biopet.core.config.
{
Config
,
Configurable
}
import
nl.lumc.sasc.biopet.core.config.
{
ConfigValue
,
Config
,
Configurable
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils._
trait
MultiSampleQScript
extends
BiopetQScript
{
...
...
@@ -39,7 +39,9 @@ trait MultiSampleQScript extends BiopetQScript {
var
sample
=
any2map
(
value
)
if
(!
sample
.
contains
(
"ID"
))
sample
+=
(
"ID"
->
key
)
if
(
sample
(
"ID"
)
==
key
)
{
setCurrentSample
(
key
)
samplesOutput
+=
key
->
runSingleSampleJobs
(
sample
)
unsetCurrentSample
()
}
else
logger
.
warn
(
"Key is not the same as ID on value for sample"
)
}
else
logger
.
warn
(
"No Samples found in config"
)
...
...
@@ -63,11 +65,58 @@ trait MultiSampleQScript extends BiopetQScript {
var
library
=
any2map
(
value
)
if
(!
library
.
contains
(
"ID"
))
library
+=
(
"ID"
->
key
)
if
(
library
(
"ID"
)
==
key
)
{
setCurrentLibrary
(
key
)
output
+=
key
->
runSingleLibraryJobs
(
library
,
sampleConfig
)
unsetCurrentLibrary
()
}
else
logger
.
warn
(
"Key is not the same as ID on value for run of sample: "
+
sampleID
)
}
}
else
logger
.
warn
(
"No runs found in config for sample: "
+
sampleID
)
return
output
}
def
runSingleLibraryJobs
(
runConfig
:
Map
[
String
,
Any
],
sampleConfig
:
Map
[
String
,
Any
])
:
LibraryOutput
private
var
currentSample
:
String
=
null
private
var
currentLibrary
:
String
=
null
def
setCurrentSample
(
sample
:
String
)
{
currentSample
=
sample
}
def
unsetCurrentSample
()
{
currentSample
=
null
}
def
setCurrentLibrary
(
library
:
String
)
{
currentLibrary
=
library
}
def
unsetCurrentLibrary
()
{
currentLibrary
=
null
}
override
protected
[
core
]
def
configFullPath
:
List
[
String
]
=
{
(
if
(
currentSample
!=
null
)
"samples"
::
currentSample
::
Nil
else
Nil
)
:::
(
if
(
currentLibrary
!=
null
)
"libraries"
::
currentLibrary
::
Nil
else
Nil
)
:::
super
.
configFullPath
}
protected
class
ConfigFunctions
extends
super
.
ConfigFunctions
{
override
def
apply
(
key
:
String
,
default
:
Any
=
null
,
submodule
:
String
=
null
,
required
:
Boolean
=
false
,
freeVar
:
Boolean
=
true
,
sample
:
String
=
currentSample
,
library
:
String
=
currentLibrary
)
:
ConfigValue
=
{
super
.
apply
(
key
,
default
,
submodule
,
required
,
freeVar
,
sample
,
library
)
}
override
def
contains
(
key
:
String
,
submodule
:
String
=
null
,
freeVar
:
Boolean
=
true
,
sample
:
String
=
currentSample
,
library
:
String
=
currentLibrary
)
=
{
super
.
contains
(
key
,
submodule
,
freeVar
,
sample
,
library
)
}
}
}
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/ToolCommand.scala
View file @
091f86da
...
...
@@ -16,10 +16,10 @@
package
nl.lumc.sasc.biopet.core
trait
ToolCommand
extends
MainCommand
with
Logging
{
abstract
class
AbstractArgs
{
protected
abstract
class
AbstractArgs
{
}
abstract
class
AbstractOptParser
extends
scopt
.
OptionParser
[
Args
](
commandName
)
{
protected
abstract
class
AbstractOptParser
extends
scopt
.
OptionParser
[
Args
](
commandName
)
{
opt
[
String
](
'l'
,
"log_level"
)
foreach
{
x
=>
x
.
toLowerCase
match
{
case
"debug"
=>
logger
.
setLevel
(
org
.
apache
.
log4j
.
Level
.
DEBUG
)
...
...
@@ -44,6 +44,6 @@ trait ToolCommand extends MainCommand with Logging {
}
text
(
"Print version"
)
}
type
Args
<:
AbstractArgs
type
OptParser
<:
AbstractOptParser
protected
type
Args
<:
AbstractArgs
protected
type
OptParser
<:
AbstractOptParser
}
\ No newline at end of file
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
View file @
091f86da
...
...
@@ -21,9 +21,9 @@ import nl.lumc.sasc.biopet.utils.ConfigUtils.ImplicitConversions
trait
Configurable
extends
ImplicitConversions
{
val
root
:
Configurable
lazy
val
configPath
:
List
[
String
]
=
if
(
root
!=
null
)
root
.
configFullPath
else
List
()
protected
[
co
nfig
]
lazy
val
configName
=
getClass
.
getSimpleName
.
toLowerCase
protected
[
co
nfig
]
lazy
val
configFullPath
:
List
[
String
]
=
configPath
:::
configName
::
Nil
def
configPath
:
List
[
String
]
=
if
(
root
!=
null
)
root
.
configFullPath
else
List
()
protected
[
co
re
]
def
configName
=
getClass
.
getSimpleName
.
toLowerCase
protected
[
co
re
]
def
configFullPath
:
List
[
String
]
=
configPath
:::
configName
::
Nil
var
defaults
:
scala.collection.mutable.Map
[
String
,
Any
]
=
if
(
root
!=
null
)
scala
.
collection
.
mutable
.
Map
(
root
.
defaults
.
toArray
:
_
*
)
else
scala
.
collection
.
mutable
.
Map
()
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/utils/ConfigUtils.scala
View file @
091f86da
...
...
@@ -200,6 +200,7 @@ object ConfigUtils extends Logging {
any
match
{
case
i
:
Int
=>
i
case
i
:
Double
=>
i
.
toInt
case
i
:
Long
=>
i
.
toInt
case
i
:
String
=>
{
logger
.
warn
(
"Value '"
+
any
+
"' is a string insteadof int in json file, trying auto convert"
)
i
.
toInt
...
...
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