Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biopet.biopet
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Mirrors
biopet.biopet
Commits
b9963f60
Commit
b9963f60
authored
Apr 04, 2017
by
Peter van 't Hof
Committed by
GitHub
Apr 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #52 from biopet/xhmm-wisecondor-countfile
Single-sample jobs for count file generation
parents
43756e68
85e5d3c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
3 deletions
+95
-3
tarmac/src/main/scala/nl/lumc/sasc/biopet/pipelines/tarmac/Tarmac.scala
...n/scala/nl/lumc/sasc/biopet/pipelines/tarmac/Tarmac.scala
+95
-3
No files found.
tarmac/src/main/scala/nl/lumc/sasc/biopet/pipelines/tarmac/Tarmac.scala
View file @
b9963f60
...
...
@@ -4,14 +4,23 @@ import java.io.File
import
nl.lumc.sasc.biopet.core.
{
PedigreeQscript
,
PipelineCommand
,
Reference
}
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.extensions.Ln
import
nl.lumc.sasc.biopet.extensions.gatk.DepthOfCoverage
import
nl.lumc.sasc.biopet.extensions.wisecondor.WisecondorCount
import
nl.lumc.sasc.biopet.utils.Logging
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.queue.QScript
import
org.broadinstitute.gatk.queue.function.QFunction
import
scalaz.
{
-\/,
\/,
\/-
}
/**
* Created by Sander Bollen on 23-3-17.
*/
class
Tarmac
(
val
parent
:
Configurable
)
extends
QScript
with
PedigreeQscript
with
SummaryQScript
with
Reference
{
qscript
=>
private
val
targets
:
File
=
config
(
"targets"
)
def
this
()
=
this
(
null
)
def
init
()
=
{
...
...
@@ -29,13 +38,96 @@ class Tarmac(val parent: Configurable) extends QScript with PedigreeQscript with
class
Sample
(
name
:
String
)
extends
AbstractSample
(
name
)
{
val
inputCountFile
:
Option
[
File
]
=
config
(
"count_file"
)
val
inputXhmmCountFile
:
Option
[
File
]
=
config
(
"xhmm_count_file"
)
val
inputWisecondorCountFile
:
Option
[
File
]
=
config
(
"wisecondor_count_file"
)
val
bamFile
:
Option
[
File
]
=
config
(
"bam"
)
/**
* Create XHMM count file or create link to input count file
* Precedence is given to existing count files.
* Returns a disjunction where right is the file, and left is
* a potential error message
*/
protected
lazy
val
outputXhmmCountJob
:
String
\/
QFunction
=
{
val
outFile
=
new
File
(
sampleDir
+
File
.
separator
+
s
"$name.dcov"
)
(
inputXhmmCountFile
,
bamFile
)
match
{
case
(
Some
(
f
),
_
)
=>
{
if
(
bamFile
.
isDefined
)
{
logger
.
warn
(
s
"Both BAM and Xhmm count files are given for sample $name. The BAM file will be ignored"
)
}
val
ln
=
new
Ln
(
root
)
ln
.
input
=
f
ln
.
output
=
outFile
\/-(
ln
)
}
case
(
None
,
Some
(
bam
))
=>
{
val
dcov
=
DepthOfCoverage
(
root
,
List
(
bam
),
outFile
,
List
(
targets
))
\/-(
dcov
)
}
case
_
=>
-\/(
s
"Cannot find bam file or xhmm count file for sample"
+
s
" $name in config. At least one must be given."
)
}
}
/* Get count file for Xhmm method */
lazy
val
outputXhmmCountFile
:
String
\/
File
=
{
outputXhmmCountJob
match
{
case
\/-(
ln
:
Ln
)
=>
\/-(
ln
.
output
)
case
\/-(
doc
:
DepthOfCoverage
)
=>
\/-(
doc
.
out
)
case
-\/(
error
)
=>
-\/(
error
)
}
}
/**
* Create wisecondor count file or create link to input count file.
* Precedence is given to existing count files.
* Returns a disjunction where right is the file, and left is
* a potential error message
*/
protected
lazy
val
outputWisecondorCountJob
:
String
\/
QFunction
=
{
val
outFile
=
new
File
(
sampleDir
+
File
.
separator
+
s
"$name.wisecondor.bed"
)
(
inputWisecondorCountFile
,
bamFile
)
match
{
case
(
Some
(
f
),
_
)
=>
{
if
(
bamFile
.
isDefined
)
{
logger
.
warn
(
s
"Both BAM and Wisecondor count files are given for sample $name. The BAM file will be ignored"
)
}
val
ln
=
new
Ln
(
root
)
ln
.
input
=
f
ln
.
output
=
outFile
\/-(
ln
)
}
case
(
None
,
Some
(
bam
))
=>
{
val
counter
=
new
WisecondorCount
(
root
)
counter
.
inputBam
=
bam
counter
.
output
=
outFile
counter
.
binFile
=
Some
(
targets
)
\/-(
counter
)
}
case
_
=>
-\/(
s
"Cannot find bam file or wisecondor count for sample"
+
s
" $name. At least one must be given."
)
}
}
/* Get count file for wisecondor method */
lazy
val
outputWisecondorCountFile
:
String
\/
File
=
{
outputWisecondorCountJob
match
{
case
\/-(
ln
:
Ln
)
=>
\/-(
ln
.
output
)
case
\/-(
count
:
WisecondorCount
)
=>
\/-(
count
.
output
)
case
-\/(
error
)
=>
-\/(
error
)
}
}
/** Function to add sample jobs */
def
addJobs
()
:
Unit
=
{}
def
addJobs
()
:
Unit
=
{
(
outputWisecondorCountJob
::
outputXhmmCountJob
::
Nil
).
foreach
{
case
-\/(
error
)
=>
Logging
.
addError
(
error
)
case
\/-(
function
)
=>
add
(
function
)
}
}
/* This is necesary for compile reasons, but library does not in fact exist for this pipeline */
/* This is neces
s
ary for compile reasons, but library does not in fact exist for this pipeline */
def
makeLibrary
(
id
:
String
)
=
new
Library
(
id
)
class
Library
(
id
:
String
)
extends
AbstractLibrary
(
id
)
{
...
...
Write
Preview
Markdown
is supported
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