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
7a5a83fb
Commit
7a5a83fb
authored
Jan 25, 2017
by
Peter van 't Hof
Browse files
Adding metrics of centrifuge to summary
parent
bc930d51
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/centrifuge/Centrifuge.scala
View file @
7a5a83fb
...
...
@@ -2,16 +2,19 @@ package nl.lumc.sasc.biopet.extensions.centrifuge
import
java.io.File
import
nl.lumc.sasc.biopet.core.summary.Summarizable
import
nl.lumc.sasc.biopet.core.
{
BiopetCommandLineFunction
,
Version
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.utils.tryToParseNumber
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.io.Source
import
scala.util.matching.Regex
/**
* Created by pjvanthof on 19/09/16.
*/
class
Centrifuge
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
with
Version
{
class
Centrifuge
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
with
Version
with
Summarizable
{
@Input
(
doc
=
"Input: FastQ or FastA"
,
required
=
true
)
var
inputR1
:
File
=
_
...
...
@@ -129,4 +132,18 @@ class Centrifuge(val root: Configurable) extends BiopetCommandLineFunction with
})
+
(
if
(
outputAsStsout
)
""
else
required
(
"-S"
,
output
))
+
optional
(
"--report-file"
,
report
)
/** Must return files to store into summary */
override
def
summaryFiles
:
Map
[
String
,
File
]
=
metFile
.
map
(
"metrics"
->
_
).
toMap
/** Must returns stats to store into summary */
override
def
summaryStats
:
Any
=
{
metFile
.
map
{
file
=>
val
reader
=
Source
.
fromFile
(
file
)
val
header
=
reader
.
getLines
().
next
().
split
(
"\t"
)
val
values
=
reader
.
getLines
().
next
().
split
(
"\t"
).
map
(
tryToParseNumber
(
_
,
true
).
get
)
reader
.
close
()
Map
(
"metrics"
->
header
.
zip
(
values
).
toMap
)
}.
getOrElse
(
Map
())
}
}
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