Skip to content
GitLab
Menu
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
ed129189
Commit
ed129189
authored
Jul 21, 2016
by
Peter van 't Hof
Browse files
Remove duplicated stats
parent
99f13260
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala
View file @
ed129189
...
@@ -94,8 +94,6 @@ object BamStats extends ToolCommand {
...
@@ -94,8 +94,6 @@ object BamStats extends ToolCommand {
val
stats
=
waitOnFutures
(
unmappedFuture
::
contigsFutures
.
toList
)
val
stats
=
waitOnFutures
(
unmappedFuture
::
contigsFutures
.
toList
)
logger
.
info
(
s
"total: ${stats.totalReads}, unmapped: ${stats.unmapped}, secondary: ${stats.secondary}"
)
stats
.
writeStatsToFiles
(
outputDir
)
stats
.
writeStatsToFiles
(
outputDir
)
}
}
...
@@ -167,10 +165,7 @@ object BamStats extends ToolCommand {
...
@@ -167,10 +165,7 @@ object BamStats extends ToolCommand {
// Read based stats
// Read based stats
if
(
samRecord
.
getAlignmentStart
>
threadStart
&&
samRecord
.
getAlignmentStart
<=
threadEnd
)
{
if
(
samRecord
.
getAlignmentStart
>
threadStart
&&
samRecord
.
getAlignmentStart
<=
threadEnd
)
{
totalStats
.
flagstat
.
loadRecord
(
samRecord
)
totalStats
.
flagstat
.
loadRecord
(
samRecord
)
totalStats
.
totalReads
+=
1
if
(!
samRecord
.
getReadUnmappedFlag
)
{
// Mapped read
if
(
samRecord
.
isSecondaryOrSupplementary
)
totalStats
.
secondary
+=
1
if
(
samRecord
.
getReadUnmappedFlag
)
totalStats
.
unmapped
+=
1
else
{
// Mapped read
totalStats
.
mappingQualityHistogram
.
add
(
samRecord
.
getMappingQuality
)
totalStats
.
mappingQualityHistogram
.
add
(
samRecord
.
getMappingQuality
)
}
}
if
(
samRecord
.
getProperPairFlag
&&
samRecord
.
getFirstOfPairFlag
&&
!
samRecord
.
getSecondOfPairFlag
)
if
(
samRecord
.
getProperPairFlag
&&
samRecord
.
getFirstOfPairFlag
&&
!
samRecord
.
getSecondOfPairFlag
)
...
@@ -212,8 +207,6 @@ object BamStats extends ToolCommand {
...
@@ -212,8 +207,6 @@ object BamStats extends ToolCommand {
val
samReader
=
SamReaderFactory
.
makeDefault
().
open
(
bamFile
)
val
samReader
=
SamReaderFactory
.
makeDefault
().
open
(
bamFile
)
for
(
samRecord
<-
samReader
.
queryUnmapped
())
{
for
(
samRecord
<-
samReader
.
queryUnmapped
())
{
stats
.
flagstat
.
loadRecord
(
samRecord
)
stats
.
flagstat
.
loadRecord
(
samRecord
)
stats
.
totalReads
+=
1
stats
.
unmapped
+=
1
}
}
samReader
.
close
()
samReader
.
close
()
stats
stats
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/Stats.scala
View file @
ed129189
...
@@ -7,10 +7,7 @@ import nl.lumc.sasc.biopet.tools.flagstat.FlagstatCollector
...
@@ -7,10 +7,7 @@ import nl.lumc.sasc.biopet.tools.flagstat.FlagstatCollector
/**
/**
* Created by pjvanthof on 05/07/16.
* Created by pjvanthof on 05/07/16.
*/
*/
case
class
Stats
(
var
totalReads
:
Long
=
0L
,
case
class
Stats
(
flagstat
:
FlagstatCollector
=
new
FlagstatCollector
(),
var
unmapped
:
Long
=
0L
,
var
secondary
:
Long
=
0L
,
flagstat
:
FlagstatCollector
=
new
FlagstatCollector
(),
mappingQualityHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
mappingQualityHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
insertSizeHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
insertSizeHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
clippingHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
clippingHistogram
:
Histogram
[
Int
]
=
new
Histogram
[
Int
](),
...
@@ -24,8 +21,6 @@ case class Stats(var totalReads: Long = 0L,
...
@@ -24,8 +21,6 @@ case class Stats(var totalReads: Long = 0L,
/** This will add an other [[Stats]] inside `this` */
/** This will add an other [[Stats]] inside `this` */
def
+=
(
other
:
Stats
)
:
Stats
=
{
def
+=
(
other
:
Stats
)
:
Stats
=
{
this
.
totalReads
+=
other
.
totalReads
this
.
unmapped
+=
other
.
unmapped
this
.
flagstat
+=
other
.
flagstat
this
.
flagstat
+=
other
.
flagstat
this
.
mappingQualityHistogram
+=
other
.
mappingQualityHistogram
this
.
mappingQualityHistogram
+=
other
.
mappingQualityHistogram
this
.
insertSizeHistogram
+=
other
.
insertSizeHistogram
this
.
insertSizeHistogram
+=
other
.
insertSizeHistogram
...
...
Write
Preview
Supports
Markdown
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