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
18f4992e
Commit
18f4992e
authored
Oct 20, 2014
by
wyleung
Browse files
Bugfix in yamsvp (concerns multiple library merging), Adding Sambamba tool wrappers
parent
6eec9fed
Changes
5
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/sambamba/Sambamba.scala
0 → 100644
View file @
18f4992e
package
nl.lumc.sasc.biopet.extensions.sambamba
import
nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
abstract
class
Sambamba
extends
BiopetCommandLineFunction
{
override
val
defaultVmem
=
"4G"
override
val
defaultThreads
=
2
executable
=
config
(
"exe"
,
default
=
"sambamba"
,
submodule
=
"sambamba"
,
freeVar
=
false
)
override
def
versionCommand
=
executable
override
val
versionRegex
=
"""sambamba v(.*)"""
.
r
override
val
versionExitcode
=
List
(
0
,
1
)
}
\ No newline at end of file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/sambamba/SambambaFlagstat.scala
0 → 100644
View file @
18f4992e
package
nl.lumc.sasc.biopet.extensions.sambamba
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
java.io.File
class
SambambaFlagstat
(
val
root
:
Configurable
)
extends
Sambamba
{
override
val
defaultThreads
=
2
@Input
(
doc
=
"Bam File"
)
var
input
:
File
=
_
@Output
(
doc
=
"output File"
)
var
output
:
File
=
_
def
cmdLine
=
required
(
executable
)
+
required
(
"flagstat"
)
+
optional
(
"-t"
,
nCoresRequest
)
+
required
(
input
)
+
" > "
+
required
(
output
)
}
object
SambambaFlagstat
{
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
)
:
SambambaFlagstat
=
{
val
flagstat
=
new
SambambaFlagstat
(
root
)
flagstat
.
input
=
input
flagstat
.
output
=
output
return
flagstat
}
def
apply
(
root
:
Configurable
,
input
:
File
,
outputDir
:
String
)
:
SambambaFlagstat
=
{
val
dir
=
if
(
outputDir
.
endsWith
(
"/"
))
outputDir
else
outputDir
+
"/"
val
outputFile
=
new
File
(
dir
+
swapExtension
(
input
.
getName
))
return
apply
(
root
,
input
,
outputFile
)
}
def
apply
(
root
:
Configurable
,
input
:
File
)
:
SambambaFlagstat
=
{
return
apply
(
root
,
input
,
new
File
(
swapExtension
(
input
.
getAbsolutePath
)))
}
private
def
swapExtension
(
inputFile
:
String
)
=
inputFile
.
stripSuffix
(
".bam"
)
+
".flagstat"
}
\ No newline at end of file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/sambamba/SambambaIndex.scala
0 → 100644
View file @
18f4992e
package
nl.lumc.sasc.biopet.extensions.sambamba
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
java.io.File
class
SambambaIndex
(
val
root
:
Configurable
)
extends
Sambamba
{
override
val
defaultThreads
=
2
@Input
(
doc
=
"Bam File"
)
var
input
:
File
=
_
@Output
(
doc
=
"Output .bai file to"
)
var
output
:
File
=
_
def
cmdLine
=
required
(
executable
)
+
required
(
"index"
)
+
optional
(
"-t"
,
nCoresRequest
)
+
required
(
input
)
+
required
(
output
)
}
object
SambambaIndex
{
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
)
:
SambambaIndex
=
{
val
flagstat
=
new
SambambaIndex
(
root
)
flagstat
.
input
=
input
flagstat
.
output
=
output
return
flagstat
}
def
apply
(
root
:
Configurable
,
input
:
File
,
outputDir
:
String
)
:
SambambaIndex
=
{
val
dir
=
if
(
outputDir
.
endsWith
(
"/"
))
outputDir
else
outputDir
+
"/"
val
outputFile
=
new
File
(
dir
+
swapExtension
(
input
.
getName
))
return
apply
(
root
,
input
,
outputFile
)
}
def
apply
(
root
:
Configurable
,
input
:
File
)
:
SambambaIndex
=
{
return
apply
(
root
,
input
,
new
File
(
swapExtension
(
input
.
getAbsolutePath
)))
}
private
def
swapExtension
(
inputFile
:
String
)
=
inputFile
.
stripSuffix
(
".bam"
)
+
".bam.bai"
}
\ No newline at end of file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/sambamba/SambambaMerge.scala
0 → 100644
View file @
18f4992e
package
nl.lumc.sasc.biopet.extensions.sambamba
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
java.io.File
class
SambambaMerge
(
val
root
:
Configurable
)
extends
Sambamba
{
override
val
defaultThreads
=
4
@Input
(
doc
=
"Bam File[s]"
)
var
input
:
List
[
File
]
=
Nil
@Output
(
doc
=
"Output merged bam PATH"
)
var
output
:
File
=
_
// @doc: compression_level 6 is average, 0 = no compression, 9 = best
val
compression_level
:
Option
[
Int
]
=
config
(
"compression_level"
,
default
=
6
)
def
cmdLine
=
required
(
executable
)
+
required
(
"merge"
)
+
optional
(
"-t"
,
nCoresRequest
)
+
optional
(
"-l"
,
compression_level
)
+
required
(
output
)
+
repeat
(
""
,
input
)
}
object
SambambaMerge
{
def
apply
(
root
:
Configurable
,
input
:
List
[
File
],
output
:
File
)
:
SambambaMerge
=
{
val
flagstat
=
new
SambambaMerge
(
root
)
flagstat
.
input
=
input
flagstat
.
output
=
output
return
flagstat
}
def
apply
(
root
:
Configurable
,
input
:
List
[
File
],
outputDir
:
String
)
:
SambambaMerge
=
{
val
dir
=
if
(
outputDir
.
endsWith
(
"/"
))
outputDir
else
outputDir
+
"/"
val
outputFile
=
new
File
(
dir
+
swapExtension
(
input
.
head
.
getName
))
return
apply
(
root
,
input
,
outputFile
)
}
def
apply
(
root
:
Configurable
,
input
:
List
[
File
])
:
SambambaMerge
=
{
return
apply
(
root
,
input
,
new
File
(
swapExtension
(
input
.
head
.
getAbsolutePath
)))
}
private
def
swapExtension
(
inputFile
:
String
)
=
inputFile
.
stripSuffix
(
".bam"
)
+
".merge.bam"
}
//
//object MergeSamFiles {
// def apply(root: Configurable, input: List[File], outputDir: String, sortOrder: String = null): MergeSamFiles = {
// val mergeSamFiles = new MergeSamFiles(root)
// mergeSamFiles.input = input
// mergeSamFiles.output = new File(outputDir, input.head.getName.stripSuffix(".bam").stripSuffix(".sam") + ".merge.bam")
// if (sortOrder == null) mergeSamFiles.sortOrder = "coordinate"
// else mergeSamFiles.sortOrder = sortOrder
// return mergeSamFiles
// }
//}
\ No newline at end of file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/yamsvp/Yamsvp.scala
View file @
18f4992e
...
...
@@ -9,8 +9,10 @@ import nl.lumc.sasc.biopet.core.MultiSampleQScript
import
nl.lumc.sasc.biopet.core.PipelineCommand
import
nl.lumc.sasc.biopet.extensions.picard.MergeSamFiles
import
nl.lumc.sasc.biopet.extensions.svcallers.Breakdancer
import
nl.lumc.sasc.biopet.extensions.svcallers.Clever
import
nl.lumc.sasc.biopet.extensions.sambamba.
{
SambambaIndex
,
SambambaMerge
}
import
nl.lumc.sasc.biopet.extensions.svcallers.pindel.Pindel
import
nl.lumc.sasc.biopet.extensions.svcallers.
{
Breakdancer
,
Clever
}
import
nl.lumc.sasc.biopet.pipelines.mapping.Mapping
...
...
@@ -54,7 +56,7 @@ class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
}
override
def
onExecutionDone
(
jobs
:
Map
[
QFunction
,
JobRunInfo
],
success
:
Boolean
)
{
logger
.
info
(
"YAM SV Pipeline has run
........................................
......................."
)
logger
.
info
(
"YAM SV Pipeline has run ......................."
)
}
def
runSingleSampleJobs
(
sampleConfig
:
Map
[
String
,
Any
])
:
SampleOutput
=
{
...
...
@@ -64,22 +66,36 @@ class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
var
libraryFastqFiles
:
List
[
File
]
=
List
()
val
sampleID
:
String
=
sampleConfig
(
"ID"
).
toString
val
sampleDir
:
String
=
outputDir
+
sampleID
+
"/"
val
alignmentDir
:
String
=
sampleDir
+
"alignment/"
val
svcallingDir
:
String
=
sampleDir
+
"svcalls/"
sampleOutput
.
libraries
=
runLibraryJobs
(
sampleConfig
)
for
((
libraryID
,
libraryOutput
)
<-
sampleOutput
.
libraries
)
{
// this is extending the libraryBamfiles list like '~=' in D or .append in Python or .push_back in C++
libraryBamfiles
=
List
(
libraryOutput
.
mappedBamFile
)
libraryBamfiles
++
=
List
(
libraryOutput
.
mappedBamFile
)
}
val
bamFile
:
File
=
if
(
libraryBamfiles
.
size
==
1
)
libraryBamfiles
.
head
else
if
(
libraryBamfiles
.
size
>
1
)
{
val
mergeSamFiles
=
MergeSamFiles
(
this
,
libraryBamfiles
,
sampleDir
)
add
(
mergeSamFiles
)
mergeSamFiles
.
output
}
else
null
logger
.
debug
(
"We have the following bamfiles for merging"
)
logger
.
debug
(
libraryBamfiles
)
val
bamFile
:
File
=
if
(
libraryBamfiles
.
size
==
1
)
libraryBamfiles
.
head
else
if
(
libraryBamfiles
.
size
>
1
)
{
val
mergeSamFiles
=
new
SambambaMerge
(
root
)
mergeSamFiles
.
input
=
libraryBamfiles
mergeSamFiles
.
output
=
alignmentDir
+
sampleID
+
".merged.bam"
add
(
mergeSamFiles
)
val
bamIndex
=
SambambaIndex
(
root
,
mergeSamFiles
.
output
)
add
(
bamIndex
)
mergeSamFiles
.
output
}
else
null
logger
.
debug
(
bamFile
)
/// bamfile will be used as input for the SV callers. First run Clever
// val cleverVCF : File = sampleDir + "/" + sampleID + ".clever.vcf"
...
...
@@ -88,11 +104,18 @@ class Yamsvp(val root: Configurable) extends QScript with MultiSampleQScript {
sampleOutput
.
vcf
+=
(
"clever"
->
List
(
clever
.
outputvcf
))
add
(
clever
)
val
breakdancerDir
=
s
ample
Dir
+
sampleID
+
".breakdancer/"
val
breakdancerDir
=
s
vcalling
Dir
+
sampleID
+
".breakdancer/"
val
breakdancer
=
Breakdancer
(
this
,
bamFile
,
this
.
reference
,
breakdancerDir
)
sampleOutput
.
vcf
+=
(
"breakdancer"
->
List
(
breakdancer
.
outputraw
))
addAll
(
breakdancer
.
functions
)
//
//
// val pindelDir = svcallingDir + sampleID + ".pindel/"
// val pindel = Pindel(this, bamFile, this.reference, pindelDir)
// sampleOutput.vcf += ("pindel" -> List(pindel.outputvcf))
// addAll(pindel.functions)
//
//
return
sampleOutput
}
...
...
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