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
8e07f7fe
Commit
8e07f7fe
authored
May 18, 2016
by
Wai Yi Leung
Browse files
Merge remote-tracking branch 'origin/develop' into develop
parents
36a52827
11c11c41
Changes
44
Hide whitespace changes
Inline
Side-by-side
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
View file @
8e07f7fe
...
...
@@ -17,15 +17,16 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics
import
java.io.File
import
nl.lumc.sasc.biopet.core.annotations.
{
RibosomalRefFlat
,
Annotation
RefFlat
}
import
nl.lumc.sasc.biopet.core.annotations.
{
AnnotationRefFlat
,
Ribosomal
RefFlat
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.core.
{
Reference
,
BiopetFifoPipe
,
PipelineCommand
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.core.
{
BiopetFifoPipe
,
PipelineCommand
,
Reference
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
}
import
nl.lumc.sasc.biopet.extensions.picard._
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import
nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import
nl.lumc.sasc.biopet.extensions.tools.BiopetFlagstat
import
nl.lumc.sasc.biopet.utils.intervals.BedCheck
import
org.broadinstitute.gatk.queue.QScript
class
BamMetrics
(
val
root
:
Configurable
)
extends
QScript
...
...
@@ -72,6 +73,8 @@ class BamMetrics(val root: Configurable) extends QScript
/** executed before script */
def
init
()
:
Unit
=
{
inputFiles
:+=
new
InputFile
(
inputBam
)
ampliconBedFile
.
foreach
(
BedCheck
.
checkBedFileToReference
(
_
,
referenceFasta
(),
biopetError
=
true
))
roiBedFiles
.
foreach
(
BedCheck
.
checkBedFileToReference
(
_
,
referenceFasta
(),
biopetError
=
true
))
}
/** Script to add jobs */
...
...
bammetrics/src/test/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
View file @
8e07f7fe
...
...
@@ -61,9 +61,9 @@ class BamMetricsTest extends TestNGSuite with Matchers {
def
testBamMetrics
(
rois
:
Int
,
amplicon
:
Boolean
,
rna
:
Boolean
,
wgs
:
Boolean
)
=
{
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
BamMetricsTest
.
outputDir
,
"rna_metrics"
->
rna
,
"wgs_metrics"
->
wgs
),
Map
(
BamMetricsTest
.
executables
.
toSeq
:
_
*
))
++
(
if
(
amplicon
)
Map
(
"amplicon_bed"
->
"amplicon.bed"
)
else
Map
())
++
(
if
(
amplicon
)
Map
(
"amplicon_bed"
->
BamMetricsTest
.
ampliconBed
.
getAbsolutePath
)
else
Map
())
++
(
if
(
rna
)
Map
(
"annotation_refflat"
->
"transcripts.refFlat"
)
else
Map
())
++
Map
(
"regions_of_interest"
->
(
1
to
rois
).
map
(
"roi_"
+
_
+
".bed"
).
toList
)
Map
(
"regions_of_interest"
->
(
1
to
rois
).
map
(
BamMetricsTest
.
roi
(
_
).
getAbsolutePath
).
toList
)
val
bammetrics
:
BamMetrics
=
initPipeline
(
map
)
bammetrics
.
inputBam
=
BamMetricsTest
.
bam
...
...
@@ -94,6 +94,14 @@ object BamMetricsTest {
val
bam
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
"bla.bam"
)
Files
.
touch
(
bam
)
val
ampliconBed
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
"amplicon_bed.bed"
)
Files
.
touch
(
ampliconBed
)
def
roi
(
i
:
Int
)
:
File
=
{
val
roi
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
s
"roi${i}.bed"
)
Files
.
touch
(
roi
)
roi
}
private
def
copyFile
(
name
:
String
)
:
Unit
=
{
val
is
=
getClass
.
getResourceAsStream
(
"/"
+
name
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetFifoPipe.scala
View file @
8e07f7fe
...
...
@@ -73,6 +73,8 @@ class BiopetFifoPipe(val root: Configurable,
_pipesJobs
:::=
commands
_pipesJobs
=
_pipesJobs
.
distinct
analysisName
=
commands
.
map
(
_
.
analysisName
).
mkString
(
"_"
)
}
override
def
beforeCmd
()
:
Unit
=
{
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
View file @
8e07f7fe
...
...
@@ -132,7 +132,7 @@ trait ReportBuilder extends ToolCommand {
logger
.
info
(
"Start"
)
val
argsParser
=
new
OptParser
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
require
(
cmdArgs
.
outputDir
.
exists
(),
"Output dir does not exist"
)
require
(
cmdArgs
.
outputDir
.
isDirectory
,
"Output dir is not a directory"
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/AnnotateVcfWithBed.scala
View file @
8e07f7fe
...
...
@@ -80,7 +80,7 @@ object AnnotateVcfWithBed extends ToolCommand {
logger
.
info
(
"Start"
)
val
argsParser
=
new
OptParser
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
fieldType
=
cmdArgs
.
fieldType
match
{
case
"Integer"
=>
VCFHeaderLineType
.
Integer
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala
View file @
8e07f7fe
...
...
@@ -53,10 +53,7 @@ object BaseCounter extends ToolCommand {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
match
{
case
Some
(
x
)
=>
x
case
_
=>
throw
new
IllegalArgumentException
}
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
//Sets picard logging level
htsjdk
.
samtools
.
util
.
Log
.
setGlobalLogLevel
(
htsjdk
.
samtools
.
util
.
Log
.
LogLevel
.
valueOf
(
logger
.
getLevel
.
toString
))
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
View file @
8e07f7fe
...
...
@@ -113,7 +113,7 @@ object BastyGenerateFasta extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
cmdArgs
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
cmdArgs
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
if
(
cmdArgs
.
outputVariants
!=
null
)
{
writeVariantsOnly
()
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BedToInterval.scala
View file @
8e07f7fe
...
...
@@ -47,7 +47,7 @@ object BedToInterval extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
writer
=
new
PrintWriter
(
commandArgs
.
outputFile
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BedtoolsCoverageToCounts.scala
View file @
8e07f7fe
...
...
@@ -39,7 +39,7 @@ object BedtoolsCoverageToCounts extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
if
(!
commandArgs
.
input
.
exists
)
throw
new
IllegalStateException
(
"Input file not found, file: "
+
commandArgs
.
input
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstat.scala
View file @
8e07f7fe
...
...
@@ -50,7 +50,7 @@ object BiopetFlagstat extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
inputSam
=
SamReaderFactory
.
makeDefault
.
open
(
commandArgs
.
inputFile
)
val
iterSam
=
if
(
commandArgs
.
region
.
isEmpty
)
inputSam
.
iterator
else
{
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/CheckAllelesVcfInBam.scala
View file @
8e07f7fe
...
...
@@ -71,7 +71,7 @@ object CheckAllelesVcfInBam extends ToolCommand {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
if
(
commandArgs
.
bamFiles
.
size
!=
commandArgs
.
samples
.
size
)
logger
.
warn
(
"Number of samples is different from number of bam files: additional samples or bam files will not be used"
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
View file @
8e07f7fe
...
...
@@ -242,7 +242,7 @@ object ExtractAlignedFastq extends ToolCommand {
def
parseArgs
(
args
:
Array
[
String
])
:
Args
=
new
OptParser
()
.
parse
(
args
,
Args
())
.
getOrElse
(
sys
.
exit
(
1
)
)
.
getOrElse
(
throw
new
IllegalArgumentException
)
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FastqSplitter.scala
View file @
8e07f7fe
...
...
@@ -45,7 +45,7 @@ object FastqSplitter extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
groupSize
=
100
val
output
=
for
(
file
<-
commandArgs
.
outputFile
)
yield
new
AsyncFastqWriter
(
new
BasicFastqWriter
(
file
),
groupSize
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FastqSync.scala
View file @
8e07f7fe
...
...
@@ -151,7 +151,7 @@ object FastqSync extends ToolCommand {
*/
def
parseArgs
(
args
:
Array
[
String
])
:
Args
=
new
OptParser
()
.
parse
(
args
,
Args
())
.
getOrElse
(
sys
.
exit
(
1
)
)
.
getOrElse
(
throw
new
IllegalArgumentException
)
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala
View file @
8e07f7fe
...
...
@@ -46,7 +46,7 @@ object FindRepeatsPacBio extends ToolCommand {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
bamReader
=
SamReaderFactory
.
makeDefault
.
validationStringency
(
ValidationStringency
.
SILENT
)
.
open
(
commandArgs
.
inputBam
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/GvcfToBed.scala
View file @
8e07f7fe
...
...
@@ -57,7 +57,7 @@ object GvcfToBed extends ToolCommand {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
cmdArgs
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
cmdArgs
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
logger
.
debug
(
"Opening reader"
)
val
reader
=
new
VCFFileReader
(
cmdArgs
.
inputVcf
,
false
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/KrakenReportToJson.scala
View file @
8e07f7fe
...
...
@@ -90,7 +90,7 @@ object KrakenReportToJson extends ToolCommand {
*/
def
parseArgs
(
args
:
Array
[
String
])
:
Args
=
new
OptParser
()
.
parse
(
args
,
Args
())
.
getOrElse
(
sys
.
exit
(
1
)
)
.
getOrElse
(
throw
new
IllegalArgumentException
)
/**
* Takes a line from the kraken report, converts into Map with taxonID and
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/MergeAlleles.scala
View file @
8e07f7fe
...
...
@@ -50,7 +50,7 @@ object MergeAlleles extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
readers
=
commandArgs
.
inputFiles
.
map
(
new
VCFFileReader
(
_
,
true
))
val
referenceFile
=
new
FastaSequenceFile
(
commandArgs
.
reference
,
true
)
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/MergeOtuMaps.scala
View file @
8e07f7fe
...
...
@@ -41,7 +41,7 @@ object MergeOtuMaps extends ToolCommand {
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
var
map
:
Map
[
Long
,
String
]
=
Map
()
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/MergeTables.scala
View file @
8e07f7fe
...
...
@@ -188,7 +188,7 @@ object MergeTables extends ToolCommand {
/** Parses the command line argument */
def
parseArgs
(
args
:
Array
[
String
])
:
Args
=
new
OptParser
()
.
parse
(
args
,
Args
())
.
getOrElse
(
sys
.
exit
(
1
)
)
.
getOrElse
(
throw
new
IllegalArgumentException
)
/** Transforms the input file seq into a seq of [[InputTable]] objects */
def
prepInput
(
inFiles
:
Seq
[
File
],
ext
:
String
,
columnNames
:
Option
[
Seq
[
String
]])
:
Seq
[
InputTable
]
=
{
...
...
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
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