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
2d0050ea
Commit
2d0050ea
authored
10 years ago
by
bow
Browse files
Options
Downloads
Patches
Plain Diff
Add convenience methods for creating sample configs
parent
c7cd5499
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/gentrap/src/test/scala/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala
+42
-21
42 additions, 21 deletions
...a/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala
with
42 additions
and
21 deletions
public/gentrap/src/test/scala/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala
+
42
−
21
View file @
2d0050ea
...
...
@@ -19,6 +19,10 @@ import nl.lumc.sasc.biopet.utils.ConfigUtils
class
GentrapTest
extends
TestNGSuite
with
Matchers
{
import
Gentrap._
import
Gentrap.ExpMeasures._
import
Gentrap.StrandProtocol._
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
Gentrap
=
{
new
Gentrap
()
{
override
def
configName
=
"gentrap"
...
...
@@ -37,45 +41,58 @@ class GentrapTest extends TestNGSuite with Matchers {
else
(
s
"lib_$idx"
,
files
)
}
/** Convenience
method for making
sample config */
private
def
make
SampleConfig
(
sampleIdx
:
Int
,
numLibs
:
Int
,
paired
:
String
)
=
Map
(
"samples"
->
Map
(
s
"sample_$sampleIdx"
->
Map
(
"libraries"
->
(
0
to
numLibs
)
// if paired == "mixed", alternate paired/not paired between each number
.
map
(
n
=>
makeLibConfig
(
n
,
if
(
paired
==
"mixed"
)
n
%
2
==
0
else
paired
==
"paired"
)
)
.
toMap
)
/** Convenience
type for
sample config */
private
type
Sample
s
Config
=
Map
[
String
,
Map
[
String
,
Map
[
String
,
Map
[
String
,
Map
[
String
,
String
]]]]]
/** Convenience method for making a single sample config */
private
def
makeSampleConfig
(
sampleIdx
:
Int
,
numLibs
:
Int
,
paired
:
Boolean
)
=
(
s
"sample_$sampleIdx"
,
Map
(
"libraries"
->
(
0
to
numLibs
)
.
map
(
n
=>
makeLibConfig
(
n
,
paired
))
.
toMap
)
)
private
val
pairedOneSampleOneLib
=
makeSampleConfig
(
1
,
1
,
"paired"
)
private
val
pairedOneSampleTwoLib
=
makeSampleConfig
(
1
,
2
,
"paired"
)
private
val
pairedOneSampleThreeLib
=
makeSampleConfig
(
1
,
3
,
"paired"
)
/** Convenience method for making all samples config */
private
def
makeSamplesConfig
(
numSamples
:
Int
,
numLibsEachSample
:
Int
,
pairMode
:
String
)
:
SamplesConfig
=
Map
(
"samples"
->
(
0
to
numSamples
)
// if paired == "mixed", alternate paired/not paired between each number
.
map
(
n
=>
makeSampleConfig
(
n
,
numLibsEachSample
,
if
(
pairMode
==
"mixed"
)
n
%
2
==
0
else
pairMode
==
"paired"
))
.
toMap
)
private
lazy
val
validExpressionMeasures
=
Set
(
"fragments_per_gene"
,
"fragments_per_exon"
,
"bases_per_gene"
,
"bases_per_exon"
,
"cufflinks_strict"
,
"cufflinks_guided"
,
"cufflinks_blind"
)
@DataProvider
(
name
=
"expMeasures_strandProtocol"
)
def
flexiprepOptions
=
{
@DataProvider
(
name
=
"expMeasuresstrandProtocol"
)
def
expMeasuresStrandProtocolProvider
=
{
//val sampleConfigs = Array(pairedOneSampleOneLib, pairedOneSampleTwoLib, pairedOneSampleThreeLib)
val
sampleConfigs
=
for
{
sampleNum
<-
0
to
3
libNum
<-
0
to
2
libType
<-
Seq
(
"paired"
,
"single"
,
"mixed"
)
}
yield
makeSamplesConfig
(
sampleNum
,
libNum
,
libType
)
val
strandProtocols
=
Array
(
"non_specific"
,
"dutp"
)
// get all possible combinations of expression measures
val
expressionMeasures
=
validExpressionMeasures
.
subsets
.
map
(
_
.
toList
)
//
.subsets
//
.map(_.toList)
.
toArray
for
{
sampleConfig
<-
sampleConfigs
.
toArray
expressionMeasure
<-
expressionMeasures
strandProtocol
<-
strandProtocols
}
yield
Array
(
expressionMeasure
,
strandProtocol
)
}
yield
Array
(
sampleConfig
,
List
(
expressionMeasure
)
,
strandProtocol
)
}
@Test
(
dataProvider
=
"expMeasures
_
strandProtocol"
)
def
testGentrap
(
expMeasures
:
List
[
String
],
strandProtocol
:
String
)
=
{
@Test
(
dataProvider
=
"expMeasuresstrandProtocol"
)
def
testGentrap
(
sampleConfig
:
SamplesConfig
,
expMeasures
:
List
[
String
],
strandProtocol
:
String
)
=
{
val
settings
=
Map
(
"output_dir"
->
GentrapTest
.
outputDir
,
...
...
@@ -84,13 +101,17 @@ class GentrapTest extends TestNGSuite with Matchers {
"expression_measures"
->
expMeasures
,
"strand_protocol"
->
strandProtocol
)
val
config
=
ConfigUtils
.
mergeMaps
(
settings
++
pairedOneSampleOneLib
,
Map
(
GentrapTest
.
executables
.
toSeq
:
_
*
))
val
config
=
ConfigUtils
.
mergeMaps
(
settings
++
sampleConfig
,
Map
(
GentrapTest
.
executables
.
toSeq
:
_
*
))
val
gentrap
:
Gentrap
=
initPipeline
(
config
)
gentrap
.
script
()
val
functions
=
gentrap
.
functions
.
groupBy
(
_
.
getClass
)
functions
(
classOf
[
Gsnap
]).
size
should
be
>=
1
if
(
expMeasures
.
contains
(
FragmentsPerGene
))
{
functions
(
classOf
[
HtseqCount
]).
size
shouldBe
sampleConfig
(
"samples"
).
size
}
}
// remove temporary run directory all tests in the class have been run
...
...
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