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
aac2adc8
Commit
aac2adc8
authored
Sep 26, 2014
by
Peter van 't Hof
Browse files
Removed samtools view
parent
25fd5d1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/apps/MpileupToVcf.scala
View file @
aac2adc8
...
...
@@ -4,12 +4,13 @@ import java.io.File
import
java.io.PrintWriter
import
nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.extensions.samtools.
{
SamtoolsMpileup
,
SamtoolsView
}
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.collection.mutable.ArrayBuffer
import
scala.io.Source
import
scala.math.round
import
scala.math.floor
import
scala.collection.JavaConversions._
class
MpileupToVcf
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
{
javaMainClass
=
getClass
.
getName
...
...
@@ -28,19 +29,24 @@ class MpileupToVcf(val root: Configurable) extends BiopetJavaCommandLineFunction
var
homoFraction
:
Option
[
Double
]
=
config
(
"homoFraction"
)
var
ploity
:
Option
[
Int
]
=
config
(
"ploity"
)
var
sample
:
String
=
_
var
reference
:
String
=
config
(
"reference"
)
override
val
defaultVmem
=
"
8
G"
memoryLimit
=
Option
(
4
.0
)
override
val
defaultVmem
=
"
6
G"
memoryLimit
=
Option
(
2
.0
)
if
(
config
.
contains
(
"target_bed"
))
defaults
++=
Map
(
"samtoolsmpileup"
->
Map
(
"interval_bed"
->
config
(
"target_bed"
).
getStringList
.
head
))
defaults
++=
Map
(
"samtoolsview"
->
Map
(
"b"
->
true
,
"h"
->
true
))
if
(
config
.
contains
(
"target_bed"
))
defaults
++=
Map
(
"samtoolsmpileup"
->
Map
(
"interval_bed"
->
config
(
"target_bed"
).
getStringList
.
head
,
"disable_baq"
->
true
,
"min_map_quality"
->
1
))
override
def
afterGraph
{
super
.
afterGraph
val
samtoolsMpileup
=
new
SamtoolsMpileup
(
this
)
}
override
def
commandLine
=
{
(
if
(
inputMpileup
==
null
)
{
val
samtoolsView
=
new
SamtoolsView
(
this
)
val
samtoolsMpileup
=
new
SamtoolsMpileup
(
this
)
samtools
View
.
input
=
inputBam
samtoolsView
.
cmdPipe
+
" | "
+
samtoolsMpileup
.
cmdPipe
Input
+
" | "
samtools
Mpileup
.
input
=
inputBam
samtoolsMpileup
.
cmdPipe
+
" | "
}
else
""
)
+
super
.
commandLine
+
required
(
"-o"
,
output
)
+
...
...
@@ -81,8 +87,8 @@ object MpileupToVcf {
}
if
(
input
!=
null
&&
!
input
.
exists
)
throw
new
IllegalStateException
(
"Input file does not exist"
)
if
(
output
==
null
)
throw
new
IllegalStateException
(
"Output file not found, use -o"
)
if
(
sample
==
null
)
throw
new
IllegalStateException
(
"
Output
not given, pls use -sample"
)
if
(
sample
==
null
)
throw
new
IllegalStateException
(
"
sample
not given, pls use -sample"
)
val
writer
=
new
PrintWriter
(
output
)
writer
.
println
(
"##fileformat=VCFv4.1"
)
writer
.
println
(
"##INFO=<ID=DP,Number=1,Type=Integer,Description=\"Total Depth\">"
)
...
...
@@ -179,7 +185,6 @@ object MpileupToVcf {
}
left
-=
ad
(
max
)
}
info
+=
(
"AF="
+
format
(
"FREQ"
))
writer
.
println
(
Array
(
chr
,
pos
,
"."
,
ref
.
toUpperCase
,
alt
.
mkString
(
","
),
"."
,
"."
,
info
.
mkString
(
";"
),
"GT:"
+
format
.
keys
.
mkString
(
":"
),
gt
.
sortWith
(
_
<
_
).
mkString
(
"/"
)
+
":"
+
format
.
values
.
mkString
(
":"
)
).
mkString
(
"\t"
))
...
...
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