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
9bfb4880
Commit
9bfb4880
authored
Feb 27, 2015
by
Peter van 't Hof
Browse files
Added summary to VcfStats
parent
5c545796
Changes
3
Show whitespace changes
Inline
Side-by-side
protected/biopet-gatk-pipelines/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/ShivaVariantcallingGatk.scala
View file @
9bfb4880
...
@@ -27,7 +27,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
...
@@ -27,7 +27,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
protected
val
defaultPrio
=
1
protected
val
defaultPrio
=
1
protected
val
defaultUse
=
true
protected
val
defaultUse
=
true
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"haplotypecaller.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
haplotypecaller.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
hc
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
HaplotypeCaller
(
qscript
)
val
hc
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
HaplotypeCaller
(
qscript
)
...
@@ -42,7 +42,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
...
@@ -42,7 +42,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
protected
val
defaultPrio
=
20
protected
val
defaultPrio
=
20
protected
val
defaultUse
=
false
protected
val
defaultUse
=
false
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"unifiedgenotyper.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
unifiedgenotyper.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
ug
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
UnifiedGenotyper
(
qscript
)
val
ug
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
UnifiedGenotyper
(
qscript
)
...
@@ -57,7 +57,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
...
@@ -57,7 +57,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
protected
val
defaultPrio
=
5
protected
val
defaultPrio
=
5
protected
val
defaultUse
=
false
protected
val
defaultUse
=
false
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"haplotypecaller_allele.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
haplotypecaller_allele.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
hc
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
HaplotypeCaller
(
qscript
)
val
hc
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
HaplotypeCaller
(
qscript
)
...
@@ -74,7 +74,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
...
@@ -74,7 +74,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
protected
val
defaultPrio
=
9
protected
val
defaultPrio
=
9
protected
val
defaultUse
=
false
protected
val
defaultUse
=
false
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"unifiedgenotyper_allele.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
unifiedgenotyper_allele.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
ug
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
UnifiedGenotyper
(
qscript
)
val
ug
=
new
nl
.
lumc
.
sasc
.
biopet
.
extensions
.
gatk
.
broad
.
UnifiedGenotyper
(
qscript
)
...
@@ -91,7 +91,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
...
@@ -91,7 +91,7 @@ class ShivaVariantcallingGatk(val root: Configurable) extends QScript with Shiva
protected
val
defaultPrio
=
5
protected
val
defaultPrio
=
5
protected
val
defaultUse
=
false
protected
val
defaultUse
=
false
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"haplotypecaller_gvcf.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
haplotypecaller_gvcf.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
gvcfFiles
=
for
(
inputBam
<-
inputBams
)
yield
{
val
gvcfFiles
=
for
(
inputBam
<-
inputBams
)
yield
{
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
View file @
9bfb4880
...
@@ -4,23 +4,31 @@ import java.io.{ FileOutputStream, PrintWriter, File }
...
@@ -4,23 +4,31 @@ import java.io.{ FileOutputStream, PrintWriter, File }
import
htsjdk.variant.variantcontext.
{
VariantContext
,
Genotype
}
import
htsjdk.variant.variantcontext.
{
VariantContext
,
Genotype
}
import
htsjdk.variant.vcf.VCFFileReader
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.core.summary.Summarizable
import
nl.lumc.sasc.biopet.core.
{
BiopetJavaCommandLineFunction
,
ToolCommand
}
import
nl.lumc.sasc.biopet.core.
{
BiopetJavaCommandLineFunction
,
ToolCommand
}
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Output
,
Input
}
import
org.broadinstitute.gatk.utils.commandline.
{
Output
,
Input
}
import
scala.collection.JavaConversions._
import
scala.collection.JavaConversions._
import
scala.collection.mutable
import
scala.collection.mutable
import
scala.io.Source
import
scala.sys.process.
{
Process
,
ProcessLogger
}
import
scala.sys.process.
{
Process
,
ProcessLogger
}
import
htsjdk.samtools.util.Interval
import
htsjdk.samtools.util.Interval
/**
/**
* Created by pjvan_thof on 1/10/15.
* Created by pjvan_thof on 1/10/15.
*/
*/
class
VcfStats
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
{
class
VcfStats
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
with
Summarizable
{
javaMainClass
=
getClass
.
getName
javaMainClass
=
getClass
.
getName
@Input
(
doc
=
"Input fastq"
,
shortName
=
"I"
,
required
=
true
)
@Input
(
doc
=
"Input fastq"
,
shortName
=
"I"
,
required
=
true
)
var
input
:
File
=
_
var
input
:
File
=
_
@Output
protected
var
generalStats
:
File
=
null
@Output
protected
var
genotypeStats
:
File
=
null
override
val
defaultVmem
=
"4G"
override
val
defaultVmem
=
"4G"
override
val
defaultThreads
=
3
override
val
defaultThreads
=
3
...
@@ -32,7 +40,9 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction {
...
@@ -32,7 +40,9 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction {
*/
*/
def
setOutputDir
(
dir
:
File
)
:
Unit
=
{
def
setOutputDir
(
dir
:
File
)
:
Unit
=
{
outputDir
=
dir
outputDir
=
dir
this
.
jobOutputFile
=
new
File
(
dir
,
".vcfstats.out"
)
generalStats
=
new
File
(
dir
,
"general.tsv"
)
genotypeStats
=
new
File
(
dir
,
"genotype_general.tsv"
)
jobOutputFile
=
new
File
(
dir
,
".vcfstats.out"
)
}
}
/**
/**
...
@@ -42,6 +52,27 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction {
...
@@ -42,6 +52,27 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction {
override
def
commandLine
=
super
.
commandLine
+
override
def
commandLine
=
super
.
commandLine
+
required
(
"-I"
,
input
)
+
required
(
"-I"
,
input
)
+
required
(
"-o"
,
outputDir
)
required
(
"-o"
,
outputDir
)
/**
* Returns general stats to the summary
* @return
*/
def
summaryStats
:
Map
[
String
,
Any
]
=
{
(
for
(
line
<-
Source
.
fromFile
(
generalStats
).
getLines
();
values
=
line
.
split
(
"\t"
)
if
values
.
size
>=
2
&&
!
values
(
0
).
isEmpty
)
yield
values
(
0
)
->
values
(
1
).
toInt
).
toMap
}
/**
* return only general files to summary
* @return
*/
def
summaryFiles
:
Map
[
String
,
File
]
=
Map
(
"general_stats"
->
generalStats
,
"genotype_stats"
->
genotypeStats
)
}
}
object
VcfStats
extends
ToolCommand
{
object
VcfStats
extends
ToolCommand
{
...
...
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaVariantcallingTrait.scala
View file @
9bfb4880
...
@@ -22,16 +22,16 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
...
@@ -22,16 +22,16 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
def
namePrefix
:
String
=
{
def
namePrefix
:
String
=
{
(
sampleId
,
libId
)
match
{
(
sampleId
,
libId
)
match
{
case
(
Some
(
sampleId
),
Some
(
libId
))
=>
sampleId
+
"-"
+
libId
+
"."
case
(
Some
(
sampleId
),
Some
(
libId
))
=>
sampleId
+
"-"
+
libId
case
(
Some
(
sampleId
),
_
)
=>
sampleId
+
"."
case
(
Some
(
sampleId
),
_
)
=>
sampleId
case
_
=>
""
case
_
=>
config
(
"name_prefix"
)
}
}
}
}
def
init
:
Unit
=
{
def
init
:
Unit
=
{
}
}
def
finalFile
=
new
File
(
outputDir
,
namePrefix
+
"final.vcf.gz"
)
def
finalFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
final.vcf.gz"
)
def
biopetScript
:
Unit
=
{
def
biopetScript
:
Unit
=
{
val
callers
=
usedCallers
.
sortBy
(
_
.
prio
)
val
callers
=
usedCallers
.
sortBy
(
_
.
prio
)
...
@@ -44,6 +44,12 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
...
@@ -44,6 +44,12 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
for
(
caller
<-
callers
)
{
for
(
caller
<-
callers
)
{
caller
.
addJobs
()
caller
.
addJobs
()
cv
.
addInput
(
caller
.
outputFile
,
caller
.
name
)
cv
.
addInput
(
caller
.
outputFile
,
caller
.
name
)
val
vcfStats
=
new
VcfStats
(
qscript
)
vcfStats
.
input
=
caller
.
outputFile
vcfStats
.
setOutputDir
(
new
File
(
caller
.
outputDir
,
"vcfstats"
))
add
(
vcfStats
)
addSummarizable
(
vcfStats
,
namePrefix
+
"-vcfstats-"
+
caller
.
name
)
}
}
add
(
cv
)
add
(
cv
)
...
@@ -51,6 +57,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
...
@@ -51,6 +57,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
vcfStats
.
input
=
finalFile
vcfStats
.
input
=
finalFile
vcfStats
.
setOutputDir
(
new
File
(
outputDir
,
"vcfstats"
))
vcfStats
.
setOutputDir
(
new
File
(
outputDir
,
"vcfstats"
))
add
(
vcfStats
)
add
(
vcfStats
)
addSummarizable
(
vcfStats
,
namePrefix
+
"-vcfstats-final"
)
addSummaryJobs
addSummaryJobs
}
}
...
@@ -75,7 +82,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
...
@@ -75,7 +82,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
protected
val
defaultPrio
=
999
protected
val
defaultPrio
=
999
protected
val
defaultUse
=
true
protected
val
defaultUse
=
true
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"raw.vcf.gz"
)
def
outputFile
=
new
File
(
outputDir
,
namePrefix
+
"
.
raw.vcf.gz"
)
def
addJobs
()
{
def
addJobs
()
{
val
rawFiles
=
inputBams
.
map
(
bamFile
=>
{
val
rawFiles
=
inputBams
.
map
(
bamFile
=>
{
...
...
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