Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biopet.biopet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Mirrors
biopet.biopet
Commits
c4c62209
Commit
c4c62209
authored
Mar 02, 2017
by
Peter van 't Hof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added separated outputDirs
parent
ee8d9af5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
172 additions
and
84 deletions
+172
-84
bammetrics/src/test/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
...umc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
+13
-11
generate-indexes/src/test/scala/nl/lumc/sasc/biopet/pipelines/generateindexes/DownloadGenomesTest.scala
...iopet/pipelines/generateindexes/DownloadGenomesTest.scala
+52
-20
gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
...nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
+16
-7
gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/Impute2VcfTest.scala
...asc/biopet/pipelines/gwastest/impute/Impute2VcfTest.scala
+21
-9
kopisu/src/test/scala/nl/lumc/sasc/biopet/pipelines/kopisu/KopisuTest.scala
...ala/nl/lumc/sasc/biopet/pipelines/kopisu/KopisuTest.scala
+24
-14
tinycap/src/test/scala/nl/lumc/sasc/biopet/pipelines/tinycap/TinyCapTest.scala
...a/nl/lumc/sasc/biopet/pipelines/tinycap/TinyCapTest.scala
+17
-14
toucan/src/test/scala/nl/lumc/sasc/biopet/pipelines/toucan/ToucanTest.scala
...ala/nl/lumc/sasc/biopet/pipelines/toucan/ToucanTest.scala
+29
-9
No files found.
bammetrics/src/test/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
View file @
c4c62209
...
...
@@ -56,9 +56,13 @@ class BamMetricsTest extends TestNGSuite with Matchers {
)
yield
Array
(
rois
,
amplicon
,
rna
,
wgs
)
}
private
var
dirs
:
List
[
File
]
=
Nil
@Test
(
dataProvider
=
"bammetricsOptions"
)
def
testBamMetrics
(
rois
:
Int
,
amplicon
:
Boolean
,
rna
:
Boolean
,
wgs
:
Boolean
)
=
{
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
BamMetricsTest
.
outputDir
,
"rna_metrics"
->
rna
,
"wgs_metrics"
->
wgs
),
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
outputDir
,
"rna_metrics"
->
rna
,
"wgs_metrics"
->
wgs
),
Map
(
BamMetricsTest
.
executables
.
toSeq
:
_
*
))
++
(
if
(
amplicon
)
Map
(
"amplicon_bed"
->
BamMetricsTest
.
ampliconBed
.
getAbsolutePath
)
else
Map
())
++
(
if
(
rna
)
Map
(
"annotation_refflat"
->
"transcripts.refFlat"
)
else
Map
())
++
...
...
@@ -81,30 +85,28 @@ class BamMetricsTest extends TestNGSuite with Matchers {
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
FileUtils
.
deleteDirectory
(
BamMetricsTest
.
outputDir
)
@AfterClass
def
removeTempOutputDir
()
=
{
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
BamMetricsTest
{
val
outputDir
=
Files
.
createTempDir
()
new
File
(
outputDir
,
"input"
).
mkdirs
()
val
inputDir
=
Files
.
createTempDir
()
val
bam
=
new
File
(
out
putDir
,
"input"
+
File
.
separator
+
"bla.bam"
)
val
bam
=
new
File
(
in
putDir
,
"input"
+
File
.
separator
+
"bla.bam"
)
Files
.
touch
(
bam
)
val
ampliconBed
=
new
File
(
out
putDir
,
"input"
+
File
.
separator
+
"amplicon_bed.bed"
)
val
ampliconBed
=
new
File
(
in
putDir
,
"input"
+
File
.
separator
+
"amplicon_bed.bed"
)
Files
.
touch
(
ampliconBed
)
def
roi
(
i
:
Int
)
:
File
=
{
val
roi
=
new
File
(
out
putDir
,
"input"
+
File
.
separator
+
s
"roi${i}.bed"
)
val
roi
=
new
File
(
in
putDir
,
"input"
+
File
.
separator
+
s
"roi${i}.bed"
)
Files
.
touch
(
roi
)
roi
}
private
def
copyFile
(
name
:
String
)
:
Unit
=
{
val
is
=
getClass
.
getResourceAsStream
(
"/"
+
name
)
val
os
=
new
FileOutputStream
(
new
File
(
out
putDir
,
name
))
val
os
=
new
FileOutputStream
(
new
File
(
in
putDir
,
name
))
org
.
apache
.
commons
.
io
.
IOUtils
.
copy
(
is
,
os
)
os
.
close
()
}
...
...
@@ -116,7 +118,7 @@ object BamMetricsTest {
val
executables
=
Map
(
"skip_write_dependencies"
->
true
,
"refFlat"
->
"bla.refFlat"
,
"reference_fasta"
->
(
out
putDir
+
File
.
separator
+
"ref.fa"
),
"reference_fasta"
->
(
in
putDir
+
File
.
separator
+
"ref.fa"
),
"samtools"
->
Map
(
"exe"
->
"test"
),
"bedtools"
->
Map
(
"exe"
->
"test"
),
"md5sum"
->
Map
(
"exe"
->
"test"
)
...
...
generate-indexes/src/test/scala/nl/lumc/sasc/biopet/pipelines/generateindexes/DownloadGenomesTest.scala
View file @
c4c62209
...
...
@@ -14,58 +14,73 @@
*/
package
nl.lumc.sasc.biopet.pipelines.generateindexes
import
java.io.File
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.config.Config
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.
Test
import
org.testng.annotations.
{
AfterClass
,
Test
}
/**
* Created by pjvan_thof on 13-5-16.
*/
class
DownloadGenomesTest
extends
TestNGSuite
with
Matchers
{
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
DownloadGenomes
=
{
def
initPipeline
(
map
:
Map
[
String
,
Any
]
,
outputDir
:
File
)
:
DownloadGenomes
=
{
new
DownloadGenomes
()
{
override
def
configNamespace
=
"generateindexes"
override
def
globalConfig
=
new
Config
(
ConfigUtils
.
mergeMaps
(
map
,
DownloadGenomesTest
.
config
))
override
def
globalConfig
=
new
Config
(
ConfigUtils
.
mergeMaps
(
map
,
DownloadGenomesTest
.
config
(
outputDir
)
))
qSettings
=
new
QSettings
qSettings
.
runName
=
"test"
}
}
private
var
dirs
:
List
[
File
]
=
Nil
@Test
def
testNoFastaUri
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
())
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
""
->
""
)))
an
[
IllegalArgumentException
]
should
be
thrownBy
pipeline
.
script
()
}
@Test
def
testNcbiAssembly
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
())
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"ncbi_assembly_report"
->
"id"
)))
noException
should
be
thrownBy
pipeline
.
script
()
}
@Test
def
testSingleFasta
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
())
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
)))
noException
should
be
thrownBy
pipeline
.
script
()
}
@Test
def
testMultiFasta
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
())
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
List
(
"uri"
,
"uri2"
,
"uri3.gz"
))))
noException
should
be
thrownBy
pipeline
.
script
()
}
@Test
def
testSingleDbsnp
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"dbsnp"
->
Map
(
"version"
->
Map
(
"vcf_uri"
->
"uri.vcf.gz"
)))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -73,7 +88,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testContigMapDbsnp
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"dbsnp"
->
Map
(
"version"
->
Map
(
"vcf_uri"
->
"uri.vcf.gz"
,
"contig_map"
->
Map
(
"1"
->
"chr1"
))))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -81,7 +98,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testUnzippedContigMapDbsnp
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"dbsnp"
->
Map
(
"version"
->
Map
(
"vcf_uri"
->
"uri.vcf"
,
"contig_map"
->
Map
(
"1"
->
"chr1"
))))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -89,7 +108,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testSingleUnzippedDbsnp
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"dbsnp"
->
Map
(
"version"
->
Map
((
"vcf_uri"
->
"uri.vcf"
))))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -97,7 +118,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testMultiDbsnp
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"dbsnp"
->
Map
(
"version"
->
Map
(
"vcf_uri"
->
List
(
"uri.vcf.gz"
,
"uri2.vcf.gz"
))))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -105,7 +128,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testVep
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"vep"
->
Map
(
"version"
->
Map
(
"cache_uri"
->
"something/human_vep_80_hg19.tar.gz"
)))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -113,7 +138,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testGtfZipped
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"gene_annotation"
->
Map
(
"version"
->
Map
(
"gtf_uri"
->
"bla.gf.gz"
)))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -121,7 +148,9 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testGtf
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"gene_annotation"
->
Map
(
"version"
->
Map
(
"gtf_uri"
->
"bla.gf"
)))))
noException
should
be
thrownBy
pipeline
.
script
()
...
...
@@ -129,19 +158,22 @@ class DownloadGenomesTest extends TestNGSuite with Matchers {
@Test
def
testGff
()
:
Unit
=
{
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
))
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Map
(
"download_annotations"
->
true
),
outputDir
)
pipeline
.
referenceConfig
=
Map
(
"s1"
->
Map
(
"g1"
->
Map
(
"fasta_uri"
->
"uri"
,
"gene_annotation"
->
Map
(
"version"
->
Map
(
"gff_uri"
->
"bla.gf"
)))))
noException
should
be
thrownBy
pipeline
.
script
()
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
DownloadGenomesTest
{
val
outputDir
=
Files
.
createTempDir
()
outputDir
.
deleteOnExit
()
val
config
=
Map
(
def
config
(
outputDir
:
File
)
=
Map
(
"skip_write_dependencies"
->
true
,
"output_dir"
->
outputDir
,
"bwa"
->
Map
(
"exe"
->
"test"
),
...
...
gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
View file @
c4c62209
...
...
@@ -20,10 +20,11 @@ import java.nio.file.Paths
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.utils.Logging
import
nl.lumc.sasc.biopet.utils.config.Config
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.
Test
import
org.testng.annotations.
{
AfterClass
,
Test
}
/**
* Created by pjvan_thof on 4/11/16.
...
...
@@ -38,10 +39,14 @@ class GwasTestTest extends TestNGSuite with Matchers {
}
}
private
var
dirs
:
List
[
File
]
=
Nil
@Test
def
testFromVcf
:
Unit
=
{
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
Logging
.
errors
.
clear
()
val
pipeline
=
initPipeline
(
GwasTestTest
.
config
++
val
pipeline
=
initPipeline
(
GwasTestTest
.
config
(
outputDir
)
++
Map
(
"input_vcf"
->
GwasTestTest
.
vcfFile
.
toString
)
)
...
...
@@ -50,11 +55,18 @@ class GwasTestTest extends TestNGSuite with Matchers {
@Test
def
testEmpty
:
Unit
=
{
val
pipeline
=
initPipeline
(
GwasTestTest
.
config
)
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
GwasTestTest
.
config
(
outputDir
))
intercept
[
IllegalArgumentException
]
{
pipeline
.
script
()
}
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
GwasTestTest
{
...
...
@@ -65,16 +77,13 @@ object GwasTestTest {
val
phenotypeFile
=
File
.
createTempFile
(
"gwas."
,
".txt"
)
phenotypeFile
.
deleteOnExit
()
val
outputDir
=
Files
.
createTempDir
()
outputDir
.
deleteOnExit
()
val
reference
=
new
File
(
resourcePath
(
"/fake_chrQ.fa"
))
private
def
resourcePath
(
p
:
String
)
:
String
=
{
Paths
.
get
(
getClass
.
getResource
(
p
).
toURI
).
toString
}
val
config
=
Map
(
def
config
(
outputDir
:
File
)
=
Map
(
"skip_write_dependencies"
->
true
,
"reference_fasta"
->
reference
.
toString
,
"phenotype_file"
->
phenotypeFile
.
toString
,
...
...
gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/Impute2VcfTest.scala
View file @
c4c62209
...
...
@@ -19,10 +19,11 @@ import java.nio.file.Paths
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.utils.config.Config
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.
Test
import
org.testng.annotations.
{
AfterClass
,
Test
}
/**
* Created by pjvan_thof on 31-5-16.
...
...
@@ -37,9 +38,13 @@ class Impute2VcfTest extends TestNGSuite with Matchers {
}
}
private
var
dirs
:
List
[
File
]
=
Nil
@Test
def
testFromGens
:
Unit
=
{
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
++
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
(
outputDir
)
++
Map
(
"input_gens"
->
List
(
Map
(
"genotypes"
->
Impute2VcfTest
.
vcfFile
,
"contig"
->
"chrQ"
))
)
)
...
...
@@ -48,7 +53,9 @@ class Impute2VcfTest extends TestNGSuite with Matchers {
@Test
def
testWrongContig
:
Unit
=
{
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
++
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
(
outputDir
)
++
Map
(
"input_gens"
->
List
(
Map
(
"genotypes"
->
Impute2VcfTest
.
vcfFile
,
"contig"
->
"chrBla"
))
)
)
...
...
@@ -59,7 +66,9 @@ class Impute2VcfTest extends TestNGSuite with Matchers {
@Test
def
testFromSpecs
:
Unit
=
{
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
++
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
(
outputDir
)
++
Map
(
"imute_specs_file"
->
Impute2VcfTest
.
resourcePath
(
"/specs/files.specs"
))
)
pipeline
.
script
()
...
...
@@ -67,12 +76,18 @@ class Impute2VcfTest extends TestNGSuite with Matchers {
@Test
def
testEmpty
:
Unit
=
{
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
)
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
pipeline
=
initPipeline
(
Impute2VcfTest
.
config
(
outputDir
))
intercept
[
IllegalArgumentException
]
{
pipeline
.
script
()
}
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
Impute2VcfTest
{
...
...
@@ -83,16 +98,13 @@ object Impute2VcfTest {
val
phenotypeFile
=
File
.
createTempFile
(
"gwas."
,
".txt"
)
phenotypeFile
.
deleteOnExit
()
val
outputDir
=
Files
.
createTempDir
()
outputDir
.
deleteOnExit
()
val
reference
=
new
File
(
resourcePath
(
"/fake_chrQ.fa"
))
private
def
resourcePath
(
p
:
String
)
:
String
=
{
Paths
.
get
(
getClass
.
getResource
(
p
).
toURI
).
toString
}
val
config
=
Map
(
def
config
(
outputDir
:
File
)
=
Map
(
"skip_write_dependencies"
->
true
,
"reference_fasta"
->
reference
.
toString
,
"phenotype_file"
->
phenotypeFile
.
toString
,
...
...
kopisu/src/test/scala/nl/lumc/sasc/biopet/pipelines/kopisu/KopisuTest.scala
View file @
c4c62209
...
...
@@ -14,16 +14,17 @@
*/
package
nl.lumc.sasc.biopet.pipelines.kopisu
import
java.io.
{
File
,
FileOutputStream
}
import
java.io.
{
File
,
FileOutputStream
}
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.extensions.freec.
{
FreeC
,
FreeCAssessSignificancePlot
,
FreeCCNVPlot
}
import
nl.lumc.sasc.biopet.extensions.freec.
{
FreeC
,
FreeCAssessSignificancePlot
,
FreeCCNVPlot
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.config.Config
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.
{
DataProvider
,
Test
}
import
org.testng.annotations.
{
AfterClass
,
DataProvider
,
Test
}
import
scala.collection.mutable.ListBuffer
...
...
@@ -33,15 +34,17 @@ import scala.collection.mutable.ListBuffer
* Created by pjvan_thof on 3/2/15.
*/
class
KopisuTest
extends
TestNGSuite
with
Matchers
{
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
Kopisu
=
{
def
initPipeline
(
map
:
Map
[
String
,
Any
]
,
outputDir
:
File
)
:
Kopisu
=
{
new
Kopisu
()
{
override
def
configNamespace
=
"kopisu"
override
def
globalConfig
=
new
Config
(
ConfigUtils
.
mergeMaps
(
map
,
KopisuTest
.
config
))
override
def
globalConfig
=
new
Config
(
ConfigUtils
.
mergeMaps
(
map
,
KopisuTest
.
config
(
outputDir
)
))
qSettings
=
new
QSettings
qSettings
.
runName
=
"test"
}
}
private
var
dirs
:
List
[
File
]
=
Nil
@DataProvider
(
name
=
"shivaSvCallingOptions"
)
def
shivaSvCallingOptions
=
{
val
bool
=
Array
(
true
,
false
)
...
...
@@ -56,12 +59,15 @@ class KopisuTest extends TestNGSuite with Matchers {
def
testShivaSvCalling
(
bams
:
Int
,
freec
:
Boolean
,
conifer
:
Boolean
)
=
{
val
outputDir
=
Files
.
createTempDir
()
dirs
:+=
outputDir
val
callers
:
ListBuffer
[
String
]
=
ListBuffer
()
val
map
=
Map
(
"sv_callers"
->
callers
.
toList
)
val
pipeline
=
initPipeline
(
map
++
Map
(
"use_freec_method"
->
freec
,
"use_conifer_method"
->
conifer
))
)
,
outputDir
)
pipeline
.
inputBams
=
(
for
(
n
<-
1
to
bams
)
yield
n
.
toString
->
KopisuTest
.
inputTouch
(
"bam_"
+
n
+
".bam"
)).
toMap
...
...
@@ -84,21 +90,26 @@ class KopisuTest extends TestNGSuite with Matchers {
pipeline
.
functions
.
count
(
_
.
isInstanceOf
[
FreeCCNVPlot
])
shouldBe
(
if
(
freec
)
bams
else
0
)
}
}
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
KopisuTest
{
val
outputDir
=
Files
.
createTempDir
()
outputDir
.
deleteOnExit
()
new
File
(
outputDir
,
"input"
).
mkdirs
()
def
outputDir
=
Files
.
createTempDir
()
val
inputDir
=
Files
.
createTempDir
()
private
def
inputTouch
(
name
:
String
)
:
File
=
{
val
file
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
name
).
getAbsoluteFile
val
file
=
new
File
(
inputDir
,
name
).
getAbsoluteFile
Files
.
touch
(
file
)
file
}
private
def
copyFile
(
name
:
String
)
:
Unit
=
{
val
is
=
getClass
.
getResourceAsStream
(
"/"
+
name
)
val
os
=
new
FileOutputStream
(
new
File
(
out
putDir
,
name
))
val
os
=
new
FileOutputStream
(
new
File
(
in
putDir
,
name
))
org
.
apache
.
commons
.
io
.
IOUtils
.
copy
(
is
,
os
)
os
.
close
()
}
...
...
@@ -108,14 +119,13 @@ object KopisuTest {
copyFile
(
"ref.fa.fai"
)
val
controlDir
=
Files
.
createTempDir
()
controlDir
.
deleteOnExit
()
Files
.
touch
(
new
File
(
controlDir
,
"test.txt"
))
val
config
=
Map
(
def
config
(
outputDir
:
File
)
=
Map
(
"skip_write_dependencies"
->
true
,
"name_prefix"
->
"test"
,
"output_dir"
->
outputDir
,
"reference_fasta"
->
(
out
putDir
+
File
.
separator
+
"ref.fa"
),
"reference_fasta"
->
(
in
putDir
+
File
.
separator
+
"ref.fa"
),
"gatk_jar"
->
"test"
,
"samtools"
->
Map
(
"exe"
->
"test"
),
"md5sum"
->
Map
(
"exe"
->
"test"
),
...
...
tinycap/src/test/scala/nl/lumc/sasc/biopet/pipelines/tinycap/TinyCapTest.scala
View file @
c4c62209
...
...
@@ -47,6 +47,8 @@ import org.testng.annotations.{ AfterClass, DataProvider, Test }
class
TinyCapTest
extends
TestNGSuite
with
Matchers
{
private
var
dirs
:
List
[
File
]
=
Nil
def
initPipeline
(
map
:
Map
[
String
,
Any
])
:
TinyCap
=
{
new
TinyCap
()
{
override
def
configNamespace
=
"tinycap"
...
...
@@ -69,8 +71,10 @@ class TinyCapTest extends TestNGSuite with Matchers {
@Test
(
dataProvider
=
"tinyCapOptions"
)
def
testTinyCap
(
dummy
:
String
,
sample1
:
Boolean
)
:
Unit
=
{
val
outputDir
=
TinyCapTest
.
outputDir
dirs
:+=
outputDir
val
map
=
{
var
m
:
Map
[
String
,
Any
]
=
TinyCapTest
.
config
var
m
:
Map
[
String
,
Any
]
=
TinyCapTest
.
config
(
outputDir
)
if
(
sample1
)
m
=
ConfigUtils
.
mergeMaps
(
TinyCapTest
.
sample1
,
m
)
m
}
...
...
@@ -90,35 +94,34 @@ class TinyCapTest extends TestNGSuite with Matchers {
// remove temporary run directory all tests in the class have been run
@AfterClass
def
removeTempOutputDir
()
=
{
FileUtils
.
deleteDirectory
(
TinyCapTest
.
outputDir
)
dirs
.
foreach
(
FileUtils
.
deleteDirectory
)
}
}
object
TinyCapTest
{
val
outputDir
=
Files
.
createTempDir
()
new
File
(
outputDir
,
"input"
).
mkdirs
()
def
outputDir
=
Files
.
createTempDir
()
val
inputDir
=
Files
.
createTempDir
()
val
r1
=
new
File
(
out
putDir
,
"input"
+
File
.
separator
+
"R1.fq.gz"
)
val
r1
=
new
File
(
in
putDir
,
"input"
+
File
.
separator
+
"R1.fq.gz"
)
Files
.
touch
(
r1
)
val
bam
=
new
File
(
out
putDir
,
"input"
+
File
.
separator
+
"bamfile.bam"
)
val
bam
=
new
File
(
in
putDir
,
"input"
+
File
.
separator
+
"bamfile.bam"
)
Files
.
touch
(
bam
)
val
referenceFasta
=
new
File
(
out
putDir
,
"ref.fa"
)
val
referenceFasta
=
new
File
(
in
putDir
,
"ref.fa"
)
Files
.
touch
(
referenceFasta
)
val
referenceFastaDict
=
new
File
(
out
putDir
,
"ref.dict"
)
val
referenceFastaDict
=
new
File
(
in
putDir
,
"ref.dict"
)
Files
.
touch
(
referenceFastaDict
)
val
bowtieIndex
=
new
File
(
out
putDir
,
"ref.1.ebwt"
)
val
bowtieIndex
=
new
File
(
in
putDir
,
"ref.1.ebwt"
)
Files
.
touch
(
bowtieIndex
)
val
annotationGFF
=
new
File
(
out
putDir
,
"annot.gff"
)
val
annotationGTF
=
new
File
(
out
putDir
,
"annot.gtf"
)
val
annotationRefflat
=
new
File
(
out
putDir
,
"annot.refflat"
)
val
annotationGFF
=
new
File
(
in
putDir
,
"annot.gff"
)
val
annotationGTF
=
new
File
(
in
putDir
,
"annot.gtf"
)
val
annotationRefflat
=
new
File
(
in
putDir
,
"annot.refflat"
)
Files
.
touch
(
annotationGFF
)
Files
.
touch
(
annotationGTF
)
Files
.
touch
(
annotationRefflat
)