Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
00aa8bb5
Commit
00aa8bb5
authored
10 years ago
by
bow
Committed by
Peter van 't Hof
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update Tabix wrapper
(cherry picked from commit
6ca9d8be
)
parent
8506c344
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Tabix.scala
+76
-12
76 additions, 12 deletions
...src/main/scala/nl/lumc/sasc/biopet/extensions/Tabix.scala
with
76 additions
and
12 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Tabix.scala
+
76
−
12
View file @
00aa8bb5
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package
nl.lumc.sasc.biopet.extensions
import
java.io.File
import
nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Out
put
,
In
put
}
import
org.broadinstitute.gatk.utils.commandline.
{
Argument
,
In
put
,
Out
put
}
/**
* Created by pjvan_thof on 3/4/15.
* Wrapper for the tabix command
*
* Note that tabix can either index a file (no stdout stream) or retrieve regions from an indexed file (stdout stream)
*
*/
class
Tabix
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Input file
s
"
,
required
=
true
)
@Input
(
doc
=
"Input
bgzipped
file"
,
required
=
true
)
var
input
:
File
=
null
@Output
(
doc
=
"Compressed output file"
,
required
=
true
)
protected
var
output
:
File
=
null
@Output
(
doc
=
"Output (for region query)"
,
required
=
false
)
var
outputQuery
:
File
=
null
@Output
(
doc
=
"Output (for indexing)"
,
required
=
false
)
// NOTE: it's a def since we can't change the index name ~ it's always input_name + .tbi
lazy
val
outputIndex
:
File
=
{
require
(
input
!=
null
,
"Input must be defined"
)
new
File
(
input
.
toString
+
".tbi"
)
}
@Argument
(
doc
=
"Regions to query"
,
required
=
false
)
var
regions
:
List
[
String
]
=
config
(
"regions"
,
default
=
List
.
empty
[
String
])
var
p
:
Option
[
String
]
=
config
(
"p"
)
var
s
:
Option
[
Int
]
=
config
(
"s"
)
var
b
:
Option
[
Int
]
=
config
(
"b"
)
var
e
:
Option
[
Int
]
=
config
(
"e"
)
var
S
:
Option
[
Int
]
=
config
(
"S"
)
var
c
:
Option
[
String
]
=
config
(
"c"
)
var
r
:
Option
[
File
]
=
config
(
"r"
)
var
B
:
Boolean
=
config
(
"B"
,
default
=
false
)
var
zero
:
Boolean
=
config
(
"0"
,
default
=
false
)
var
h
:
Boolean
=
config
(
"h"
,
default
=
false
)
var
l
:
Boolean
=
config
(
"l"
,
default
=
false
)
var
f
:
Boolean
=
config
(
"f"
,
default
=
false
)
executable
=
config
(
"exe"
,
default
=
"tabix"
)
override
val
versionExitcode
=
List
(
0
,
1
)
override
val
versionRegex
=
"""Version: (.*)"""
.
r
override
def
versionCommand
=
executable
override
val
versionRegex
=
"""Version: (.*)"""
.
r
override
val
versionExitcode
=
List
(
0
,
1
)
/** Formats that tabix can handle */
private
val
validFormats
:
Set
[
String
]
=
Set
(
"gff"
,
"bed"
,
"sam"
,
"vcf"
,
"psltbl"
)
override
def
beforeGraph
:
Unit
=
{
output
=
new
File
(
input
.
getAbsolutePath
+
".tbi"
)
p
match
{
case
Some
(
fmt
)
=>
require
(
validFormats
.
contains
(
fmt
),
"-p flag must be one of "
+
validFormats
.
mkString
(
", "
))
case
None
=>
;
}
}
def
cmdLine
=
required
(
executable
)
+
optional
(
"-p"
,
p
)
+
required
(
input
)
}
\ No newline at end of file
def
cmdLine
=
{
val
baseCommand
=
required
(
executable
)
+
optional
(
"-p"
,
p
)
+
optional
(
"-s"
,
s
)
+
optional
(
"-b"
,
b
)
+
optional
(
"-e"
,
e
)
+
optional
(
"-S"
,
S
)
+
optional
(
"-c"
,
c
)
+
optional
(
"-r"
,
r
)
+
conditional
(
B
,
"-B"
)
+
conditional
(
zero
,
"-0"
)
+
conditional
(
h
,
"-h"
)
+
conditional
(
l
,
"-l"
)
+
conditional
(
f
,
"-f"
)
+
required
(
input
)
// query mode ~ we want to output to a file
if
(
regions
.
nonEmpty
)
baseCommand
+
required
(
""
,
repeat
(
regions
),
escape
=
false
)
+
" > "
+
required
(
outputQuery
)
// indexing mode
else
baseCommand
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment