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
1410432c
Commit
1410432c
authored
Jan 27, 2015
by
Peter van 't Hof
Browse files
Switch to abstract init function
parent
7911ce0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
1410432c
...
...
@@ -17,11 +17,8 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
nl.lumc.sasc.biopet.core.config.
{
Config
Value
,
Config
,
Configurable
}
import
nl.lumc.sasc.biopet.core.config.
{
Config
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.ConfigUtils._
import
scala.reflect.ClassTag
import
scala.reflect._
import
org.broadinstitute.gatk.utils.commandline.
{
Argument
}
trait
MultiSampleQScript
extends
BiopetQScript
{
...
...
@@ -52,7 +49,9 @@ trait MultiSampleQScript extends BiopetQScript {
type
Library
<:
AbstractLibrary
val
libraries
:
Map
[
String
,
Library
]
=
getLibrariesIds
.
map
(
id
=>
id
->
initClass
(
id
)).
toMap
val
libraries
:
Map
[
String
,
Library
]
=
getLibrariesIds
.
map
(
id
=>
id
->
initLibrary
(
id
)).
toMap
def
initLibrary
(
id
:
String
)
:
Library
protected
def
getLibrariesIds
:
Set
[
String
]
=
{
ConfigUtils
.
getMapFromPath
(
Config
.
global
.
map
,
List
(
"samples"
,
sampleId
,
"libraries"
)).
getOrElse
(
Map
()).
keySet
...
...
@@ -79,14 +78,9 @@ trait MultiSampleQScript extends BiopetQScript {
type
Sample
<:
AbstractSample
final
private
def
initClass
[
T:
ClassTag
](
arg
:
String
)
:
T
=
{
logger
.
debug
(
"init of: "
+
classTag
[
T
])
val
x
=
classTag
[
T
].
runtimeClass
.
getConstructor
(
classOf
[
String
]).
newInstance
(
arg
).
asInstanceOf
[
T
]
logger
.
debug
(
"init of: "
+
classTag
[
T
]
+
" Done"
)
x
}
def
initSample
(
id
:
String
)
:
Sample
val
samples
:
Map
[
String
,
Sample
]
=
getSamplesIds
.
map
(
id
=>
id
->
init
Class
(
id
)).
toMap
val
samples
:
Map
[
String
,
Sample
]
=
getSamplesIds
.
map
(
id
=>
id
->
init
Sample
(
id
)).
toMap
/** Returns a list of all sampleIDs */
protected
def
getSamplesIds
:
Set
[
String
]
=
if
(
onlySample
!=
Nil
)
onlySample
.
toSet
else
{
...
...
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