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
43f8ced5
Commit
43f8ced5
authored
Jan 14, 2015
by
Peter van 't Hof
Browse files
Added scala docs
parent
01fa6166
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
43f8ced5
...
...
@@ -30,25 +30,47 @@ trait MultiSampleQScript extends BiopetQScript {
}
if
(!
config
.
contains
(
"samples"
))
logger
.
warn
(
"No Samples found in config"
)
/**
* Returns a map with all sample configs
*/
val
getSamplesConfig
:
Map
[
String
,
Any
]
=
config
(
"samples"
,
default
=
Map
())
/**
* Returns a list of all sampleIDs
*/
val
getSamples
:
Set
[
String
]
=
getSamplesConfig
.
keySet
/**
* Returns the global sample directory
* @return global sample directory
*/
def
globalSampleDir
:
String
=
outputDir
+
"samples/"
var
samplesOutput
:
Map
[
String
,
SampleOutput
]
=
Map
()
/**
* Runs runSingleSampleJobs method for each sample
*/
final
def
runSamplesJobs
()
{
for
((
key
,
value
)
<-
getSamplesConfig
)
{
var
sample
=
any2map
(
value
)
if
(!
sample
.
contains
(
"ID"
))
sample
+=
(
"ID"
->
key
)
if
(
sample
(
"ID"
)
==
key
)
{
setC
urrentSample
(
key
)
c
urrentSample
=
key
samplesOutput
+=
key
->
runSingleSampleJobs
(
sample
)
unsetC
urrentSample
()
c
urrentSample
=
null
}
else
logger
.
warn
(
"Key is not the same as ID on value for sample"
)
}
}
def
runSingleSampleJobs
(
sampleConfig
:
Map
[
String
,
Any
])
:
SampleOutput
/**
* Run sample with only sampleID
* @param sample sampleID
* @return
*/
def
runSingleSampleJobs
(
sample
:
String
)
:
SampleOutput
=
{
var
map
=
any2map
(
getSamplesConfig
(
sample
))
if
(
map
.
contains
(
"ID"
)
&&
map
(
"ID"
)
!=
sample
)
...
...
@@ -57,6 +79,11 @@ trait MultiSampleQScript extends BiopetQScript {
return
runSingleSampleJobs
(
map
)
}
/**
* Runs runSingleLibraryJobs method for each library found in sampleConfig
* @param sampleConfig sample config
* @return Map with libraryID -> LibraryOutput object
*/
final
def
runLibraryJobs
(
sampleConfig
:
Map
[
String
,
Any
])
:
Map
[
String
,
LibraryOutput
]
=
{
var
output
:
Map
[
String
,
LibraryOutput
]
=
Map
()
val
sampleID
=
sampleConfig
(
"ID"
).
toString
...
...
@@ -66,9 +93,9 @@ trait MultiSampleQScript extends BiopetQScript {
var
library
=
any2map
(
value
)
if
(!
library
.
contains
(
"ID"
))
library
+=
(
"ID"
->
key
)
if
(
library
(
"ID"
)
==
key
)
{
setC
urrentLibrary
(
key
)
c
urrentLibrary
=
key
output
+=
key
->
runSingleLibraryJobs
(
library
,
sampleConfig
)
unsetC
urrentLibrary
()
c
urrentLibrary
=
null
}
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
)
...
...
@@ -76,26 +103,52 @@ trait MultiSampleQScript extends BiopetQScript {
}
def
runSingleLibraryJobs
(
runConfig
:
Map
[
String
,
Any
],
sampleConfig
:
Map
[
String
,
Any
])
:
LibraryOutput
pr
ivate
var
currentSample
:
String
=
null
pr
ivate
var
currentLibrary
:
String
=
null
pr
otected
var
currentSample
:
String
=
null
pr
otected
var
currentLibrary
:
String
=
null
/**
* Set current sample manual, only use this when not using runSamplesJobs method
* @param sample
*/
def
setCurrentSample
(
sample
:
String
)
{
logger
.
debug
(
"Manual sample set to: "
+
sample
)
currentSample
=
sample
}
/**
* Gets current sample
* @return current sample
*/
def
getCurrentSample
=
currentSample
def
unsetCurrentSample
()
{
/**
* Reset current sample manual, only use this when not using runSamplesJobs method
*/
def
resetCurrentSample
()
{
logger
.
debug
(
"Manual sample reset"
)
currentSample
=
null
}
/**
* Set current library manual, only use this when not using runLibraryJobs method
* @param library
*/
def
setCurrentLibrary
(
library
:
String
)
{
logger
.
debug
(
"Manual library set to: "
+
library
)
currentLibrary
=
library
}
/**
* Gets current library
* @return current library
*/
def
getCurrentLibrary
=
currentLibrary
def
unsetCurrentLibrary
()
{
/**
* Reset current library manual, only use this when not using runLibraryJobs method
*/
def
resetCurrentLibrary
()
{
logger
.
debug
(
"Manual library reset"
)
currentLibrary
=
null
}
...
...
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