Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
36641e26
Commit
36641e26
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added 128 unit tests to mapping pipeline
parent
953e054c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/mapping/pom.xml
+12
-0
12 additions, 0 deletions
public/mapping/pom.xml
public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
+115
-0
115 additions, 0 deletions
...a/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
with
127 additions
and
0 deletions
public/mapping/pom.xml
+
12
−
0
View file @
36641e26
...
...
@@ -49,5 +49,17 @@
<artifactId>
BamMetrics
</artifactId>
<version>
${project.version}
</version>
</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>
</project>
This diff is collapsed.
Click to expand it.
public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
0 → 100644
+
115
−
0
View file @
36641e26
package
nl.lumc.sasc.biopet.pipelines.mapping
import
java.io.File
import
nl.lumc.sasc.biopet.core.config.Config
import
nl.lumc.sasc.biopet.extensions.bwa.
{
BwaSamse
,
BwaSampe
,
BwaAln
,
BwaMem
}
import
nl.lumc.sasc.biopet.extensions.picard.
{
MergeSamFiles
,
AddOrReplaceReadGroups
,
MarkDuplicates
,
SortSam
}
import
nl.lumc.sasc.biopet.extensions._
import
nl.lumc.sasc.biopet.pipelines.flexiprep.Cutadapt
import
nl.lumc.sasc.biopet.pipelines.flexiprep.Fastqc
import
nl.lumc.sasc.biopet.pipelines.flexiprep.Sickle
import
nl.lumc.sasc.biopet.pipelines.flexiprep._
import
nl.lumc.sasc.biopet.tools.FastqSync
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
org.broadinstitute.gatk.queue.QSettings
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.
{
DataProvider
,
Test
}
/**
* Created by pjvan_thof on 2/12/15.
*/
class
MappingTest
extends
TestNGSuite
with
Matchers
{
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
Mapping
=
{
new
Mapping
{
override
def
configName
=
"mapping"
override
def
globalConfig
=
new
Config
(
map
)
qSettings
=
new
QSettings
qSettings
.
runName
=
"test."
+
System
.
currentTimeMillis
}
}
@DataProvider
(
name
=
"mappingOptions"
,
parallel
=
true
)
def
mappingOptions
=
{
val
aligners
=
Array
(
"bwa"
,
"bwa-aln"
,
"star"
,
"bowtie"
)
val
paired
=
Array
(
true
,
false
)
val
chunks
=
Array
(
1
,
5
,
10
,
100
)
val
skipMarkDuplicates
=
Array
(
true
,
false
)
val
skipFlexipreps
=
Array
(
true
,
false
)
for
(
aligner
<-
aligners
;
pair
<-
paired
;
chunk
<-
chunks
;
skipMarkDuplicate
<-
skipMarkDuplicates
;
skipFlexiprep
<-
skipFlexipreps
)
yield
Array
(
aligner
,
pair
,
chunk
,
skipMarkDuplicate
,
skipFlexiprep
)
}
@Test
(
dataProvider
=
"mappingOptions"
)
def
testMapping
(
aligner
:
String
,
paired
:
Boolean
,
chunks
:
Int
,
skipMarkDuplicate
:
Boolean
,
skipFlexiprep
:
Boolean
)
=
{
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
MappingTest
.
outputDir
,
"aligner"
->
aligner
,
"number_chunks"
->
chunks
,
"skip_markduplicates"
->
skipMarkDuplicate
,
"skip_flexiprep"
->
skipFlexiprep
),
Map
(
MappingTest
.
excutables
.
toSeq
:
_
*
))
val
mapping
:
Mapping
=
initPipeline
(
map
)
mapping
.
input_R1
=
new
File
(
mapping
.
outputDir
,
"bla_R1.fq"
)
if
(
paired
)
mapping
.
input_R2
=
Some
(
new
File
(
mapping
.
outputDir
,
"bla_R2.fq"
))
mapping
.
sampleId
=
"1"
mapping
.
libId
=
"1"
mapping
.
script
()
//Flexiprep
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Fastqc
])
shouldBe
(
if
(
skipFlexiprep
)
0
else
if
(
paired
)
4
else
2
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Zcat
])
shouldBe
0
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
SeqtkSeq
])
shouldBe
((
if
(
skipFlexiprep
)
0
else
if
(
paired
)
2
else
1
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Cutadapt
])
shouldBe
((
if
(
skipFlexiprep
)
0
else
if
(
paired
)
2
else
1
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
FastqSync
])
shouldBe
((
if
(
skipFlexiprep
)
0
else
if
(
paired
&&
!
skipFlexiprep
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Sickle
])
shouldBe
((
if
(
skipFlexiprep
)
0
else
1
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Gzip
])
shouldBe
(
if
(
skipFlexiprep
)
0
else
if
(
paired
)
2
else
1
)
//aligners
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
BwaMem
])
shouldBe
((
if
(
aligner
==
"bwa"
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
BwaAln
])
shouldBe
((
if
(
aligner
==
"bwa-aln"
)
(
if
(
paired
)
2
else
1
)
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
BwaSampe
])
shouldBe
((
if
(
aligner
==
"bwa-aln"
)
(
if
(
paired
)
1
else
0
)
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
BwaSamse
])
shouldBe
((
if
(
aligner
==
"bwa-aln"
)
(
if
(
paired
)
0
else
1
)
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Star
])
shouldBe
((
if
(
aligner
==
"star"
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Star
])
shouldBe
((
if
(
aligner
==
"star"
)
1
else
if
(
aligner
==
"star-2pass"
)
3
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Bowtie
])
shouldBe
((
if
(
aligner
==
"bowtie"
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
Stampy
])
shouldBe
((
if
(
aligner
==
"stampy"
)
1
else
0
)
*
chunks
)
// Sort sam or replace readgroup
val
sort
=
aligner
match
{
case
"bwa"
|
"bwa-aln"
|
"stampy"
=>
"sortsam"
case
"star"
|
"star-2pass"
|
"bowtie"
=>
"replacereadgroups"
case
_
=>
throw
new
IllegalArgumentException
(
"aligner: "
+
aligner
+
" does not exist"
)
}
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
SortSam
])
shouldBe
((
if
(
sort
==
"sortsam"
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
AddOrReplaceReadGroups
])
shouldBe
((
if
(
sort
==
"replacereadgroups"
)
1
else
0
)
*
chunks
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
MergeSamFiles
])
shouldBe
(
if
(
skipMarkDuplicate
&&
chunks
>
1
)
1
else
0
)
mapping
.
functions
.
count
(
_
.
isInstanceOf
[
MarkDuplicates
])
shouldBe
(
if
(
skipMarkDuplicate
)
0
else
1
)
}
}
object
MappingTest
{
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"
),
"star"
->
Map
(
"exe"
->
"test"
),
"bowtie"
->
Map
(
"exe"
->
"test"
),
"stampy"
->
Map
(
"exe"
->
"test"
),
"samtools"
->
Map
(
"exe"
->
"test"
)
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment