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
702a85e8
Commit
702a85e8
authored
Jul 28, 2017
by
Peter van 't Hof
Committed by
GitHub
Jul 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #171 from biopet/fix-BIOPET-759
Merge stats.json files
parents
df582f1a
1a7fd7db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
64 deletions
+15
-64
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/Stats.scala
...main/scala/nl/lumc/sasc/biopet/tools/vcfstats/Stats.scala
+1
-1
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
...n/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
+14
-1
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfStatsTest.scala
...c/test/scala/nl/lumc/sasc/biopet/tools/VcfStatsTest.scala
+0
-62
No files found.
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/Stats.scala
View file @
702a85e8
...
...
@@ -165,7 +165,7 @@ case class Stats(generalStats: mutable.Map[String, mutable.Map[Any, Int]] = muta
sampleDistributions
:
List
[
String
],
contig
:
Option
[
String
])
:
Unit
=
{
outputDir
.
mkdirs
()
this
.
writeToFile
(
new
File
(
outputDir
,
"stats
.json"
),
this
.
writeToFile
(
new
File
(
outputDir
,
s
"${contig.getOrElse("
total
")}
.json"
),
samples
,
genotypeFields
,
infoFields
,
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
View file @
702a85e8
...
...
@@ -6,7 +6,7 @@ import java.net.URLClassLoader
import
htsjdk.variant.variantcontext.
{
Genotype
,
VariantContext
}
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.utils.intervals.
{
BedRecord
,
BedRecordList
}
import
nl.lumc.sasc.biopet.utils.
{
FastaUtils
,
ToolCommand
,
VcfUtils
}
import
nl.lumc.sasc.biopet.utils.
_
import
org.apache.spark.
{
SparkConf
,
SparkContext
}
import
scala.collection.JavaConversions._
...
...
@@ -108,6 +108,19 @@ object VcfStats extends ToolCommand {
Await
.
result
(
totalStats
,
Duration
.
Inf
)
val
completeStatsJson
=
regions
.
flatMap
(
_
.
map
(
_
.
chr
))
.
foldLeft
(
ConfigUtils
.
fileToConfigMap
(
new
File
(
cmdArgs
.
outputDir
,
"total.json"
)))
{
case
(
map
,
contig
)
=>
val
contigMap
=
ConfigUtils
.
fileToConfigMap
(
new
File
(
cmdArgs
.
outputDir
,
"contigs"
+
File
.
separator
+
contig
+
File
.
separator
+
s
"$contig.json"
))
ConfigUtils
.
mergeMaps
(
map
,
contigMap
)
}
IoUtils
.
writeLinesToFile
(
new
File
(
cmdArgs
.
outputDir
,
"stats.json"
),
ConfigUtils
.
mapToJson
(
completeStatsJson
).
nospaces
::
Nil
)
sc
.
stop
logger
.
info
(
"Done"
)
}
...
...
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfStatsTest.scala
View file @
702a85e8
...
...
@@ -284,44 +284,6 @@ class VcfStatsTest extends TestNGSuite with Matchers {
general
.
get
(
"NotFiltered"
)
shouldEqual
Some
(
1
)
general
.
get
(
"Symbolic"
)
shouldEqual
Some
(
0
)
general
.
get
(
"SimpleInsertion"
)
shouldEqual
Some
(
1
)
val
total
=
generalStats
total
.
get
(
"SampleDistribution-NonInformative"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-Called"
)
shouldEqual
Some
(
Map
(
3
->
1
))
total
.
get
(
"SampleDistribution-Mixed"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-Hom"
)
shouldEqual
Some
(
Map
(
1
->
1
))
total
.
get
(
"SampleDistribution-HomRef"
)
shouldEqual
Some
(
Map
(
1
->
1
))
total
.
get
(
"SampleDistribution-Available"
)
shouldEqual
Some
(
Map
(
3
->
1
))
total
.
get
(
"QUAL"
)
shouldEqual
Some
(
Map
(
1541
->
1
))
total
.
get
(
"SampleDistribution-HetNonRef"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-Het"
)
shouldEqual
Some
(
Map
(
2
->
1
))
total
.
get
(
"SampleDistribution-NoCall"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-Filtered"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-HomVar"
)
shouldEqual
Some
(
Map
(
0
->
1
))
total
.
get
(
"SampleDistribution-Variant"
)
shouldEqual
Some
(
Map
(
2
->
1
))
generalStats
.
get
(
"general"
)
should
not
be
empty
val
totGeneral
=
generalStats
(
"general"
)
totGeneral
.
get
(
"PolymorphicInSamples"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"ComplexIndel"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"FullyDecoded"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"PointEvent"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"MNP"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Indel"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Biallelic"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"SimpleDeletion"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Variant"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"SymbolicOrSV"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"MonomorphicInSamples"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"SNP"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Filtered"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"StructuralIndel"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Total"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Mixed"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"NotFiltered"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Symbolic"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"SimpleInsertion"
)
shouldEqual
Some
(
1
)
}
@Test
...
...
@@ -354,29 +316,5 @@ class VcfStatsTest extends TestNGSuite with Matchers {
general
.
get
(
"Available"
)
shouldEqual
Some
(
1
)
general
.
get
(
"Het"
)
shouldEqual
Some
(
1
)
general
.
get
(
"HetNonRef"
)
shouldEqual
Some
(
0
)
val
total
=
genotypeStats
total
.
get
(
"GQ"
)
shouldEqual
Some
(
Map
(
99
->
1
))
total
.
get
(
"AD"
)
shouldEqual
Some
(
Map
(
24
->
1
,
21
->
1
))
total
.
get
(
"AD-used"
)
shouldEqual
Some
(
Map
(
24
->
1
,
21
->
1
))
total
.
get
(
"DP"
)
shouldEqual
Some
(
Map
(
45
->
1
))
total
.
get
(
"AD-alt"
)
shouldEqual
Some
(
Map
(
21
->
1
))
total
.
get
(
"AD-ref"
)
shouldEqual
Some
(
Map
(
24
->
1
))
total
.
get
(
"general"
)
should
not
be
empty
val
totGeneral
=
genotypeStats
(
"general"
)
totGeneral
.
get
(
"Hom"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"NoCall"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Variant"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Filtered"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"NonInformative"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Called"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Total"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"HomVar"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"HomRef"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Mixed"
)
shouldEqual
Some
(
0
)
totGeneral
.
get
(
"Available"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"Het"
)
shouldEqual
Some
(
1
)
totGeneral
.
get
(
"HetNonRef"
)
shouldEqual
Some
(
0
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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