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
7814030e
Commit
7814030e
authored
Dec 22, 2016
by
Peter van 't Hof
Browse files
Fix compile issues
parent
ba4a8f95
Changes
3
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/resources/nl/lumc/sasc/biopet/tools/plotHeatmap.R
→
biopet-tools/src/main/resources/nl/lumc/sasc/biopet/tools/
vcfstats/
plotHeatmap.R
View file @
7814030e
File moved
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/Stats.scala
View file @
7814030e
...
...
@@ -51,7 +51,7 @@ case class Stats(generalStats: mutable.Map[String, mutable.Map[String, mutable.M
}
/** Function to write 1 specific general field */
def
writeField
(
field
:
String
,
chr
:
String
=
"total"
)
:
Map
[
String
,
Array
[
Any
]]
=
{
def
writeField
2
(
field
:
String
,
chr
:
String
=
"total"
)
:
Map
[
String
,
Array
[
Any
]]
=
{
val
data
=
this
.
generalStats
.
getOrElse
(
chr
,
mutable
.
Map
[
String
,
mutable.Map
[
Any
,
Int
]]()).
getOrElse
(
field
,
mutable
.
Map
[
Any
,
Int
]())
val
rows
=
for
(
key
<-
data
.
keySet
.
toArray
.
sortWith
(
sortAnyAny
))
yield
{
...
...
@@ -82,7 +82,7 @@ case class Stats(generalStats: mutable.Map[String, mutable.Map[String, mutable.M
}
/** Function to write 1 specific genotype field */
def
writeGenotypeField
(
samples
:
List
[
String
],
field
:
String
,
chr
:
String
=
"total"
)
:
Map
[
String
,
Map
[
String
,
Any
]]
=
{
def
writeGenotypeField
2
(
samples
:
List
[
String
],
field
:
String
,
chr
:
String
=
"total"
)
:
Map
[
String
,
Map
[
String
,
Any
]]
=
{
val
keySet
=
(
for
(
sample
<-
samples
)
yield
this
.
samplesStats
(
sample
).
genotypeStats
.
getOrElse
(
chr
,
Map
[
String
,
Map
[
Any
,
Int
]]()).
getOrElse
(
field
,
Map
[
Any
,
Int
]()).
keySet
).
fold
(
Set
[
Any
]())(
_
++
_
)
(
for
(
sample
<-
samples
)
yield
sample
->
{
...
...
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfStatsTest.scala
View file @
7814030e
...
...
@@ -19,11 +19,12 @@ import java.nio.file.{Files, Paths}
import
htsjdk.variant.variantcontext.Allele
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.tools.vcfstats.VcfStats
import
nl.lumc.sasc.biopet.tools.vcfstats.
{
SampleStats
,
SampleToSampleStats
,
Stats
,
VcfStats
}
import
nl.lumc.sasc.biopet.tools.vcfstats.VcfStats._
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.Test
import
nl.lumc.sasc.biopet.utils.sortAnyAny
import
scala.collection.mutable
...
...
@@ -129,18 +130,18 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val
m1
:
mutable.Map
[
Any
,
Int
]
=
mutable
.
Map
(
"a"
->
1
)
val
m2
:
mutable.Map
[
Any
,
Int
]
=
mutable
.
Map
(
"b"
->
2
)
mergeStatsMap
(
m1
,
m2
)
Stats
.
mergeStatsMap
(
m1
,
m2
)
m1
should
equal
(
mutable
.
Map
(
"a"
->
1
,
"b"
->
2
))
val
m3
:
mutable.Map
[
Any
,
Int
]
=
mutable
.
Map
(
1
->
500
)
val
m4
:
mutable.Map
[
Any
,
Int
]
=
mutable
.
Map
(
6
->
125
)
mergeStatsMap
(
m3
,
m4
)
Stats
.
mergeStatsMap
(
m3
,
m4
)
m3
should
equal
(
mutable
.
Map
(
1
->
500
,
6
->
125
))
mergeStatsMap
(
m1
,
m3
)
Stats
.
mergeStatsMap
(
m1
,
m3
)
m1
should
equal
(
mutable
.
Map
(
"a"
->
1
,
"b"
->
2
,
1
->
500
,
6
->
125
))
}
...
...
@@ -152,7 +153,7 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val
m2
:
Map
[
String
,
Map
[
String
,
Map
[
Any
,
Int
]]]
=
Map
(
"test"
->
Map
(
"nested"
->
Map
(
"b"
->
2
)))
mergeNestedStatsMap
(
m1
,
m2
)
Stats
.
mergeNestedStatsMap
(
m1
,
m2
)
m1
should
equal
(
mutable
.
Map
(
"test"
->
mutable
.
Map
(
"nested"
->
mutable
.
Map
(
"a"
->
1
,
"b"
->
2
))))
...
...
@@ -161,13 +162,13 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val
m4
:
Map
[
String
,
Map
[
String
,
Map
[
Any
,
Int
]]]
=
Map
(
"test"
->
Map
(
"nestedd"
->
Map
(
6
->
125
)))
mergeNestedStatsMap
(
m3
,
m4
)
Stats
.
mergeNestedStatsMap
(
m3
,
m4
)
m3
should
equal
(
mutable
.
Map
(
"test"
->
mutable
.
Map
(
"nestedd"
->
mutable
.
Map
(
1
->
500
,
6
->
125
))))
val
m5
=
m3
.
toMap
.
map
(
x
=>
x
.
_1
->
x
.
_2
.
toMap
.
map
(
y
=>
y
.
_1
->
y
.
_2
.
toMap
))
mergeNestedStatsMap
(
m1
,
m5
)
Stats
.
mergeNestedStatsMap
(
m1
,
m5
)
m1
should
equal
(
mutable
.
Map
(
"test"
->
mutable
.
Map
(
"nested"
->
mutable
.
Map
(
"a"
->
1
,
"b"
->
2
),
"nestedd"
->
mutable
.
Map
(
1
->
500
,
6
->
125
))))
...
...
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