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
7dabaeca
Commit
7dabaeca
authored
Mar 07, 2015
by
bow
Browse files
Update Picard metrics parsing to better handle nonexistent files
parent
24d23ba1
Changes
5
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/picard/CollectAlignmentSummaryMetrics.scala
View file @
7dabaeca
...
...
@@ -63,18 +63,18 @@ class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
()
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
(
header
,
content
)
=
Picard
.
getMetrics
(
output
)
(
for
(
category
<-
0
until
content
.
size
)
yield
{
content
(
category
)(
0
)
->
(
for
(
i
<-
1
until
header
.
size
if
i
<
content
(
category
).
size
)
yield
{
header
(
i
).
toLowerCase
->
content
(
category
)(
i
)
}).
toMap
}
).
toMap
def
summaryStats
:
Map
[
String
,
Any
]
=
Picard
.
getMetrics
(
output
)
match
{
case
None
=>
Map
(
)
case
Some
((
header
,
content
))
=>
(
for
(
category
<-
0
until
content
.
size
)
yield
{
content
(
category
)(
0
)
->
(
for
(
i
<-
1
until
header
.
size
if
i
<
content
(
category
).
size
)
yield
{
header
(
i
).
toLowerCase
->
content
(
category
)(
i
)
}).
toMap
}
).
toMap
}
}
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/picard/CollectInsertSizeMetrics.scala
View file @
7dabaeca
...
...
@@ -74,11 +74,13 @@ class CollectInsertSizeMetrics(val root: Configurable) extends Picard with Summa
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
(
"output_histogram"
->
outputHistogram
)
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
(
header
,
content
)
=
Picard
.
getMetrics
(
output
)
(
for
(
i
<-
0
to
header
.
size
if
i
<
content
.
head
.
size
)
yield
(
header
(
i
).
toLowerCase
->
content
.
head
(
i
))).
toMap
def
summaryStats
:
Map
[
String
,
Any
]
=
Picard
.
getMetrics
(
output
)
match
{
case
None
=>
Map
()
case
Some
((
header
,
content
))
=>
(
for
(
i
<-
0
to
header
.
size
if
i
<
content
.
head
.
size
)
yield
header
(
i
).
toLowerCase
->
content
.
head
(
i
)).
toMap
}
}
object
CollectInsertSizeMetrics
{
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/picard/CollectRnaSeqMetrics.scala
View file @
7dabaeca
...
...
@@ -77,13 +77,13 @@ class CollectRnaSeqMetrics(val root: Configurable) extends Picard with Summariza
//"output_chart" -> chartOutput
).
collect
{
case
(
key
,
Some
(
value
))
=>
key
->
value
}
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
(
header
,
content
)
=
Picard
.
getMetrics
(
output
)
header
.
zip
(
content
)
.
map
{
case
(
h
,
c
)
=>
h
.
toLowerCase
->
c
.
head
}
.
toMap
def
summaryStats
:
Map
[
String
,
Any
]
=
Picard
.
getMetrics
(
output
)
match
{
case
None
=>
Map
(
)
case
Some
((
header
,
content
))
=>
header
.
zip
(
content
)
.
map
{
case
(
h
,
c
)
=>
h
.
toLowerCase
->
c
.
head
}
.
toMap
}
override
def
commandLine
=
super
.
commandLine
+
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/picard/MarkDuplicates.scala
View file @
7dabaeca
...
...
@@ -95,18 +95,18 @@ class MarkDuplicates(val root: Configurable) extends Picard with Summarizable {
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
()
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
(
header
,
content
)
=
Picard
.
getMetrics
(
outputMetrics
)
(
for
(
category
<-
0
until
content
.
size
)
yield
{
content
(
category
)(
0
)
->
(
for
(
i
<-
1
until
header
.
size
if
i
<
content
(
category
).
size
)
yield
{
header
(
i
).
toLowerCase
->
content
(
category
)(
i
)
}).
toMap
}
).
toMap
def
summaryStats
:
Map
[
String
,
Any
]
=
Picard
.
getMetrics
(
outputMetrics
)
match
{
case
None
=>
Map
(
)
case
Some
((
header
,
content
))
=>
(
for
(
category
<-
0
until
content
.
size
)
yield
{
content
(
category
)(
0
)
->
(
for
(
i
<-
1
until
header
.
size
if
i
<
content
(
category
).
size
)
yield
{
header
(
i
).
toLowerCase
->
content
(
category
)(
i
)
}).
toMap
}
).
toMap
}
}
object
MarkDuplicates
{
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/picard/Picard.scala
View file @
7dabaeca
...
...
@@ -66,15 +66,20 @@ abstract class Picard extends BiopetJavaCommandLineFunction {
}
object
Picard
{
def
getMetrics
(
file
:
File
)
=
{
val
lines
=
Source
.
fromFile
(
file
).
getLines
().
toArray
def
getMetrics
(
file
:
File
)
:
Option
[(
Array
[
String
]
,
List
[
Array
[
String
]])]
=
val
start
=
lines
.
indexWhere
(
_
.
startsWith
(
"## METRICS CLASS"
))
+
1
val
end
=
lines
.
indexOf
(
""
,
start
)
if
(
file
.
exists
)
{
val
lines
=
Source
.
fromFile
(
file
).
getLines
().
toArray
val
header
=
lines
(
start
).
split
(
"\t"
)
val
content
=
(
for
(
i
<-
(
start
+
1
)
until
end
)
yield
lines
(
i
).
split
(
"\t"
)).
toList
val
start
=
lines
.
indexWhere
(
_
.
startsWith
(
"## METRICS CLASS"
))
+
1
val
end
=
lines
.
indexOf
(
""
,
start
)
val
header
=
lines
(
start
).
split
(
"\t"
)
val
content
=
(
for
(
i
<-
(
start
+
1
)
until
end
)
yield
lines
(
i
).
split
(
"\t"
)).
toList
Option
((
header
,
content
))
}
else
{
None
}
(
header
,
content
)
}
}
\ No newline at end of file
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