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
16fafb4e
Commit
16fafb4e
authored
Nov 22, 2016
by
Peter van 't Hof
Browse files
Format fixes
parent
065bf160
Changes
4
Hide whitespace changes
Inline
Side-by-side
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
View file @
16fafb4e
...
@@ -16,13 +16,13 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics
...
@@ -16,13 +16,13 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics
import
java.io.File
import
java.io.File
import
nl.lumc.sasc.biopet.core.annotations.
{
AnnotationRefFlat
,
RibosomalRefFlat
}
import
nl.lumc.sasc.biopet.core.annotations.
{
AnnotationRefFlat
,
RibosomalRefFlat
}
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.core.
{
BiopetFifoPipe
,
PipelineCommand
,
Reference
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.core.
{
BiopetFifoPipe
,
PipelineCommand
,
Reference
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
,
BedtoolsSort
}
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
,
BedtoolsSort
}
import
nl.lumc.sasc.biopet.extensions.picard._
import
nl.lumc.sasc.biopet.extensions.picard._
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import
nl.lumc.sasc.biopet.extensions.tools.
{
BamStats
,
BiopetFlagstat
}
import
nl.lumc.sasc.biopet.extensions.tools.
{
BamStats
,
BiopetFlagstat
}
import
nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import
nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.utils.intervals.BedCheck
import
nl.lumc.sasc.biopet.utils.intervals.BedCheck
...
...
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala
View file @
16fafb4e
...
@@ -183,8 +183,9 @@ object BammetricsReport extends ReportBuilder {
...
@@ -183,8 +183,9 @@ object BammetricsReport extends ReportBuilder {
)
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
.
map
{
case
(
sample
,
lib
)
=>
.
map
{
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
case
(
sample
,
lib
)
=>
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
}
}
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"insert_size"
),
"insert_size"
)
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"insert_size"
),
"insert_size"
)
...
@@ -219,8 +220,9 @@ object BammetricsReport extends ReportBuilder {
...
@@ -219,8 +220,9 @@ object BammetricsReport extends ReportBuilder {
)
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
.
map
{
case
(
sample
,
lib
)
=>
.
map
{
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
case
(
sample
,
lib
)
=>
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
}
}
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"coverage"
),
"coverage"
)
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"coverage"
),
"coverage"
)
...
@@ -255,8 +257,9 @@ object BammetricsReport extends ReportBuilder {
...
@@ -255,8 +257,9 @@ object BammetricsReport extends ReportBuilder {
)
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
val
tables
=
getSampleLibraries
(
summary
,
sampleId
,
libId
,
libraryLevel
)
.
map
{
case
(
sample
,
lib
)
=>
.
map
{
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
case
(
sample
,
lib
)
=>
getTableFromSummary
(
summary
,
paths
(
lib
.
map
(
l
=>
s
"$sample-$l"
).
getOrElse
(
sample
)),
Some
(
sample
),
lib
)
}
}
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"normalized_position"
),
"normalized_position"
)
writeTableToTsv
(
tsvFile
,
mergeTables
(
tables
.
toArray
,
"normalized_position"
),
"normalized_position"
)
...
@@ -281,10 +284,11 @@ object BammetricsReport extends ReportBuilder {
...
@@ -281,10 +284,11 @@ object BammetricsReport extends ReportBuilder {
paths
:
Map
[
String
,
List
[
String
]],
paths
:
Map
[
String
,
List
[
String
]],
sampleId
:
Option
[
String
]
=
None
,
sampleId
:
Option
[
String
]
=
None
,
libId
:
Option
[
String
]
=
None
)
:
Map
[
String
,
Array
[
Any
]]
=
{
libId
:
Option
[
String
]
=
None
)
:
Map
[
String
,
Array
[
Any
]]
=
{
val
pathValues
:
Map
[
String
,
Array
[
Any
]]
=
paths
.
map
{
case
(
key
,
path
)
=>
val
pathValues
:
Map
[
String
,
Array
[
Any
]]
=
paths
.
map
{
val
value
=
summary
.
getValueAsArray
(
sampleId
,
libId
,
path
:_
*
)
case
(
key
,
path
)
=>
require
(
value
.
isDefined
,
s
"Sample: $sampleId, library: $libId on path: '${path.mkString("
,
")}' does not exist in summary"
)
val
value
=
summary
.
getValueAsArray
(
sampleId
,
libId
,
path
:
_
*
)
key
->
value
.
get
require
(
value
.
isDefined
,
s
"Sample: $sampleId, library: $libId on path: '${path.mkString("
,
")}' does not exist in summary"
)
key
->
value
.
get
}
}
require
(
pathValues
.
map
(
_
.
_2
.
size
).
toList
.
distinct
==
1
,
s
"Arrays in summary does not have the same number of values, $paths"
)
require
(
pathValues
.
map
(
_
.
_2
.
size
).
toList
.
distinct
==
1
,
s
"Arrays in summary does not have the same number of values, $paths"
)
pathValues
pathValues
...
@@ -303,8 +307,9 @@ object BammetricsReport extends ReportBuilder {
...
@@ -303,8 +307,9 @@ object BammetricsReport extends ReportBuilder {
val
keys
=
table
.
keys
.
filterNot
(
_
==
firstColumn
).
toList
.
sorted
val
keys
=
table
.
keys
.
filterNot
(
_
==
firstColumn
).
toList
.
sorted
val
writer
=
new
PrintWriter
(
tsvFile
)
val
writer
=
new
PrintWriter
(
tsvFile
)
writer
.
println
((
firstColumn
::
keys
).
mkString
(
"\t"
))
writer
.
println
((
firstColumn
::
keys
).
mkString
(
"\t"
))
table
(
firstColumn
).
zipWithIndex
.
foreach
{
case
(
c
,
i
)
=>
table
(
firstColumn
).
zipWithIndex
.
foreach
{
writer
.
println
((
c
::
keys
.
map
(
x
=>
table
(
x
)(
i
))).
mkString
(
"\t"
))
case
(
c
,
i
)
=>
writer
.
println
((
c
::
keys
.
map
(
x
=>
table
(
x
)(
i
))).
mkString
(
"\t"
))
}
}
writer
.
close
()
writer
.
close
()
}
}
...
...
biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/BamStats.scala
View file @
16fafb4e
...
@@ -3,7 +3,7 @@ package nl.lumc.sasc.biopet.extensions.tools
...
@@ -3,7 +3,7 @@ package nl.lumc.sasc.biopet.extensions.tools
import
java.io.File
import
java.io.File
import
nl.lumc.sasc.biopet.core.summary.Summarizable
import
nl.lumc.sasc.biopet.core.summary.Summarizable
import
nl.lumc.sasc.biopet.core.
{
Reference
,
ToolCommandFunction
}
import
nl.lumc.sasc.biopet.core.
{
Reference
,
ToolCommandFunction
}
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.Input
import
org.broadinstitute.gatk.utils.commandline.Input
...
@@ -12,8 +12,8 @@ import scala.collection.JavaConversions._
...
@@ -12,8 +12,8 @@ import scala.collection.JavaConversions._
import
scala.io.Source
import
scala.io.Source
/**
/**
* Created by pjvanthof on 18/11/2016.
* Created by pjvanthof on 18/11/2016.
*/
*/
class
BamStats
(
val
root
:
Configurable
)
extends
ToolCommandFunction
with
Reference
with
Summarizable
{
class
BamStats
(
val
root
:
Configurable
)
extends
ToolCommandFunction
with
Reference
with
Summarizable
{
def
toolObject
=
nl
.
lumc
.
sasc
.
biopet
.
tools
.
bamstats
.
BamStats
def
toolObject
=
nl
.
lumc
.
sasc
.
biopet
.
tools
.
bamstats
.
BamStats
...
@@ -35,7 +35,7 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
...
@@ -35,7 +35,7 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
def
getOutputFile
(
name
:
String
,
contig
:
Option
[
String
]
=
None
)
:
File
=
{
def
getOutputFile
(
name
:
String
,
contig
:
Option
[
String
]
=
None
)
:
File
=
{
contig
match
{
contig
match
{
case
Some
(
contig
)
=>
new
File
(
outputDir
,
"contigs"
+
File
.
separator
+
contig
+
File
.
separator
+
name
)
case
Some
(
contig
)
=>
new
File
(
outputDir
,
"contigs"
+
File
.
separator
+
contig
+
File
.
separator
+
name
)
case
_
=>
new
File
(
outputDir
,
name
)
case
_
=>
new
File
(
outputDir
,
name
)
}
}
}
}
...
@@ -57,7 +57,6 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
...
@@ -57,7 +57,6 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
optional
(
"--binSize"
,
binSize
)
+
optional
(
"--binSize"
,
binSize
)
+
optional
(
"--threadBinSize"
,
threadBinSize
)
optional
(
"--threadBinSize"
,
threadBinSize
)
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
()
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
()
def
summaryStats
:
Map
[
String
,
Any
]
=
Map
(
def
summaryStats
:
Map
[
String
,
Any
]
=
Map
(
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/summary/Summary.scala
View file @
16fafb4e
...
@@ -80,7 +80,7 @@ class Summary(file: File) {
...
@@ -80,7 +80,7 @@ class Summary(file: File) {
/** Get value on nested path with prefix depending is sampleId and/or libId is None or not */
/** Get value on nested path with prefix depending is sampleId and/or libId is None or not */
def
getValueAsArray
(
sampleId
:
Option
[
String
],
libId
:
Option
[
String
],
path
:
String*
)
:
Option
[
Array
[
Any
]]
=
{
def
getValueAsArray
(
sampleId
:
Option
[
String
],
libId
:
Option
[
String
],
path
:
String*
)
:
Option
[
Array
[
Any
]]
=
{
this
.
getValue
(
sampleId
,
libId
,
path
:_
*
).
map
(
ConfigUtils
.
any2list
(
_
).
toArray
)
this
.
getValue
(
sampleId
,
libId
,
path
:
_
*
).
map
(
ConfigUtils
.
any2list
(
_
).
toArray
)
}
}
/**
/**
...
...
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