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
face5d0e
Commit
face5d0e
authored
Nov 09, 2016
by
Peter van 't Hof
Browse files
Fixing BIOPET-413 and BIOPET-416
parent
15658350
Changes
4
Hide whitespace changes
Inline
Side-by-side
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsCentrifuge.scala
View file @
face5d0e
...
...
@@ -2,7 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.gears
import
nl.lumc.sasc.biopet.core.SampleLibraryTag
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.extensions.Gzip
import
nl.lumc.sasc.biopet.extensions.
{
Gzip
,
Zcat
}
import
nl.lumc.sasc.biopet.extensions.centrifuge.
{
Centrifuge
,
CentrifugeKreport
}
import
nl.lumc.sasc.biopet.extensions.tools.KrakenReportToJson
import
nl.lumc.sasc.biopet.utils.config.Configurable
...
...
@@ -27,30 +27,28 @@ class GearsCentrifuge(val root: Configurable) extends QScript with SummaryQScrip
}
def
centrifugeOutput
=
new
File
(
outputDir
,
s
"$outputName.centrifuge.gz"
)
def
centrifugeMetOutput
=
new
File
(
outputDir
,
s
"$outputName.centrifuge.met"
)
def
biopetScript
()
:
Unit
=
{
val
centrifuge
=
new
Centrifuge
(
this
)
centrifuge
.
inputR1
=
fastqR1
centrifuge
.
inputR2
=
fastqR2
centrifuge
.
output
=
new
File
(
outputDir
,
s
"$outputName.centrifuge"
)
centrifuge
.
report
=
Some
(
new
File
(
outputDir
,
s
"$outputName.centrifuge.report"
))
centrifuge
.
isIntermediate
=
true
add
(
centrifuge
)
centrifuge
.
metFile
=
Some
(
centrifugeMetOutput
)
val
centrifugeCmd
=
centrifuge
|
new
Gzip
(
this
)
>
centrifugeOutput
add
(
centrifugeCmd
)
add
(
Gzip
(
this
,
centrifuge
.
output
,
centrifugeOutput
))
makeKreport
(
List
(
centrifuge
.
output
),
"centrifuge"
,
unique
=
false
)
makeKreport
(
List
(
centrifuge
.
output
),
"centrifuge_unique"
,
unique
=
true
)
makeKreport
(
"centrifuge"
,
unique
=
false
)
makeKreport
(
"centrifuge_unique"
,
unique
=
true
)
addSummaryJobs
()
}
protected
def
makeKreport
(
inputFiles
:
List
[
File
],
name
:
String
,
unique
:
Boolean
)
:
Unit
=
{
protected
def
makeKreport
(
name
:
String
,
unique
:
Boolean
)
:
Unit
=
{
val
centrifugeKreport
=
new
CentrifugeKreport
(
this
)
centrifugeKreport
.
centrifugeOutputFiles
=
inputFiles
centrifugeKreport
.
output
=
new
File
(
outputDir
,
s
"$outputName.$name.kreport"
)
centrifugeKreport
.
onlyUnique
=
unique
add
(
centrifugeKreport
)
add
(
centrifugeOutput
:<:
Zcat
(
this
)
|
centrifugeKreport
)
val
krakenReportJSON
=
new
KrakenReportToJson
(
this
)
krakenReportJSON
.
inputReport
=
centrifugeKreport
.
output
...
...
@@ -72,5 +70,4 @@ class GearsCentrifuge(val root: Configurable) extends QScript with SummaryQScrip
case
Some
(
file
)
=>
Map
(
"input_R2"
->
file
)
case
_
=>
Map
()
})
}
gears/src/test/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsSingleTest.scala
View file @
face5d0e
...
...
@@ -129,8 +129,8 @@ abstract class TestGearsSingle extends TestNGSuite with Matchers {
gears
.
functions
.
count
(
_
.
isInstanceOf
[
KrakenReportToJson
])
shouldBe
((
if
(
kraken
.
getOrElse
(
false
))
1
else
0
)
+
(
if
(
centrifuge
)
2
else
0
))
gears
.
function
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
centrifuge
)
1
else
0
)
gears
.
function
s
.
count
(
_
.
isInstanceOf
[
CentrifugeKreport
])
shouldBe
(
if
(
centrifuge
)
2
else
0
)
pipesJob
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
centrifuge
)
1
else
0
)
pipesJob
s
.
count
(
_
.
isInstanceOf
[
CentrifugeKreport
])
shouldBe
(
if
(
centrifuge
)
2
else
0
)
}
}
}
...
...
mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
View file @
face5d0e
...
...
@@ -17,6 +17,7 @@ package nl.lumc.sasc.biopet.pipelines.mapping
import
java.io.
{
File
,
FileOutputStream
}
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.core.BiopetPipe
import
nl.lumc.sasc.biopet.extensions.centrifuge.Centrifuge
import
nl.lumc.sasc.biopet.extensions.kraken.Kraken
import
nl.lumc.sasc.biopet.pipelines.flexiprep.Fastqc
...
...
@@ -86,10 +87,12 @@ abstract class AbstractTestMapping(val aligner: String) extends TestNGSuite with
mapping
.
libId
=
Some
(
"1"
)
mapping
.
script
()
val
pipesJobs
=
mapping
.
functions
.
filter
(
_
.
isInstanceOf
[
BiopetPipe
]).
flatMap
(
_
.
asInstanceOf
[
BiopetPipe
].
pipesJobs
)
//Flexiprep
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Fastqc
])
shouldBe
(
if
(
skipFlexiprep
)
0
else
if
(
paired
)
4
else
2
)
mapping
.
function
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
unmappedToGears
)
1
else
0
)
pipesJob
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
unmappedToGears
)
1
else
0
)
}
val
outputDir
=
Files
.
createTempDir
()
...
...
mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingTest.scala
View file @
face5d0e
...
...
@@ -17,6 +17,7 @@ package nl.lumc.sasc.biopet.pipelines.mapping
import
java.io.
{
File
,
FileOutputStream
}
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.core.BiopetPipe
import
nl.lumc.sasc.biopet.extensions.centrifuge.Centrifuge
import
nl.lumc.sasc.biopet.extensions.kraken.Kraken
import
nl.lumc.sasc.biopet.extensions.picard.
{
MarkDuplicates
,
MergeSamFiles
}
...
...
@@ -88,6 +89,8 @@ trait MultisampleMappingTestTrait extends TestNGSuite with Matchers {
val
numberFastqLibs
=
(
if
(
sample1
)
1
else
0
)
+
(
if
(
sample2
)
2
else
0
)
+
(
if
(
sample3
&&
bamToFastq
)
1
else
0
)
+
(
if
(
sample4
&&
bamToFastq
)
1
else
0
)
val
numberSamples
=
(
if
(
sample1
)
1
else
0
)
+
(
if
(
sample2
)
1
else
0
)
val
pipesJobs
=
pipeline
.
functions
.
filter
(
_
.
isInstanceOf
[
BiopetPipe
]).
flatMap
(
_
.
asInstanceOf
[
BiopetPipe
].
pipesJobs
)
import
MultisampleMapping.MergeStrategy
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
MarkDuplicates
])
shouldBe
(
numberFastqLibs
+
(
if
(
sample2
&&
(
merge
==
MergeStrategy
.
MarkDuplicates
||
merge
==
MergeStrategy
.
PreProcessMarkDuplicates
))
1
else
0
))
...
...
@@ -103,7 +106,7 @@ trait MultisampleMappingTestTrait extends TestNGSuite with Matchers {
}
}
pipe
line
.
function
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
unmappedToGears
)
(
numberFastqLibs
+
numberSamples
)
else
0
)
pipe
sJob
s
.
count
(
_
.
isInstanceOf
[
Centrifuge
])
shouldBe
(
if
(
unmappedToGears
)
(
numberFastqLibs
+
numberSamples
)
else
0
)
pipeline
.
summarySettings
.
get
(
"merge_strategy"
)
shouldBe
Some
(
merge
.
toString
)
}
...
...
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