Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mirrors
biopet.biopet
Commits
4a71cc17
Commit
4a71cc17
authored
Mar 02, 2015
by
Peter van 't Hof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding basic unit tests
parent
725b91d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
0 deletions
+100
-0
public/shiva/.gitignore
public/shiva/.gitignore
+1
-0
public/shiva/pom.xml
public/shiva/pom.xml
+12
-0
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaVariantcallingTrait.scala
...asc/biopet/pipelines/shiva/ShivaVariantcallingTrait.scala
+3
-0
public/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaVariantcallingTest.scala
...sasc/biopet/pipelines/shiva/ShivaVariantcallingTest.scala
+84
-0
No files found.
public/shiva/.gitignore
0 → 100644
View file @
4a71cc17
target
public/shiva/pom.xml
View file @
4a71cc17
...
@@ -23,6 +23,18 @@
...
@@ -23,6 +23,18 @@
<artifactId>
Mapping
</artifactId>
<artifactId>
Mapping
</artifactId>
<version>
${project.version}
</version>
<version>
${project.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.8
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.scalatest
</groupId>
<artifactId>
scalatest_2.11
</artifactId>
<version>
2.2.1
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaVariantcallingTrait.scala
View file @
4a71cc17
...
@@ -40,6 +40,9 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
...
@@ -40,6 +40,9 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
def
biopetScript
:
Unit
=
{
def
biopetScript
:
Unit
=
{
val
callers
=
usedCallers
.
sortBy
(
_
.
prio
)
val
callers
=
usedCallers
.
sortBy
(
_
.
prio
)
require
(!
inputBams
.
isEmpty
,
"No input bams found"
)
require
(
callers
.
exists
(
_
.
use
),
"must select atleast 1 variantcaller"
)
val
cv
=
new
CombineVariants
(
qscript
)
val
cv
=
new
CombineVariants
(
qscript
)
cv
.
outputFile
=
finalFile
cv
.
outputFile
=
finalFile
cv
.
setKey
=
"VariantCaller"
cv
.
setKey
=
"VariantCaller"
...
...
public/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaVariantcallingTest.scala
0 → 100644
View file @
4a71cc17
package
nl.lumc.sasc.biopet.pipelines.shiva
import
java.io.File
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.core.config.Config
import
nl.lumc.sasc.biopet.extensions.bcftools.Bcftools
import
nl.lumc.sasc.biopet.extensions.gatk.CombineVariants
import
nl.lumc.sasc.biopet.tools.
{
VcfFilter
,
MpileupToVcf
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
org.apache.commons.io.FileUtils
import
org.broadinstitute.gatk.queue.QSettings
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.
{
AfterClass
,
Test
,
DataProvider
}
/**
* Created by pjvan_thof on 3/2/15.
*/
class
ShivaVariantcallingTest
extends
TestNGSuite
with
Matchers
{
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
ShivaVariantcalling
=
{
new
ShivaVariantcalling
{
override
def
configName
=
"shivavariantcalling"
override
def
globalConfig
=
new
Config
(
ConfigUtils
.
mergeMaps
(
map
,
ShivaVariantcallingTest
.
config
))
qSettings
=
new
QSettings
qSettings
.
runName
=
"test"
}
}
@DataProvider
(
name
=
"shivaVariantcallingOptions"
)
def
mappingOptions
=
{
val
raw
=
Array
(
true
,
false
)
val
bcftools
=
Array
(
true
,
false
)
(
for
(
bams
<-
0
to
3
;
raw
<-
raw
;
bcftools
<-
bcftools
)
yield
Array
[
Any
](
bams
,
raw
,
bcftools
)
).
toArray
}
@Test
(
dataProvider
=
"shivaVariantcallingOptions"
)
def
testShivaVariantcalling
(
bams
:
Int
,
raw
:
Boolean
,
bcftools
:
Boolean
)
=
{
val
map
=
Map
(
"use_raw"
->
raw
,
"use_bcftools"
->
bcftools
)
val
pipeline
=
initPipeline
(
map
)
pipeline
.
inputBams
=
(
for
(
n
<-
1
to
bams
)
yield
new
File
(
"bam_"
+
n
+
".bam"
)).
toList
val
illegalArgumentException
=
pipeline
.
inputBams
.
isEmpty
||
!
raw
&&
!
bcftools
if
(
illegalArgumentException
)
intercept
[
IllegalArgumentException
]
{
pipeline
.
script
()
}
if
(!
illegalArgumentException
)
{
pipeline
.
script
()
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
CombineVariants
])
shouldBe
1
+
(
if
(
raw
)
1
else
0
)
//pipeline.functions.count(_.isInstanceOf[Bcftools]) shouldBe (if (bcftools) 1 else 0)
//FIXME: Can not check for bcftools because of piping
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
MpileupToVcf
])
shouldBe
(
if
(
raw
)
bams
else
0
)
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
VcfFilter
])
shouldBe
(
if
(
raw
)
bams
else
0
)
}
}
@AfterClass
def
removeTempOutputDir
()
=
{
FileUtils
.
deleteDirectory
(
ShivaVariantcallingTest
.
outputDir
)
}
}
object
ShivaVariantcallingTest
{
val
outputDir
=
Files
.
createTempDir
()
val
config
=
Map
(
"name_prefix"
->
"test"
,
"output_dir"
->
outputDir
,
"reference"
->
"test"
,
"gatk_jar"
->
"test"
,
"samtools"
->
Map
(
"exe"
->
"test"
),
"bcftools"
->
Map
(
"exe"
->
"test"
)
)
}
\ No newline at end of file
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