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
7911ce0e
Commit
7911ce0e
authored
Jan 26, 2015
by
Peter van 't Hof
Browse files
Moved init of vars
parent
edd629fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
7911ce0e
...
...
@@ -20,6 +20,8 @@ import java.io.File
import
nl.lumc.sasc.biopet.core.config.
{
ConfigValue
,
Config
,
Configurable
}
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
{
...
...
@@ -28,12 +30,10 @@ trait MultiSampleQScript extends BiopetQScript {
if
(!
Config
.
global
.
map
.
contains
(
"samples"
))
logger
.
warn
(
"No Samples found in config"
)
type
Sample
<:
AbstractSample
abstract
class
AbstractSample
{
val
sampleId
:
String
abstract
class
AbstractSample
(
val
sampleId
:
String
)
{
val
config
=
new
ConfigFunctions
(
defaultSample
=
Some
(
sampleId
))
abstract
class
AbstractLibrary
{
val
libraryId
:
String
abstract
class
AbstractLibrary
(
val
libraryId
:
String
)
{
val
config
=
new
ConfigFunctions
(
defaultSample
=
Some
(
sampleId
),
defaultLibrary
=
Some
(
libraryId
))
final
def
run
()
:
Unit
=
{
currentSample
=
Some
(
sampleId
)
...
...
@@ -49,8 +49,11 @@ trait MultiSampleQScript extends BiopetQScript {
protected
def
runJobs
()
}
type
Library
<:
AbstractLibrary
val
libraries
:
Map
[
String
,
Library
]
=
getLibrariesIds
.
map
(
id
=>
id
->
initClass
(
id
)).
toMap
protected
def
getLibrariesIds
:
Set
[
String
]
=
{
ConfigUtils
.
getMapFromPath
(
Config
.
global
.
map
,
List
(
"samples"
,
sampleId
,
"libraries"
)).
getOrElse
(
Map
()).
keySet
}
...
...
@@ -63,8 +66,6 @@ trait MultiSampleQScript extends BiopetQScript {
protected
def
runJobs
()
val
libraries
:
Map
[
String
,
Library
]
protected
final
def
runLibraryJobs
()
:
Unit
=
{
for
((
libraryId
,
library
)
<-
libraries
)
{
library
.
run
()
...
...
@@ -76,7 +77,16 @@ trait MultiSampleQScript extends BiopetQScript {
}
}
var
samples
:
Map
[
String
,
Sample
]
=
Map
()
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
}
val
samples
:
Map
[
String
,
Sample
]
=
getSamplesIds
.
map
(
id
=>
id
->
initClass
(
id
)).
toMap
/** Returns a list of all sampleIDs */
protected
def
getSamplesIds
:
Set
[
String
]
=
if
(
onlySample
!=
Nil
)
onlySample
.
toSet
else
{
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/MultisamplePipelineTemplate.scala
View file @
7911ce0e
...
...
@@ -22,11 +22,9 @@ import org.broadinstitute.gatk.queue.QScript
class
MultisamplePipelineTemplate
(
val
root
:
Configurable
)
extends
QScript
with
MultiSampleQScript
{
def
this
()
=
this
(
null
)
class
Sample
(
val
sampleId
:
String
)
extends
AbstractSample
{
class
Sample
(
sampleId
:
String
)
extends
AbstractSample
(
sampleId
)
{
val
libraries
:
Map
[
String
,
Library
]
=
getLibrariesIds
.
map
(
id
=>
id
->
new
Library
(
id
)).
toMap
class
Library
(
val
libraryId
:
String
)
extends
AbstractLibrary
{
class
Library
(
libraryId
:
String
)
extends
AbstractLibrary
(
libraryId
)
{
def
runJobs
()
:
Unit
=
{
// Library jobs
}
...
...
@@ -38,7 +36,6 @@ class MultisamplePipelineTemplate(val root: Configurable) extends QScript with M
}
def
init
()
:
Unit
=
{
samples
=
getSamplesIds
.
map
(
id
=>
id
->
new
Sample
(
id
)).
toMap
}
def
biopetScript
()
{
...
...
public/sage/src/main/scala/nl/lumc/sasc/biopet/pipelines/sage/Sage.scala
View file @
7911ce0e
...
...
@@ -54,11 +54,9 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
)
)
class
Sample
(
val
sampleId
:
String
)
extends
AbstractSample
{
class
Sample
(
sampleId
:
String
)
extends
AbstractSample
(
sampleId
)
{
val
libraries
:
Map
[
String
,
Library
]
=
getLibrariesIds
.
map
(
id
=>
id
->
new
Library
(
id
)).
toMap
class
Library
(
val
libraryId
:
String
)
extends
AbstractLibrary
{
class
Library
(
libraryId
:
String
)
extends
AbstractLibrary
(
libraryId
)
{
val
inputFastq
:
File
=
config
(
"R1"
,
required
=
true
)
val
prefixFastq
:
File
=
new
File
(
getLibraryDir
,
sampleId
+
"-"
+
libraryId
+
".prefix.fastq"
)
...
...
@@ -129,7 +127,6 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
}
def
init
()
{
samples
=
getSamplesIds
.
map
(
id
=>
id
->
new
Sample
(
id
)).
toMap
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
if
(
transcriptome
==
null
&&
tagsLibrary
==
null
)
throw
new
IllegalStateException
(
"No transcriptome or taglib found"
)
...
...
@@ -198,3 +195,10 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
}
object
Sage
extends
PipelineCommand
object
SageTest
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
sage
=
new
Sage
()
println
(
"done"
)
}
}
\ No newline at end of file
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