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
b0317762
Commit
b0317762
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added default_clip_mode option
parent
302c6fff
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
biopet-framework/src/main/java/nl/lumc/sasc/biopet/wrappers/Cutadapt.scala
+31
-8
31 additions, 8 deletions
...src/main/java/nl/lumc/sasc/biopet/wrappers/Cutadapt.scala
with
31 additions
and
8 deletions
biopet-framework/src/main/java/nl/lumc/sasc/biopet/wrappers/Cutadapt.scala
+
31
−
8
View file @
b0317762
...
...
@@ -11,6 +11,7 @@ class Cutadapt(val globalConfig: Config) extends CommandLineFunction {
def
this
()
=
this
(
new
Config
(
Map
()))
analysisName
=
"cutadapt"
val
config
:
Config
=
Config
.
mergeConfigs
(
globalConfig
.
getAsConfig
(
"cutadapt"
),
globalConfig
)
logger
.
debug
(
"Config for "
+
this
.
analysisName
+
": "
+
config
)
@Input
(
doc
=
"Cutadapt exe"
,
required
=
false
)
var
cutadapt_exe
:
File
=
new
File
(
config
.
getAsString
(
"exe"
,
"/usr/local/bin/cutadapt"
))
...
...
@@ -18,17 +19,22 @@ class Cutadapt(val globalConfig: Config) extends CommandLineFunction {
@Input
(
doc
=
"Fastq contams file"
,
required
=
false
)
var
contams_file
:
File
=
_
@Output
(
doc
=
"Output fastq file"
)
var
fastq_output
:
File
=
_
var
default_clip_mode
=
config
.
getAsString
(
"default_clip_mode"
,
"3"
)
var
opt_adapter
:
Set
[
String
]
=
config
.
getAsListOfStrings
(
"adapter"
,
Nil
).
to
[
Set
]
var
opt_anywhere
:
Set
[
String
]
=
config
.
getAsListOfStrings
(
"anywhere"
,
Nil
).
to
[
Set
]
var
opt_front
:
Set
[
String
]
=
config
.
getAsListOfStrings
(
"front"
,
Nil
).
to
[
Set
]
var
opt_discard
:
Boolean
=
config
.
getAsBoolean
(
"discard"
,
false
)
var
opt_minimum_length
:
String
=
config
.
getAsInt
(
"minimum_length"
,
1
).
toString
var
opt_maximum_length
:
String
=
if
(
config
.
contains
(
"maximum_length"
))
config
.
getAs
Int
(
"maximum_length"
).
toString
else
null
var
opt_maximum_length
:
String
=
config
.
getAs
String
(
"maximum_length"
,
null
)
def
commandLine
=
{
def
init
()
{
this
.
addJobReportBinding
(
"version"
,
getVersion
)
this
.
getContamsFromFile
}
def
commandLine
=
{
init
()
if
(!
opt_adapter
.
isEmpty
||
!
opt_anywhere
.
isEmpty
||
!
opt_front
.
isEmpty
)
{
required
(
cutadapt_exe
)
+
// options
...
...
@@ -53,7 +59,13 @@ class Cutadapt(val globalConfig: Config) extends CommandLineFunction {
if
(
contams_file
.
exists
())
{
for
(
line
<-
fromFile
(
contams_file
).
getLines
)
{
var
s
:
String
=
line
.
substring
(
line
.
lastIndexOf
(
"\t"
)+
1
,
line
.
size
)
opt_adapter
+=
s
if
(
default_clip_mode
==
"3"
)
opt_adapter
+=
s
else
if
(
default_clip_mode
==
"5"
)
opt_front
+=
s
else
if
(
default_clip_mode
==
"both"
)
opt_anywhere
+=
s
else
{
opt_adapter
+=
s
logger
.
warn
(
"Option default_clip_mode should be '3', '5' or 'both', falling back to default: '3'"
)
}
logger
.
info
(
"Adapter: "
+
s
+
" found in: "
+
fastq_input
)
}
}
else
logger
.
warn
(
"File : "
+
contams_file
+
" does not exist"
)
...
...
@@ -61,11 +73,22 @@ class Cutadapt(val globalConfig: Config) extends CommandLineFunction {
}
private
var
version
:
String
=
_
def
getVersion
:
String
=
{
if
(
version
==
null
)
{
val
v
:
String
=
(
cutadapt_exe
+
" --version"
).!!.
replace
(
"\n"
,
""
)
if
(!
v
.
isEmpty
)
version
=
v
var
versionCommand
=
cutadapt_exe
+
" --version"
var
versionRegex
=
"""(.*)"""
def
getVersion
:
String
=
getVersion
(
versionCommand
,
versionRegex
)
def
getVersion
(
cmd
:
String
,
regex
:
String
)
:
String
=
{
val
REG
=
regex
.
r
if
(
cmd
.!
!=
0
)
{
logger
.
warn
(
"Version command: '"
+
cmd
+
"' give a none-zero exit code, version not found"
)
return
"NA"
}
for
(
line
<-
cmd
.!!.
split
(
"\n"
))
{
line
match
{
case
REG
(
m
)
=>
return
m
case
_
=>
}
}
return
version
logger
.
warn
(
"Version command: '"
+
cmd
+
"' give a exit code 0 but no version was found, executeble oke?"
)
return
"NA"
}
}
\ No newline at end of file
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