Skip to content
GitLab
Menu
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
1c17513c
Commit
1c17513c
authored
Dec 28, 2015
by
Peter van 't Hof
Browse files
Added gender and groups to samples
parent
9705d77d
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/MultiSampleQScript.scala
View file @
1c17513c
...
...
@@ -17,10 +17,10 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
nl.lumc.sasc.biopet.core.MultiSampleQScript.Gender
import
nl.lumc.sasc.biopet.core.summary.
{
Summarizable
,
SummaryQScript
}
import
nl.lumc.sasc.biopet.utils.
{
Logging
,
ConfigUtils
}
import
org.broadinstitute.gatk.queue.QScript
import
org.broadinstitute.gatk.utils.commandline.Argument
/** This trait creates a structured way of use multisample pipelines */
trait
MultiSampleQScript
extends
SummaryQScript
{
qscript
:
QScript
=>
...
...
@@ -69,6 +69,8 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
/** Returns library directory */
def
libDir
=
new
File
(
sampleDir
,
"lib_"
+
libId
)
lazy
val
groups
:
List
[
String
]
=
config
(
"groups"
,
sample
=
sampleId
,
library
=
libId
)
/** Function that add library jobs */
protected
def
addJobs
()
}
...
...
@@ -79,6 +81,39 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
/** Stores all libraries */
val
libraries
:
Map
[
String
,
Library
]
=
libIds
.
map
(
id
=>
id
->
makeLibrary
(
id
)).
toMap
lazy
val
gender
=
{
val
g
:
Option
[
String
]
=
config
(
"gender"
,
sample
=
sampleId
,
library
=
null
)
g
.
map
(
_
.
toLowerCase
)
match
{
case
Some
(
"male"
)
=>
Gender
.
Male
case
Some
(
"female"
)
=>
Gender
.
Female
case
_
=>
Gender
.
Unknown
}
}
lazy
val
father
=
{
val
g
:
Option
[
String
]
=
config
(
"gender"
,
sample
=
sampleId
,
library
=
null
)
g
.
foreach
{
father
=>
if
(
sampleId
!=
father
)
Logging
.
addError
(
s
"Father for $sampleId can not be itself"
)
if
(
samples
.
contains
(
father
))
if
(
samples
(
father
).
gender
==
Gender
.
Male
)
Logging
.
addError
(
s
"Father of $sampleId is not a female"
)
else
logger
.
warn
(
s
"For sample '$sampleId' is father '$father' not found in config"
)
}
g
}
lazy
val
mother
=
{
val
g
:
Option
[
String
]
=
config
(
"gender"
,
sample
=
sampleId
,
library
=
null
)
g
.
foreach
{
mother
=>
if
(
sampleId
!=
mother
)
Logging
.
addError
(
s
"mother for $sampleId can not be itself"
)
if
(
samples
.
contains
(
mother
))
if
(
samples
(
mother
).
gender
==
Gender
.
Female
)
Logging
.
addError
(
s
"Mother of $sampleId is not a female"
)
else
logger
.
warn
(
s
"For sample '$sampleId' is mother '$mother' not found in config"
)
}
g
}
lazy
val
groups
:
List
[
String
]
=
config
(
"groups"
,
sample
=
sampleId
,
library
=
null
)
/**
* Factory method for Library class
* @param id SampleId
...
...
@@ -180,3 +215,10 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
sample
:::
lib
:::
super
.
configFullPath
}
}
object
MultiSampleQScript
{
object
Gender
extends
Enumeration
{
val
Male
,
Female
,
Unknown
=
Value
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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