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
ea4f80e1
Commit
ea4f80e1
authored
Jun 23, 2014
by
Peter van 't Hof
Browse files
Changed constructors
parent
c7abaef3
Changes
16
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/function/Ln.scala
View file @
ea4f80e1
...
...
@@ -7,7 +7,7 @@ import org.broadinstitute.sting.commandline._
import
java.io.File
import
scala.sys.process._
class
Ln
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
InProcessFunction
with
Configurable
{
class
Ln
(
val
root
:
Configurable
)
extends
InProcessFunction
with
Configurable
{
this
.
analysisName
=
getClass
.
getSimpleName
@Input
(
doc
=
"Input file"
)
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/function/Sha1sum.scala
View file @
ea4f80e1
...
...
@@ -5,7 +5,7 @@ import nl.lumc.sasc.biopet.core.config._
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
Sha1sum
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Sha1sum
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Zipped file"
)
var
input
:
File
=
_
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/function/Zcat.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import nl.lumc.sasc.biopet.core.config._
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
Zcat
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Zcat
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Zipped file"
)
var
input
:
File
=
_
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/function/fastq/Cutadapt.scala
View file @
ea4f80e1
...
...
@@ -7,7 +7,7 @@ import java.io.File
import
scala.io.Source._
import
scala.sys.process._
class
Cutadapt
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Cutadapt
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Input fastq file"
)
var
fastq_input
:
File
=
_
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/function/fastq/Fastqc.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,8 @@ import org.broadinstitute.sting.commandline._
import
java.io.File
import
scala.sys.process._
class
Fastqc
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
])
extends
BiopetCommandLineFunction
{
class
Fastqc
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Contaminants"
,
required
=
false
)
var
contaminants
:
File
=
_
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/function/fastq/Sickle.scala
View file @
ea4f80e1
...
...
@@ -7,7 +7,7 @@ import java.io.File
import
scala.io.Source._
import
scala.sys.process._
class
Sickle
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Sickle
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"R1 input"
)
var
input_R1
:
File
=
null
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Flexiprep.scala
View file @
ea4f80e1
...
...
@@ -12,15 +12,20 @@ import scala.util.parsing.json._
import
org.broadinstitute.sting.commandline._
import
nl.lumc.sasc.biopet.pipelines.flexiprep.scripts._
class
Flexiprep
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
QScript
with
BiopetQScript
{
def
this
()
=
this
(
n
ew
Config
(),
Ni
l
)
class
Flexiprep
(
val
root
:
Configurable
)
extends
QScript
with
BiopetQScript
{
def
this
()
=
this
(
n
ul
l
)
@Argument
(
doc
=
"Config Json file"
,
shortName
=
"config"
,
required
=
false
)
val
configfiles
:
List
[
File
]
=
Nil
@Input
(
doc
=
"R1 fastq file (gzipped allowed)"
,
shortName
=
"R1"
,
required
=
true
)
var
input_R1
:
File
=
_
@Input
(
doc
=
"R2 fastq file (gzipped allowed)"
,
shortName
=
"R2"
,
required
=
false
)
var
input_R2
:
File
=
_
@Argument
(
doc
=
"Output directory"
,
shortName
=
"outputDir"
,
required
=
true
)
var
outputDir
:
String
=
_
@Argument
(
doc
=
"Skip Trim fastq files"
,
shortName
=
"skiptrim"
,
required
=
false
)
var
skipTrim
:
Boolean
=
false
@Argument
(
doc
=
"Skip Clip fastq files"
,
shortName
=
"skipclip"
,
required
=
false
)
var
skipClip
:
Boolean
=
false
@Input
(
doc
=
"R1 fastq file (gzipped allowed)"
,
shortName
=
"R1"
,
required
=
true
)
var
input_R1
:
File
=
_
@Input
(
doc
=
"R2 fastq file (gzipped allowed)"
,
shortName
=
"R2"
,
required
=
false
)
var
input_R2
:
File
=
_
@Argument
(
doc
=
"Skip Trim fastq files"
,
shortName
=
"skiptrim"
,
required
=
false
)
var
skipTrim
:
Boolean
=
false
@Argument
(
doc
=
"Skip Clip fastq files"
,
shortName
=
"skipclip"
,
required
=
false
)
var
skipClip
:
Boolean
=
false
var
paired
:
Boolean
=
(
input_R2
!=
null
)
var
R1_ext
:
String
=
_
...
...
@@ -30,7 +35,6 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
def
init
()
{
for
(
file
<-
configfiles
)
globalConfig
.
loadConfigFile
(
file
)
//config = Config.mergeConfigs(globalConfig.getAsConfig("flexiprep"), globalConfig)
if
(!
skipTrim
)
skipTrim
=
config
(
"skiptrim"
,
false
)
if
(!
skipClip
)
skipClip
=
config
(
"skipclip"
,
false
)
if
(
input_R1
==
null
)
throw
new
IllegalStateException
(
"Missing R1 on flexiprep module"
)
...
...
@@ -53,8 +57,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
}
def
script
()
{
init
()
def
biopetScript
()
{
runInitialFastqc
()
outputFiles
+=
(
"fastq_input_R1"
->
zcatIfNeeded
(
input_R1
,
outputDir
))
...
...
@@ -87,7 +90,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
def
getQualtype
(
fastqc
:
Fastqc
,
pairname
:
String
)
:
File
=
{
val
fastqcToQualtype
=
new
FastqcToQualtype
(
globalConfig
,
configFullPa
th
)
val
fastqcToQualtype
=
new
FastqcToQualtype
(
th
is
)
fastqcToQualtype
.
fastqc_output
=
fastqc
.
output
fastqcToQualtype
.
out
=
new
File
(
outputDir
+
pairname
+
".qualtype.txt"
)
add
(
fastqcToQualtype
)
...
...
@@ -95,7 +98,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
def
getContams
(
fastqc
:
Fastqc
,
pairname
:
String
)
:
File
=
{
val
fastqcToContams
=
new
FastqcToContams
(
globalConfig
,
configFullPa
th
)
val
fastqcToContams
=
new
FastqcToContams
(
th
is
)
fastqcToContams
.
fastqc_output
=
fastqc
.
output
fastqcToContams
.
out
=
new
File
(
outputDir
+
pairname
+
".contams.txt"
)
fastqcToContams
.
contams_file
=
fastqc
.
contaminants
...
...
@@ -119,7 +122,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
var
R2
:
File
=
new
File
(
R2_in
)
if
(!
skipClip
)
{
// Adapter clipping
val
cutadapt_R1
=
new
Cutadapt
(
globalConfig
,
configFullPa
th
)
val
cutadapt_R1
=
new
Cutadapt
(
th
is
)
if
(!
skipTrim
||
paired
)
cutadapt_R1
.
isIntermediate
=
true
cutadapt_R1
.
fastq_input
=
R1
cutadapt_R1
.
fastq_output
=
swapExt
(
outDir
,
R1
,
R1_ext
,
".clip"
+
R1_ext
)
...
...
@@ -127,14 +130,14 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
add
(
cutadapt_R1
)
R1
=
cutadapt_R1
.
fastq_output
if
(
paired
)
{
val
cutadapt_R2
=
new
Cutadapt
(
globalConfig
,
configFullPa
th
)
val
cutadapt_R2
=
new
Cutadapt
(
th
is
)
if
(!
skipTrim
||
paired
)
cutadapt_R2
.
isIntermediate
=
true
cutadapt_R2
.
fastq_input
=
R2
cutadapt_R2
.
fastq_output
=
swapExt
(
outDir
,
R2
,
R2_ext
,
".clip"
+
R2_ext
)
if
(
outputFiles
.
contains
(
"contams_R2"
))
cutadapt_R2
.
contams_file
=
outputFiles
(
"contams_R2"
)
add
(
cutadapt_R2
)
R2
=
cutadapt_R2
.
fastq_output
val
fastqSync
=
new
FastqSync
(
globalConfig
,
configFullPa
th
)
val
fastqSync
=
new
FastqSync
(
th
is
)
if
(!
skipTrim
)
fastqSync
.
isIntermediate
=
true
fastqSync
.
input_start_fastq
=
cutadapt_R1
.
fastq_input
fastqSync
.
input_R1
=
cutadapt_R1
.
fastq_output
...
...
@@ -150,7 +153,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
if
(!
skipTrim
)
{
// Quality trimming
val
sickle
=
new
Sickle
(
globalConfig
,
configFullPa
th
)
val
sickle
=
new
Sickle
(
th
is
)
sickle
.
input_R1
=
R1
sickle
.
output_R1
=
swapExt
(
outDir
,
R1
,
R1_ext
,
".trim"
+
R1_ext
)
if
(
outputFiles
.
contains
(
"qualtype_R1"
))
sickle
.
qualityTypeFile
=
outputFiles
(
"qualtype_R1"
)
...
...
@@ -183,13 +186,13 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
if
(!
config
(
"skip_native_link"
,
false
))
{
val
lnR1
=
new
Ln
(
globalConfig
,
configFullPa
th
)
val
lnR1
=
new
Ln
(
th
is
)
lnR1
.
in
=
R1
R1
=
new
File
(
outputDir
+
R1_name
+
".qc"
+
R1_ext
)
lnR1
.
out
=
R1
add
(
lnR1
)
if
(
paired
)
{
val
lnR2
=
new
Ln
(
globalConfig
,
configFullPa
th
)
val
lnR2
=
new
Ln
(
th
is
)
lnR2
.
in
=
R2
R2
=
new
File
(
outputDir
+
R2_name
+
".qc"
+
R2_ext
)
lnR2
.
out
=
R2
...
...
@@ -208,7 +211,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
if
(
paired
)
outputFiles
+=
(
"fastqc_R2_final"
->
runFastqc
(
outputFiles
(
"output_R2"
),
outputDir
+
"/"
+
R2_name
+
".qc.fastqc/"
).
output
)
}
val
summarize
=
new
Summarize
(
globalConfig
,
configFullPa
th
)
val
summarize
=
new
Summarize
(
th
is
)
summarize
.
runDir
=
outputDir
summarize
.
samplea
=
R1_name
if
(
paired
)
summarize
.
sampleb
=
R2_name
...
...
@@ -221,7 +224,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
}
def
runFastqc
(
fastqfile
:
File
,
outDir
:
String
)
:
Fastqc
=
{
val
fastqcCommand
=
new
Fastqc
(
globalConfig
,
configFullPa
th
)
val
fastqcCommand
=
new
Fastqc
(
th
is
)
fastqcCommand
.
fastqfile
=
fastqfile
var
filename
:
String
=
fastqfile
.
getName
()
if
(
filename
.
endsWith
(
".gz"
))
filename
=
filename
.
substring
(
0
,
filename
.
size
-
3
)
...
...
@@ -238,7 +241,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
if
(
file
.
getName
().
endsWith
(
".gz"
)
||
file
.
getName
().
endsWith
(
".gzip"
))
{
var
newFile
:
File
=
swapExt
(
file
,
".gz"
,
""
)
if
(
file
.
getName
().
endsWith
(
".gzip"
))
newFile
=
swapExt
(
file
,
".gzip"
,
""
)
val
zcatCommand
=
new
Zcat
(
globalConfig
,
configFullPa
th
)
val
zcatCommand
=
new
Zcat
(
th
is
)
zcatCommand
.
input
=
file
zcatCommand
.
output
=
new
File
(
runDir
+
newFile
)
//zcatCommand.jobOutputFile = outputDir + "." + file.getName + ".out"
...
...
@@ -250,7 +253,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
def
addSeqstat
(
fastq
:
File
,
key
:
String
)
{
val
ext
=
fastq
.
getName
.
substring
(
fastq
.
getName
.
lastIndexOf
(
"."
))
val
seqstat
=
new
Seqstat
(
globalConfig
,
configFullPath
)
val
seqstat
=
new
Seqstat
(
this
)
seqstat
.
input_fastq
=
fastq
seqstat
.
out
=
swapExt
(
outputDir
,
fastq
,
ext
,
".seqstats.json"
)
add
(
seqstat
)
...
...
@@ -259,7 +262,7 @@ class Flexiprep(val globalConfig: Config, val configPath: List[String]) extends
def
addSha1sum
(
fastq
:
File
,
key
:
String
)
{
val
ext
=
fastq
.
getName
.
substring
(
fastq
.
getName
.
lastIndexOf
(
"."
))
val
sha1sum
=
new
Sha1sum
(
globalConfig
,
configFullPa
th
)
val
sha1sum
=
new
Sha1sum
(
th
is
)
sha1sum
.
input
=
fastq
sha1sum
.
output
=
swapExt
(
outputDir
,
fastq
,
ext
,
".sha1"
)
add
(
sha1sum
)
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/FastqSync.scala
View file @
ea4f80e1
...
...
@@ -7,7 +7,7 @@ import nl.lumc.sasc.biopet.function.PythonCommandLineFunction
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
FastqSync
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
PythonCommandLineFunction
{
class
FastqSync
(
val
root
:
Configurable
)
extends
PythonCommandLineFunction
{
setPythonScript
(
"__init__.py"
,
"pyfastqc/"
)
setPythonScript
(
"sync_paired_end_reads.py"
)
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/FastqcToContams.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import nl.lumc.sasc.biopet.function.PythonCommandLineFunction
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
FastqcToContams
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
PythonCommandLineFunction
{
class
FastqcToContams
(
val
root
:
Configurable
)
extends
PythonCommandLineFunction
{
setPythonScript
(
"__init__.py"
,
"pyfastqc/"
)
setPythonScript
(
"fastqc_contam.py"
)
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/FastqcToQualtype.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import nl.lumc.sasc.biopet.function.PythonCommandLineFunction
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
FastqcToQualtype
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
PythonCommandLineFunction
{
class
FastqcToQualtype
(
val
root
:
Configurable
)
extends
PythonCommandLineFunction
{
setPythonScript
(
"__init__.py"
,
"pyfastqc/"
)
setPythonScript
(
"qual_type_sickle.py"
)
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/Seqstat.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import nl.lumc.sasc.biopet.function.PythonCommandLineFunction
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
Seqstat
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
PythonCommandLineFunction
{
class
Seqstat
(
val
root
:
Configurable
)
extends
PythonCommandLineFunction
{
setPythonScript
(
"__init__.py"
,
"pyfastqc/"
)
setPythonScript
(
"seq_stat.py"
)
...
...
flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/Summarize.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import nl.lumc.sasc.biopet.function.PythonCommandLineFunction
import
org.broadinstitute.sting.commandline._
import
java.io.File
class
Summarize
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
PythonCommandLineFunction
{
class
Summarize
(
val
root
:
Configurable
)
extends
PythonCommandLineFunction
{
setPythonScript
(
"__init__.py"
,
"pyfastqc/"
)
setPythonScript
(
"summarize_flexiprep.py"
)
...
...
gatk/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/Gatk.scala
View file @
ea4f80e1
...
...
@@ -13,14 +13,13 @@ import org.broadinstitute.sting.queue.function._
import
scala.util.parsing.json._
import
org.broadinstitute.sting.utils.variant._
class
Gatk
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
QScript
with
Biopet
QScript
{
class
Gatk
(
val
root
:
Configurable
)
extends
QScript
with
MultiSample
QScript
{
qscript
=>
def
this
()
=
this
(
new
Config
(),
Nil
)
@Argument
(
doc
=
"Config Json file"
,
shortName
=
"config"
)
var
configfiles
:
List
[
File
]
=
Nil
@Argument
(
doc
=
"Only Sample"
,
shortName
=
"sample"
,
required
=
false
)
var
onlySample
:
String
=
""
@Argument
(
doc
=
"Output directory"
,
shortName
=
"outputDir"
,
required
=
true
)
var
outputDir
:
String
=
_
def
this
()
=
this
(
null
)
@Argument
(
doc
=
"Only Sample"
,
shortName
=
"sample"
,
required
=
false
)
val
onlySample
:
String
=
""
var
referenceFile
:
File
=
_
var
dbsnp
:
File
=
_
var
gvcfFiles
:
List
[
File
]
=
Nil
...
...
@@ -28,7 +27,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
init
()
{
for
(
file
<-
configfiles
)
globalConfig
.
loadConfigFile
(
file
)
//config = Config.mergeConfigs(globalConfig.getAsConfig("gatk"), globalConfig)
referenceFile
=
config
(
"referenceFile"
)
if
(
configContains
(
"dbsnp"
))
dbsnp
=
config
(
"dbsnp"
)
gvcfFiles
=
config
(
"gvcfFiles"
,
Nil
)
::
Nil
...
...
@@ -36,8 +34,7 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
else
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
}
def
script
()
{
init
()
def
biopetScript
()
{
if
(
onlySample
.
isEmpty
)
{
runSamplesJobs
...
...
@@ -54,7 +51,7 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
}
// Called for each sample
override
def
runSingleSampleJobs
(
sampleConfig
:
Map
[
String
,
Any
])
:
Map
[
String
,
List
[
File
]]
=
{
def
runSingleSampleJobs
(
sampleConfig
:
Map
[
String
,
Any
])
:
Map
[
String
,
List
[
File
]]
=
{
var
outputFiles
:
Map
[
String
,
List
[
File
]]
=
Map
()
var
runBamfiles
:
List
[
File
]
=
List
()
var
sampleID
:
String
=
sampleConfig
(
"ID"
).
toString
...
...
@@ -73,7 +70,7 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
}
// Called for each run from a sample
override
def
runSingleRunJobs
(
runConfig
:
Map
[
String
,
Any
],
sampleConfig
:
Map
[
String
,
Any
])
:
Map
[
String
,
File
]
=
{
def
runSingleRunJobs
(
runConfig
:
Map
[
String
,
Any
],
sampleConfig
:
Map
[
String
,
Any
])
:
Map
[
String
,
File
]
=
{
var
outputFiles
:
Map
[
String
,
File
]
=
Map
()
val
runID
:
String
=
runConfig
(
"ID"
).
toString
val
sampleID
:
String
=
sampleConfig
(
"ID"
).
toString
...
...
@@ -82,7 +79,7 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
if
(
runConfig
.
contains
(
"inputtype"
))
inputType
=
runConfig
(
"inputtype"
).
toString
else
inputType
=
config
(
"inputtype"
,
"dna"
).
toString
if
(
runConfig
.
contains
(
"R1"
))
{
val
mapping
=
new
Mapping
(
globalConfig
,
configFullPa
th
)
val
mapping
=
new
Mapping
(
th
is
)
mapping
.
loadRunConfig
(
runConfig
,
sampleConfig
,
runDir
)
mapping
.
script
addAll
(
mapping
.
functions
)
// Add functions of mapping to curent function pool
...
...
@@ -114,7 +111,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addIndelRealign
(
inputBam
:
File
,
dir
:
String
)
:
File
=
{
val
realignerTargetCreator
=
new
RealignerTargetCreator
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("realignertargetcreator"), qscript.config)
this
.
I
:+=
inputBam
this
.
o
=
swapExt
(
dir
,
inputBam
,
".bam"
,
".realign.intervals"
)
this
.
jobResourceRequests
:+=
"h_vmem=5G"
...
...
@@ -123,7 +119,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
add
(
realignerTargetCreator
)
val
indelRealigner
=
new
IndelRealigner
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("indelrealigner"), qscript.config)
this
.
I
:+=
inputBam
this
.
targetIntervals
=
realignerTargetCreator
.
o
this
.
o
=
swapExt
(
dir
,
inputBam
,
".bam"
,
".realign.bam"
)
...
...
@@ -136,7 +131,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addBaseRecalibrator
(
inputBam
:
File
,
dir
:
String
)
:
File
=
{
val
baseRecalibrator
=
new
BaseRecalibrator
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("baserecalibrator"), qscript.config)
this
.
I
:+=
inputBam
this
.
o
=
swapExt
(
dir
,
inputBam
,
".bam"
,
".baserecal"
)
if
(
dbsnp
!=
null
)
this
.
knownSites
:+=
dbsnp
...
...
@@ -146,7 +140,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
add
(
baseRecalibrator
)
val
printReads
=
new
PrintReads
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("printreads"), qscript.config)
this
.
I
:+=
inputBam
this
.
o
=
swapExt
(
dir
,
inputBam
,
".bam"
,
".baserecal.bam"
)
this
.
BQSR
=
baseRecalibrator
.
o
...
...
@@ -159,7 +152,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addSplitNCigarReads
(
inputBam
:
File
,
dir
:
String
)
:
File
=
{
val
splitNCigarReads
=
new
SplitNCigarReads
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("splitncigarreads"), qscript.config)
if
(
configContains
(
"scattercount"
,
"splitncigarreads"
))
this
.
scatterCount
=
config
(
"scattercount"
,
"splitncigarreads"
)
this
.
input_file
=
Seq
(
inputBam
)
this
.
out
=
swapExt
(
dir
,
inputBam
,
".bam"
,
".split.bam"
)
...
...
@@ -174,7 +166,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addHaplotypeCaller
(
bamfiles
:
List
[
File
],
outputfile
:
File
)
:
File
=
{
val
haplotypeCaller
=
new
HaplotypeCaller
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("haplotypecaller"), qscript.config)
if
(
configContains
(
"scattercount"
,
"haplotypecaller"
))
this
.
scatterCount
=
config
(
"scattercount"
,
"haplotypecaller"
)
this
.
input_file
=
bamfiles
this
.
out
=
outputfile
...
...
@@ -236,19 +227,15 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
getVariantRecalibrator
(
mode_arg
:
String
)
:
VariantRecalibrator
=
{
val
variantRecalibrator
=
new
VariantRecalibrator
()
with
gatkArguments
{
//var config = Config.mergeConfigs(qscript.config.getAsConfig("variantrecalibrator"), qscript.config)
if
(
mode_arg
==
"indel"
)
{
this
.
mode
=
org
.
broadinstitute
.
sting
.
gatk
.
walkers
.
variantrecalibration
.
VariantRecalibratorArgumentCollection
.
Mode
.
INDEL
//this.config = Config.mergeConfigs(this.config.getAsConfig("indel"),this.config)
if
(
configContains
(
"mills"
,
"variantrecalibrator"
))
this
.
resource
:+=
new
TaggedFile
(
config
(
"mills"
,
"variantrecalibrator"
).
getString
,
"known=false,training=true,truth=true,prior=12.0"
)
}
else
{
// SNP
this
.
mode
=
org
.
broadinstitute
.
sting
.
gatk
.
walkers
.
variantrecalibration
.
VariantRecalibratorArgumentCollection
.
Mode
.
SNP
//this.config = Config.mergeConfigs(this.config.getAsConfig("snp"),this.config)
if
(
configContains
(
"hapmap"
,
"variantrecalibrator"
))
this
.
resource
+:=
new
TaggedFile
(
config
(
"hapmap"
,
"variantrecalibrator"
).
getString
,
"known=false,training=true,truth=true,prior=15.0"
)
if
(
configContains
(
"omni"
,
"variantrecalibrator"
))
this
.
resource
+:=
new
TaggedFile
(
config
(
"omni"
,
"variantrecalibrator"
).
getString
,
"known=false,training=true,truth=true,prior=12.0"
)
if
(
configContains
(
"1000G"
,
"variantrecalibrator"
))
this
.
resource
+:=
new
TaggedFile
(
config
(
"1000G"
,
"variantrecalibrator"
).
getString
,
"known=false,training=true,truth=false,prior=10.0"
)
}
//logger.debug("VariantRecalibrator-" + mode_arg + ": " + this.config)
if
(
configContains
(
"dbsnp"
,
"variantrecalibrator"
))
this
.
resource
:+=
new
TaggedFile
(
config
(
"dbsnp"
,
"variantrecalibrator"
).
getString
,
"known=true,training=false,truth=false,prior=2.0"
)
this
.
nt
=
getThreads
(
4
,
"variantrecalibrator"
)
this
.
memoryLimit
=
nt
*
2
...
...
@@ -261,14 +248,11 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
getApplyRecalibration
(
mode_arg
:
String
)
:
ApplyRecalibration
=
{
val
applyRecalibration
=
new
ApplyRecalibration
()
with
gatkArguments
{
//var config = Config.mergeConfigs(qscript.config.getAsConfig("applyrecalibration"), qscript.config)
if
(
mode_arg
==
"indel"
)
{
this
.
mode
=
org
.
broadinstitute
.
sting
.
gatk
.
walkers
.
variantrecalibration
.
VariantRecalibratorArgumentCollection
.
Mode
.
INDEL
//this.config = Config.mergeConfigs(this.config.getAsConfig("indel"),this.config)
this
.
ts_filter_level
=
config
(
"ts_filter_level"
,
99.0
,
"applyrecalibration"
)
}
else
{
// SNP
this
.
mode
=
org
.
broadinstitute
.
sting
.
gatk
.
walkers
.
variantrecalibration
.
VariantRecalibratorArgumentCollection
.
Mode
.
SNP
//this.config = Config.mergeConfigs(this.config.getAsConfig("snp"),this.config)
this
.
ts_filter_level
=
config
(
"ts_filter_level"
,
99.5
,
"applyrecalibration"
)
}
this
.
nt
=
getThreads
(
3
,
"applyrecalibration"
)
...
...
@@ -280,7 +264,6 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addGenotypeGVCFs
(
gvcfFiles
:
List
[
File
],
dir
:
String
)
:
File
=
{
val
genotypeGVCFs
=
new
GenotypeGVCFs
()
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("genotypegvcfs"), qscript.config)
this
.
variant
=
gvcfFiles
this
.
annotation
++=
Seq
(
"FisherStrand"
,
"QualByDepth"
,
"ChromosomeCounts"
)
if
(
configContains
(
"scattercount"
,
"genotypegvcfs"
))
this
.
scatterCount
=
config
(
"scattercount"
,
"genotypegvcfs"
)
...
...
@@ -292,13 +275,10 @@ class Gatk(val globalConfig: Config, val configPath: List[String]) extends QScri
def
addVariantAnnotator
(
inputvcf
:
File
,
bamfiles
:
List
[
File
],
dir
:
String
)
:
File
=
{
val
variantAnnotator
=
new
VariantAnnotator
with
gatkArguments
{
//val config: Config = Config.mergeConfigs(qscript.config.getAsConfig("variantannotator"), qscript.config)
this
.
variant
=
inputvcf
this
.
input_file
=
bamfiles
this
.
dbsnp
=
config
(
"dbsnp"
,
"variantannotator"
)
this
.
out
=
swapExt
(
dir
,
inputvcf
,
".vcf"
,
".anotated.vcf"
)
//this.all = true
//this.excludeAnnotation +:= "SnpEff"
if
(
configContains
(
"scattercount"
,
"variantannotator"
))
this
.
scatterCount
=
config
(
"scattercount"
,
"variantannotator"
)
}
add
(
variantAnnotator
)
...
...
mapping/src/main/scala/nl/lumc/sasc/biopet/function/aligners/Bwa.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import org.broadinstitute.sting.commandline._
import
java.io.File
import
scala.sys.process._
class
Bwa
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Bwa
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Fastq file R1"
,
shortName
=
"R1"
)
var
R1
:
File
=
_
...
...
mapping/src/main/scala/nl/lumc/sasc/biopet/function/aligners/Star.scala
View file @
ea4f80e1
...
...
@@ -6,7 +6,7 @@ import org.broadinstitute.sting.commandline._
import
java.io.File
import
scala.sys.process._
class
Star
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
BiopetCommandLineFunction
{
class
Star
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"The reference file for the bam files."
,
required
=
false
)
var
referenceFile
:
File
=
new
File
(
config
(
"referenceFile"
))
...
...
@@ -59,6 +59,7 @@ class Star(val globalConfig: Config, val configPath: List[String]) extends Biope
outputGenome
=
new
File
(
prefix
+
"Genome"
)
outputSA
=
new
File
(
prefix
+
"SA"
)
outputSAindex
=
new
File
(
prefix
+
"SAindex"
)
sjdbOverhang
=
config
(
"sjdboverhang"
,
75
)
}
}
...
...
@@ -81,11 +82,30 @@ class Star(val globalConfig: Config, val configPath: List[String]) extends Biope
}
object
Star
{
def
apply
(
globalConfig
:
Config
,
configPath
:
List
[
String
]
,
R1
:
File
,
R2
:
File
,
outputDir
:
String
)
:
Star
=
{
val
star
=
new
Star
(
globalConfig
,
configPath
)
def
apply
(
configurable
:
Configurable
,
R1
:
File
,
R2
:
File
,
outputDir
:
String
)
:
Star
=
{
val
star
=
new
Star
(
configurable
)
star
.
R1
=
R1
if
(
R2
!=
null
)
star
.
R2
=
R2
star
.
outputDir
=
outputDir
star
.
afterGraph
return
star
}
def
_2pass
(
configurable
:
Configurable
,
R1
:
File
,
R2
:
File
,
outputDir
:
String
)
:
(
File
,
List
[
Star
])
=
{
val
outDir
=
if
(
outputDir
.
endsWith
(
"/"
))
outputDir
else
outputDir
+
"/"
val
starCommand_pass1
=
Star
(
configurable
,
R1
,
if
(
R2
!=
null
)
R2
else
null
,
outDir
+
"aln-pass1/"
)
starCommand_pass1
.
afterGraph
val
starCommand_reindex
=
new
Star
(
configurable
)
starCommand_reindex
.
sjdbFileChrStartEnd
=
starCommand_pass1
.
outputTab
starCommand_reindex
.
outputDir
=
outDir
+
"re-index/"
starCommand_reindex
.
runmode
=
"genomeGenerate"
starCommand_reindex
.
afterGraph
val
starCommand_pass2
=
Star
(
configurable
,
R1
,
if
(
R2
!=
null
)
R2
else
null
,
outDir
+
"aln-pass2/"
)
starCommand_pass2
.
genomeDir
=
starCommand_reindex
.
outputDir
starCommand_pass2
.
afterGraph
return
(
starCommand_pass2
.
outputSam
,
List
(
starCommand_pass1
,
starCommand_reindex
,
starCommand_pass2
))
}
}
\ No newline at end of file
mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
View file @
ea4f80e1
...
...
@@ -15,36 +15,65 @@ import org.broadinstitute.sting.queue.function._
import
scala.util.parsing.json._
import
org.broadinstitute.sting.utils.variant._
class
Mapping
(
val
globalConfig
:
Config
,
val
configPath
:
List
[
String
]
)
extends
QScript
with
BiopetQScript
{
class
Mapping
(
val
root
:
Configurable
)
extends
QScript
with
BiopetQScript
{
qscript
=>
@Argument
(
doc
=
"Config Json file"
,
shortName
=
"config"
,
required
=
false
)
var
configfiles
:
List
[
File
]
=
Nil
@Input
(
doc
=
"R1 fastq file"
,
shortName
=
"R1"
,
required
=
true
)
var
input_R1
:
File
=
_
@Input
(
doc
=
"R2 fastq file"
,
shortName
=
"R2"
,
required
=
false
)
var
input_R2
:
File
=
_
@Argument
(
doc
=
"Output directory"
,
shortName
=
"outputDir"
,
required
=
true
)
var
outputDir
:
String
=
_
@Argument
(
doc
=
"Output name"
,
shortName
=
"outputName"
,
required
=
false
)
var
outputName
:
String
=
_
@Argument
(
doc
=
"Skip flexiprep"
,
shortName
=
"skipflexiprep"
,
required
=
false
)
var
skipFlexiprep
:
Boolean
=
false
@Argument
(
doc
=
"Skip mark duplicates"
,
shortName
=
"skipmarkduplicates"
,
required
=
false
)
var
skipMarkduplicates
:
Boolean
=
false
@Argument
(
doc
=
"Alginer"
,
shortName
=
"ALN"
,
required
=
false
)
var
aligner
:
String
=
_
@Argument
(
doc
=
"Reference"
,
shortName
=
"R"
,
required
=
false
)
var
referenceFile
:
File
=
_
def
this
()
=
this
(
null
)
@Input
(
doc
=
"R1 fastq file"
,
shortName
=
"R1"
,
required
=
true
)
var
input_R1
:
File
=
_
@Input
(
doc
=
"R2 fastq file"
,
shortName
=
"R2"
,
required
=
false
)
var
input_R2
:
File
=
_
@Argument
(
doc
=
"Output name"
,
shortName
=
"outputName"
,
required
=
false
)
var
outputName
:
String
=
_
@Argument
(
doc
=
"Skip flexiprep"
,
shortName
=
"skipflexiprep"
,
required
=
false
)
var
skipFlexiprep
:
Boolean
=
false
@Argument
(
doc
=
"Skip mark duplicates"
,
shortName
=
"skipmarkduplicates"
,
required
=
false
)
var
skipMarkduplicates
:
Boolean
=
false
@Argument
(
doc
=
"Alginer"
,
shortName
=
"ALN"
,
required
=
false
)
var
aligner
:
String
=
_
@Argument
(
doc
=
"Reference"
,
shortName
=
"R"
,
required
=
false
)
var
referenceFile
:
File
=
_
// Readgroup items
@Argument
(
doc
=
"Readgroup ID"
,
shortName
=
"RGID"
,
required
=
false
)
var
RGID
:
String
=
_
@Argument
(
doc
=
"Readgroup Library"
,
shortName
=
"RGLB"
,
required
=
false
)
var
RGLB
:
String
=
_
@Argument
(
doc
=
"Readgroup Platform"
,
shortName
=
"RGPL"
,
required
=
false
)
var
RGPL
:
String
=
_
@Argument
(
doc
=
"Readgroup platform unit"
,
shortName
=
"RGPU"
,
required
=
false
)
var
RGPU
:
String
=
_
@Argument
(
doc
=
"Readgroup sample"
,
shortName
=
"RGSM"
,
required
=
false
)
var
RGSM
:
String
=
_
@Argument
(
doc
=
"Readgroup sequencing center"
,
shortName
=
"RGCN"
,
required
=
false
)
var
RGCN
:
String
=
_
@Argument
(
doc
=
"Readgroup description"
,
shortName
=
"RGDS"
,
required
=
false
)
var
RGDS
:
String
=
_
@Argument
(
doc
=
"Readgroup sequencing date"
,
shortName
=
"RGDT"
,
required
=
false
)
var
RGDT
:
Date
=
_
@Argument
(
doc
=
"Readgroup predicted insert size"
,
shortName
=
"RGPI"
,
required
=
false
)
var
RGPI
:
Int
=
_
def
this
()
=
this
(
new
Config
(),
Nil
)
@Argument
(
doc
=
"Readgroup ID"
,
shortName
=
"RGID"
,
required
=
false
)
var
RGID
:
String
=
_
@Argument
(
doc
=
"Readgroup Library"
,
shortName
=
"RGLB"
,
required
=
false
)
var
RGLB
:
String
=
_
@Argument
(
doc
=
"Readgroup Platform"
,
shortName
=
"RGPL"
,
required
=
false
)
var
RGPL
:
String
=
_
@Argument
(
doc
=
"Readgroup platform unit"
,
shortName
=
"RGPU"
,
required
=
false
)
var
RGPU
:
String
=
_