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
bcc8fb10
Commit
bcc8fb10
authored
May 28, 2017
by
Peter van 't Hof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing compile issues
parent
aa3a03e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
53 deletions
+53
-53
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
...n/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
+53
-53
No files found.
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/vcfstats/VcfStats.scala
View file @
bcc8fb10
...
...
@@ -120,16 +120,16 @@ object VcfStats extends ToolCommand {
opt
[
String
](
"genotypeTag"
)
unbounded
()
valueName
"<tag>"
action
{
(
x
,
c
)
=>
c
.
copy
(
genotypeTags
=
x
::
c
.
genotypeTags
)
}
text
s
"Summarize these genotype tags. Default is (${defaultGenotypeFields.mkString("
,
")})"
opt
[
Unit
](
"allInfoTags"
)
unbounded
()
action
{
(
x
,
c
)
=>
opt
[
Unit
](
"allInfoTags"
)
unbounded
()
action
{
(
_
,
c
)
=>
c
.
copy
(
allInfoTags
=
true
)
}
text
"Summarize all info tags. Default false"
opt
[
Unit
](
"allGenotypeTags"
)
unbounded
()
action
{
(
x
,
c
)
=>
opt
[
Unit
](
"allGenotypeTags"
)
unbounded
()
action
{
(
_
,
c
)
=>
c
.
copy
(
allGenotypeTags
=
true
)
}
text
"Summarize all genotype tags. Default false"
opt
[
Int
](
"binSize"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
binSize
=
x
)
}
text
"Binsize in estimated base pairs"
opt
[
Unit
](
"writeBinStats"
)
unbounded
()
action
{
(
x
,
c
)
=>
opt
[
Unit
](
"writeBinStats"
)
unbounded
()
action
{
(
_
,
c
)
=>
c
.
copy
(
writeBinStats
=
true
)
}
text
"Write bin statistics. Default False"
opt
[
String
](
"generalWiggle"
)
unbounded
()
action
{
(
x
,
c
)
=>
...
...
@@ -205,12 +205,12 @@ object VcfStats extends ToolCommand {
}).
toList
:::
defaultGenotypeFields
val
bedRecords
=
(
cmdArgs
.
intervals
match
{
case
Some
(
i
ntervals
)
=>
BedRecordList
.
fromFile
(
i
ntervals
).
validateContigs
(
cmdArgs
.
referenceFile
)
case
Some
(
i
)
=>
BedRecordList
.
fromFile
(
i
).
validateContigs
(
cmdArgs
.
referenceFile
)
case
_
=>
BedRecordList
.
fromReference
(
cmdArgs
.
referenceFile
)
}).
combineOverlap
.
scatter
(
cmdArgs
.
binSize
)
val
intervals
:
List
[
Interval
]
=
bedRecords
.
toSamIntervals
.
toList
val
intervals
:
List
[
Interval
]
=
BedRecordList
.
fromList
(
bedRecords
.
flatten
)
.
toSamIntervals
.
toList
val
totalBases
=
bedRecords
.
length
...
...
@@ -242,9 +242,7 @@ object VcfStats extends ToolCommand {
// Triple for loop to not keep all bins in memory
val
statsFutures
=
for
(
intervals
<-
Random
.
shuffle
(
intervals
)
.
grouped
(
intervals
.
size
/
(
if
(
intervals
.
size
>
10
)
4
else
1
))
.
toList
)
.
shuffle
(
bedRecords
))
yield
Future
{
val
chunkStats
=
for
(
intervals
<-
intervals
.
grouped
(
25
))
yield
{
...
...
@@ -254,7 +252,9 @@ object VcfStats extends ToolCommand {
val
stats
=
createStats
logger
.
info
(
"Starting on: "
+
interval
)
val
query
=
reader
.
query
(
interval
.
getContig
,
interval
.
getStart
,
interval
.
getEnd
)
val
samInterval
=
interval
.
toSamInterval
val
query
=
reader
.
query
(
samInterval
.
getContig
,
samInterval
.
getStart
,
samInterval
.
getEnd
)
if
(!
query
.
hasNext
)
{
Stats
.
mergeNestedStatsMap
(
stats
.
generalStats
,
fillGeneral
(
adInfoTags
))
for
(
sample
<-
samples
)
yield
{
...
...
@@ -264,7 +264,7 @@ object VcfStats extends ToolCommand {
chunkCounter
+=
1
}
for
(
record
<-
query
if
record
.
getStart
<=
i
nterval
.
getEnd
)
{
for
(
record
<-
query
if
record
.
getStart
<=
samI
nterval
.
getEnd
)
{
Stats
.
mergeNestedStatsMap
(
stats
.
generalStats
,
checkGeneral
(
record
,
adInfoTags
))
for
(
sample1
<-
samples
)
yield
{
val
genotype
=
record
.
getGenotype
(
sample1
)
...
...
@@ -284,19 +284,19 @@ object VcfStats extends ToolCommand {
if
(
cmdArgs
.
writeBinStats
)
{
val
binOutputDir
=
new
File
(
cmdArgs
.
outputDir
,
"bins"
+
File
.
separator
+
i
nterval
.
getContig
)
new
File
(
cmdArgs
.
outputDir
,
"bins"
+
File
.
separator
+
samI
nterval
.
getContig
)
stats
.
writeGenotypeField
(
samples
,
"general"
,
binOutputDir
,
prefix
=
"genotype-"
+
interval
.
getStart
+
"-"
+
i
nterval
.
getEnd
)
prefix
=
"genotype-"
+
samInterval
.
getStart
+
"-"
+
samI
nterval
.
getEnd
)
stats
.
writeField
(
"general"
,
binOutputDir
,
prefix
=
interval
.
getStart
+
"-"
+
i
nterval
.
getEnd
)
prefix
=
samInterval
.
getStart
+
"-"
+
samI
nterval
.
getEnd
)
}
status
(
chunkCounter
,
i
nterval
)
status
(
chunkCounter
,
samI
nterval
)
stats
}
binStats
.
toList
.
fold
(
createStats
)(
_
+=
_
)
...
...
@@ -404,7 +404,7 @@ object VcfStats extends ToolCommand {
else
buffer
+=
key
->
(
map
+
(
value
->
map
.
getOrElse
(
value
,
0
)))
}
addToBuffer
(
"QUAL"
,
"not set"
,
false
)
addToBuffer
(
"QUAL"
,
"not set"
,
f
ound
=
f
alse
)
addToBuffer
(
"SampleDistribution-Het"
,
"not set"
,
found
=
false
)
addToBuffer
(
"SampleDistribution-HetNonRef"
,
"not set"
,
found
=
false
)
...
...
@@ -419,25 +419,25 @@ object VcfStats extends ToolCommand {
addToBuffer
(
"SampleDistribution-Filtered"
,
"not set"
,
found
=
false
)
addToBuffer
(
"SampleDistribution-Variant"
,
"not set"
,
found
=
false
)
addToBuffer
(
"general"
,
"Total"
,
false
)
addToBuffer
(
"general"
,
"Biallelic"
,
false
)
addToBuffer
(
"general"
,
"ComplexIndel"
,
false
)
addToBuffer
(
"general"
,
"Filtered"
,
false
)
addToBuffer
(
"general"
,
"FullyDecoded"
,
false
)
addToBuffer
(
"general"
,
"Indel"
,
false
)
addToBuffer
(
"general"
,
"Mixed"
,
false
)
addToBuffer
(
"general"
,
"MNP"
,
false
)
addToBuffer
(
"general"
,
"MonomorphicInSamples"
,
false
)
addToBuffer
(
"general"
,
"NotFiltered"
,
false
)
addToBuffer
(
"general"
,
"PointEvent"
,
false
)
addToBuffer
(
"general"
,
"PolymorphicInSamples"
,
false
)
addToBuffer
(
"general"
,
"SimpleDeletion"
,
false
)
addToBuffer
(
"general"
,
"SimpleInsertion"
,
false
)
addToBuffer
(
"general"
,
"SNP"
,
false
)
addToBuffer
(
"general"
,
"StructuralIndel"
,
false
)
addToBuffer
(
"general"
,
"Symbolic"
,
false
)
addToBuffer
(
"general"
,
"SymbolicOrSV"
,
false
)
addToBuffer
(
"general"
,
"Variant"
,
false
)
addToBuffer
(
"general"
,
"Total"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Biallelic"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"ComplexIndel"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Filtered"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"FullyDecoded"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Indel"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Mixed"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"MNP"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"MonomorphicInSamples"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"NotFiltered"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"PointEvent"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"PolymorphicInSamples"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"SimpleDeletion"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"SimpleInsertion"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"SNP"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"StructuralIndel"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Symbolic"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"SymbolicOrSV"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Variant"
,
f
ound
=
f
alse
)
val
skipTags
=
List
(
"QUAL"
,
"general"
)
...
...
@@ -460,7 +460,7 @@ object VcfStats extends ToolCommand {
else
buffer
+=
key
->
(
map
+
(
value
->
map
.
getOrElse
(
value
,
0
)))
}
addToBuffer
(
"QUAL"
,
Math
.
round
(
record
.
getPhredScaledQual
),
true
)
addToBuffer
(
"QUAL"
,
Math
.
round
(
record
.
getPhredScaledQual
),
found
=
true
)
addToBuffer
(
"SampleDistribution-Het"
,
record
.
getGenotypes
.
count
(
genotype
=>
genotype
.
isHet
),
...
...
@@ -500,7 +500,7 @@ object VcfStats extends ToolCommand {
genotype
.
isHetNonRef
||
genotype
.
isHet
||
genotype
.
isHomVar
),
found
=
true
)
addToBuffer
(
"general"
,
"Total"
,
true
)
addToBuffer
(
"general"
,
"Total"
,
found
=
true
)
addToBuffer
(
"general"
,
"Biallelic"
,
record
.
isBiallelic
)
addToBuffer
(
"general"
,
"ComplexIndel"
,
record
.
isComplexIndel
)
addToBuffer
(
"general"
,
"Filtered"
,
record
.
isFiltered
)
...
...
@@ -541,22 +541,22 @@ object VcfStats extends ToolCommand {
else
buffer
+=
key
->
(
map
+
(
value
->
map
.
getOrElse
(
value
,
0
)))
}
addToBuffer
(
"DP"
,
"not set"
,
false
)
addToBuffer
(
"GQ"
,
"not set"
,
false
)
addToBuffer
(
"general"
,
"Total"
,
false
)
addToBuffer
(
"general"
,
"Het"
,
false
)
addToBuffer
(
"general"
,
"HetNonRef"
,
false
)
addToBuffer
(
"general"
,
"Hom"
,
false
)
addToBuffer
(
"general"
,
"HomRef"
,
false
)
addToBuffer
(
"general"
,
"HomVar"
,
false
)
addToBuffer
(
"general"
,
"Mixed"
,
false
)
addToBuffer
(
"general"
,
"NoCall"
,
false
)
addToBuffer
(
"general"
,
"NonInformative"
,
false
)
addToBuffer
(
"general"
,
"Available"
,
false
)
addToBuffer
(
"general"
,
"Called"
,
false
)
addToBuffer
(
"general"
,
"Filtered"
,
false
)
addToBuffer
(
"general"
,
"Variant"
,
false
)
addToBuffer
(
"DP"
,
"not set"
,
f
ound
=
f
alse
)
addToBuffer
(
"GQ"
,
"not set"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Total"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Het"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"HetNonRef"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Hom"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"HomRef"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"HomVar"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Mixed"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"NoCall"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"NonInformative"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Available"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Called"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Filtered"
,
f
ound
=
f
alse
)
addToBuffer
(
"general"
,
"Variant"
,
f
ound
=
f
alse
)
val
skipTags
=
List
(
"DP"
,
"GQ"
,
"AD"
,
"AD-ref"
,
"AD-alt"
,
"AD-used"
,
"AD-not_used"
,
"general"
)
...
...
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