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
4b011fa8
Commit
4b011fa8
authored
Feb 13, 2015
by
Peter van 't Hof
Browse files
Intial unit test for Carp
parent
3e1bc47a
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/carp/src/test/scala/nl/lumc/sasc/biopet/pipelines/carp/CarpTest.scala
0 → 100644
View file @
4b011fa8
package
nl.lumc.sasc.biopet.pipelines.carp
import
java.io.File
import
nl.lumc.sasc.biopet.core.config.
{
ConfigValueIndex
,
Config
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
org.broadinstitute.gatk.queue.QSettings
import
org.testng.annotations.
{
DataProvider
,
Test
}
import
org.testng.annotations.
{
Test
,
DataProvider
}
import
org.scalatest.Assertions._
/**
* Created by pjvan_thof on 2/13/15.
*/
class
CarpTest
{
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
Carp
=
{
new
Carp
()
{
override
def
configName
=
"carp"
override
def
globalConfig
=
new
Config
(
map
)
qSettings
=
new
QSettings
qSettings
.
runName
=
"test"
}
}
@DataProvider
(
name
=
"carpOptions"
,
parallel
=
true
)
def
carpOptions
=
{
val
bool
=
Array
(
true
,
false
)
for
(
s1
<-
bool
;
s2
<-
bool
;
s3
<-
bool
;
t
<-
bool
;
c
<-
bool
)
yield
Array
(
""
,
s1
,
s2
,
s3
,
t
,
c
)
}
@Test
(
dataProvider
=
"carpOptions"
)
def
testCarp
(
f
:
String
,
sample1
:
Boolean
,
sample2
:
Boolean
,
sample3
:
Boolean
,
threatment
:
Boolean
,
control
:
Boolean
)
:
Unit
=
{
val
map
=
{
var
m
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
CarpTest
.
outputDir
),
CarpTest
.
excutables
)
if
(
sample1
)
m
=
ConfigUtils
.
mergeMaps
(
CarpTest
.
sample1
,
m
.
toMap
)
if
(
sample2
)
m
=
ConfigUtils
.
mergeMaps
(
CarpTest
.
sample2
,
m
.
toMap
)
if
(
sample3
)
m
=
ConfigUtils
.
mergeMaps
(
CarpTest
.
sample3
,
m
.
toMap
)
if
(
threatment
)
m
=
ConfigUtils
.
mergeMaps
(
CarpTest
.
threatment1
,
m
.
toMap
)
if
(
control
)
m
=
ConfigUtils
.
mergeMaps
(
CarpTest
.
control1
,
m
.
toMap
)
m
}
if
(!
sample1
&&
!
sample2
&&
!
sample3
&&
!
threatment
&&
!
control
)
{
// When no samples
intercept
[
IllegalArgumentException
]
{
initPipeline
(
map
).
script
()
}
}
else
if
(
threatment
&&
!
control
)
{
// If control of a samples does not exist in samples
intercept
[
IllegalStateException
]
{
initPipeline
(
map
).
script
()
}
}
else
{
// When samples are correct
val
carp
=
initPipeline
(
map
)
carp
.
script
()
}
}
}
object
CarpTest
{
val
outputDir
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
+
"flexiprep"
val
excutables
=
Map
(
"reference"
->
"test"
,
"seqstat"
->
Map
(
"exe"
->
"test"
),
"fastqc"
->
Map
(
"exe"
->
"test"
),
"seqtk"
->
Map
(
"exe"
->
"test"
),
"sickle"
->
Map
(
"exe"
->
"test"
),
"bwa"
->
Map
(
"exe"
->
"test"
),
"samtools"
->
Map
(
"exe"
->
"test"
),
"macs2"
->
Map
(
"exe"
->
"test"
)
)
val
sample1
=
Map
(
"samples"
->
Map
(
"sample1"
->
Map
(
"libraries"
->
Map
(
"lib1"
->
Map
(
"R1"
->
"1_1_R1.fq"
,
"R2"
->
"1_1_R2.fq"
)
)
)))
val
sample2
=
Map
(
"samples"
->
Map
(
"sample2"
->
Map
(
"libraries"
->
Map
(
"lib1"
->
Map
(
"R1"
->
"2_1_R1.fq"
,
"R2"
->
"2_1_R2.fq"
)
)
)))
val
sample3
=
Map
(
"samples"
->
Map
(
"sample3"
->
Map
(
"libraries"
->
Map
(
"lib1"
->
Map
(
"R1"
->
"3_1_R1.fq"
,
"R2"
->
"3_1_R2.fq"
),
"lib2"
->
Map
(
"R1"
->
"3_2_R1.fq"
,
"R2"
->
"3_2_R2.fq"
)
)
)))
val
threatment1
=
Map
(
"samples"
->
Map
(
"threatment"
->
Map
(
"control"
->
"control1"
,
"libraries"
->
Map
(
"lib1"
->
Map
(
"R1"
->
"threatment_1_R1.fq"
,
"R2"
->
"threatment_1_R2.fq"
)
)
)))
val
control1
=
Map
(
"samples"
->
Map
(
"control1"
->
Map
(
"libraries"
->
Map
(
"lib1"
->
Map
(
"R1"
->
"control_1_R1.fq"
,
"R2"
->
"control_1_R2.fq"
)
)
)))
}
\ No newline at end of file
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