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
84a7f167
Commit
84a7f167
authored
Oct 07, 2014
by
bow
Browse files
Update main interface
parent
59bb05d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala
View file @
84a7f167
...
...
@@ -16,33 +16,30 @@ import nl.lumc.sasc.biopet.pipelines.sage.Sage
object
BiopetExecutable
{
val
pipelines
:
Map
[
String
,
PipelineCommand
]
=
Map
(
"flexiprep"
->
Flexiprep
,
"mapping"
->
Mapping
,
"gentrap"
->
Gentrap
,
"bam-metrics"
->
BamMetrics
,
"gatk-benchmark-genotyping"
->
GatkBenchmarkGenotyping
,
"gatk-genotyping"
->
GatkGenotyping
,
"gatk-variantcalling"
->
GatkVariantcalling
,
"gatk-pipeline"
->
GatkPipeline
,
"gatk-variant-recalibration"
->
GatkVariantRecalibration
,
"gatk-vcf-sample-compare"
->
GatkVcfSampleCompare
,
"sage"
->
Sage
,
"basty"
->
Basty
)
val
tools
:
Map
[
String
,
ToolCommand
]
=
Map
(
"WipeReads"
->
WipeReads
)
val
pipelines
:
List
[
MainCommand
]
=
List
(
Flexiprep
,
Mapping
,
Gentrap
,
BamMetrics
,
GatkBenchmarkGenotyping
,
GatkGenotyping
,
GatkVariantcalling
,
GatkPipeline
,
GatkVariantRecalibration
,
GatkVcfSampleCompare
,
Sage
,
Basty
)
val
tools
:
List
[
MainCommand
]
=
List
(
WipeReads
)
/**
* @param args the command line arguments
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
def
toBulletedList
(
m
:
Map
[
String
,
Any
],
kind
:
String
=
""
,
bullet
:
String
=
"-"
)
=
"Available %s:\n "
.
format
(
kind
)
+
bullet
+
" "
+
m
.
keys
.
toVector
.
sorted
.
mkString
(
"\n "
+
bullet
+
" "
)
def
toBulletedList
(
m
:
List
[
MainCommand
],
kind
:
String
=
""
,
bullet
:
String
=
"-"
)
=
"Available %s:\n "
.
format
(
kind
)
+
bullet
+
" "
+
m
.
map
(
x
=>
x
.
name
).
sorted
.
mkString
(
"\n "
+
bullet
+
" "
)
lazy
val
pipelineList
:
String
=
toBulletedList
(
pipelines
,
"pipelines"
)
...
...
@@ -78,34 +75,37 @@ object BiopetExecutable {
System
.
exit
(
1
)
}
def
retrieveCommand
(
q
:
String
,
cl
:
List
[
MainCommand
])
:
Option
[
MainCommand
]
=
{
for
(
mc
<-
cl
)
{
if
(
q
==
mc
.
name
.
toLowerCase
)
return
Some
(
mc
)
}
None
}
args
match
{
case
Array
(
"pipeline"
,
pipelineName
,
pipelineArgs
@
_
*)
=>
if
(
pipelines
.
contains
(
pipelineName
))
if
(
pipelineArgs
.
isEmpty
)
{
pipelines
(
pipelineName
).
main
(
Array
(
"--help"
))
System
.
exit
(
1
)
}
else
{
pipelines
(
pipelineName
).
main
(
pipelineArgs
.
toArray
)
retrieveCommand
(
pipelineName
.
toLowerCase
,
pipelines
)
match
{
case
Some
(
pipeline
)
=>
pipeline
.
main
(
pipelineArgs
.
toArray
)
System
.
exit
(
0
)
}
else
{
System
.
err
.
println
(
s
"ERROR: pipeline '$pipelineName' does not exist"
)
System
.
err
.
println
(
pipelineUsage
)
System
.
exit
(
1
)
case
None
=>
System
.
err
.
println
(
s
"ERROR: pipeline '$pipelineName' does not exist"
)
System
.
err
.
println
(
pipelineUsage
)
System
.
exit
(
1
)
}
case
Array
(
"pipeline"
)
=>
System
.
err
.
println
(
pipelineUsage
)
System
.
exit
(
1
)
case
Array
(
"tool"
,
toolName
,
toolArgs
@
_
*)
=>
if
(
tools
.
contains
(
toolName
))
{
tools
(
toolName
).
main
(
toolArgs
.
toArray
)
System
.
exit
(
0
)
}
else
{
System
.
err
.
println
(
s
"ERROR: tool '$toolName' does not exist"
)
System
.
err
.
println
(
toolUsage
)
System
.
exit
(
1
)
retrieveCommand
(
toolName
.
toLowerCase
,
tools
)
match
{
case
Some
(
tool
)
=>
tool
.
main
(
toolArgs
.
toArray
)
System
.
exit
(
0
)
case
None
=>
System
.
err
.
println
(
s
"ERROR: tool '$toolName' does not exist"
)
System
.
err
.
println
(
toolUsage
)
System
.
exit
(
1
)
}
case
Array
(
"tool"
)
=>
System
.
err
.
println
(
toolUsage
)
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/
Tool
Command.scala
→
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/
Main
Command.scala
View file @
84a7f167
...
...
@@ -3,9 +3,9 @@ package nl.lumc.sasc.biopet.core
import
org.broadinstitute.gatk.queue.util.Logging
trait
Tool
Command
extends
Logging
{
trait
Main
Command
extends
Logging
{
lazy
val
toolN
ame
=
this
.
getClass
.
getSimpleName
lazy
val
n
ame
=
this
.
getClass
.
getSimpleName
.
split
(
"\\$"
).
last
def
main
(
args
:
Array
[
String
])
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/PipelineCommand.scala
View file @
84a7f167
package
nl.lumc.sasc.biopet.core
import
org.broadinstitute.gatk.queue.util.Logging
trait
PipelineCommand
extends
Logging
{
trait
PipelineCommand
extends
MainCommand
{
val
pipeline
=
""
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
...
...
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/apps/WipeReads.scala
View file @
84a7f167
...
...
@@ -19,7 +19,7 @@ import org.apache.commons.io.FilenameUtils.getExtension
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
import
nl.lumc.sasc.biopet.core.
Tool
Command
import
nl.lumc.sasc.biopet.core.
Main
Command
import
nl.lumc.sasc.biopet.core.config.Configurable
// TODO: finish implementation for usage in pipelines
...
...
@@ -40,7 +40,7 @@ class WipeReads(val root: Configurable) extends BiopetJavaCommandLineFunction {
}
object
WipeReads
extends
Tool
Command
{
object
WipeReads
extends
Main
Command
{
/** Container type for command line flags */
type
OptionMap
=
Map
[
String
,
Any
]
...
...
@@ -458,9 +458,9 @@ object WipeReads extends ToolCommand {
val
usage
:
String
=
s
"""
|Usage: java -jar BiopetFramework.jar tool $
toolN
ame [options] -I input -l regions -o output
|Usage: java -jar BiopetFramework.jar tool $
n
ame [options] -I input -l regions -o output
|
|$
toolN
ame - Tool for reads removal from an indexed BAM file
|$
n
ame - Tool for reads removal from an indexed BAM file
|
|Positional arguments:
| -I,--inputBAM Input BAM file, must be indexed with
...
...
@@ -482,5 +482,5 @@ object WipeReads extends ToolCommand {
|This tool will remove BAM records that overlaps a set of given regions.
|By default, if the removed reads are also mapped to other regions outside
|the given ones, they will also be removed.
"""
.
stripMargin
.
format
(
toolName
,
toolName
)
"""
.
stripMargin
}
\ No newline at end of file
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