Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
38194b88
Commit
38194b88
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
First version of write function
parent
982c0460
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
+39
-1
39 additions, 1 deletion
...scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
with
39 additions
and
1 deletion
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
+
39
−
1
View file @
38194b88
package
nl.lumc.sasc.biopet.core.summary
import
java.io.
{
PrintWriter
,
File
}
import
java.io.
{
FileInputStream
,
PrintWriter
,
File
}
import
java.security.MessageDigest
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
org.broadinstitute.gatk.queue.function.
{
QFunction
,
InProcessFunction
}
import
org.broadinstitute.gatk.utils.commandline.
{
Output
,
Input
}
import
scala.collection.mutable
import
scala.io.Source
/**
* Created by pjvan_thof on 2/14/15.
*/
...
...
@@ -37,6 +42,39 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def
run
()
:
Unit
=
{
val
writer
=
new
PrintWriter
(
out
)
val
bla
=
for
(((
name
,
sampleId
,
libraryId
),
summarizables
)
<-
summaryQScript
.
summarizables
;
summarizable
<-
summarizables
)
yield
{
val
map
=
Map
(
name
->
parseSummarizable
(
summarizable
))
(
sampleId
match
{
case
Some
(
sampleId
)
=>
Map
(
"samples"
->
Map
(
sampleId
->
(
libraryId
match
{
case
Some
(
libraryId
)
=>
Map
(
"libraries"
->
Map
(
libraryId
->
map
))
case
_
=>
map
})))
case
_
=>
map
},
(
v1
:
Any
,
v2
:
Any
,
key
:
String
)
=>
summarizable
.
resolveSummaryConflict
(
v1
,
v2
,
key
))
}
bla
.
foldRight
(
Map
[
String
,
Any
]())((
a
,
b
)
=>
ConfigUtils
.
mergeMaps
(
a
.
_1
,
b
,
a
.
_2
))
//TODO: QScript merging
writer
.
close
()
}
def
parseSummarizable
(
summarizable
:
Summarizable
)
:
Map
[
String
,
Map
[
String
,
Any
]]
=
{
Map
(
"data"
->
summarizable
.
summaryData
,
"files"
->
parseFiles
(
summarizable
.
summaryFiles
))
}
def
parseFiles
(
files
:
Map
[
String
,
File
])
:
Map
[
String
,
Map
[
String
,
Any
]]
=
{
for
((
key
,
file
)
<-
files
)
yield
{
val
map
:
mutable.Map
[
String
,
Any
]
=
mutable
.
Map
()
map
+=
"path"
->
file
.
getAbsolutePath
if
(
md5sum
)
map
+=
"md5"
->
parseChechsum
(
SummaryQScript
.
md5sumCache
(
file
))
key
->
map
.
toMap
}
}
def
parseChechsum
(
checksumFile
:
File
)
:
String
=
{
Source
.
fromFile
(
checksumFile
).
getLines
().
toList
.
head
.
split
(
" "
)(
0
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment