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
ff0d656a
Commit
ff0d656a
authored
May 04, 2016
by
bow
Browse files
Merge branch 'feature-grep' into 'develop'
Added grep as extension See merge request !388
parents
e0721bc5
799130b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Grep.scala
0 → 100644
View file @
ff0d656a
package
nl.lumc.sasc.biopet.extensions
import
java.io.File
import
nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
/**
* Created by pjvanthof on 30/03/16.
*/
class
Grep
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Input file"
,
required
=
true
)
var
input
:
File
=
_
@Output
(
doc
=
"Output file"
,
required
=
true
)
var
output
:
File
=
_
executable
=
config
(
"exe"
,
default
=
"grep"
)
var
grepFor
:
String
=
null
var
invertMatch
:
Boolean
=
false
var
regex
:
Boolean
=
false
var
perlRegexp
:
Boolean
=
false
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
conditional
(
invertMatch
,
"-v"
)
+
conditional
(
regex
,
"-e"
)
+
conditional
(
perlRegexp
,
"-P"
)
+
required
(
grepFor
)
+
(
if
(
inputAsStdin
)
""
else
required
(
input
))
+
(
if
(
outputAsStsout
)
""
else
" > "
+
required
(
output
))
}
object
Grep
{
def
apply
(
root
:
Configurable
,
grepFor
:
String
,
regex
:
Boolean
=
false
,
invertMatch
:
Boolean
=
false
,
perlRegexp
:
Boolean
=
false
)
:
Grep
=
{
val
grep
=
new
Grep
(
root
)
grep
.
grepFor
=
grepFor
grep
.
regex
=
regex
grep
.
perlRegexp
=
perlRegexp
grep
.
invertMatch
=
invertMatch
grep
}
}
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