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
196392f1
Commit
196392f1
authored
Mar 05, 2015
by
Peter van 't Hof
Browse files
Added scala docs
parent
8fbf2803
Changes
7
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala
View file @
196392f1
...
...
@@ -25,9 +25,7 @@ import scala.util.matching.Regex
import
java.io.FileInputStream
import
java.security.MessageDigest
/**
* Biopet command line trait to auto check executable and cluster values
*/
/** Biopet command line trait to auto check executable and cluster values */
trait
BiopetCommandLineFunctionTrait
extends
CommandLineFunction
with
Configurable
{
analysisName
=
configName
...
...
@@ -47,14 +45,10 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
*/
protected
[
core
]
def
beforeCmd
{}
/**
* Can override this method. This is executed after the script is done en queue starts to generate the graph
*/
/** Can override this method. This is executed after the script is done en queue starts to generate the graph */
protected
[
core
]
def
beforeGraph
{}
/**
* Set default output file, threads and vmem for current job
*/
/** Set default output file, threads and vmem for current job */
override
def
freezeFieldValues
()
{
preProcesExecutable
beforeGraph
...
...
@@ -118,9 +112,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
addJobReportBinding
(
"md5sum_exe"
,
md5
.
getOrElse
(
"None"
))
}
/**
* executes checkExecutable method and fill job report
*/
/** executes checkExecutable method and fill job report */
final
protected
def
preCmdInternal
{
preProcesExecutable
...
...
@@ -133,10 +125,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
addJobReportBinding
(
"version"
,
getVersion
)
}
/**
* Command to get version of executable
* @return
*/
/** Command to get version of executable */
protected
def
versionCommand
:
String
=
null
/** Regex to get version from version command output */
...
...
@@ -205,9 +194,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
}
}
/**
* stores global caches
*/
/** stores global caches */
object
BiopetCommandLineFunctionTrait
{
import
scala.collection.mutable.Map
private
val
versionCache
:
Map
[
String
,
String
]
=
Map
()
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Bowtie.scala
View file @
196392f1
...
...
@@ -21,6 +21,11 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
/**
* Extension for bowtie 1
*
* Based on version 1.1.1
*/
class
Bowtie
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Fastq file R1"
,
shortName
=
"R1"
)
var
R1
:
File
=
null
...
...
@@ -53,6 +58,7 @@ class Bowtie(val root: Configurable) extends BiopetCommandLineFunction {
var
strata
:
Boolean
=
config
(
"strata"
,
default
=
false
)
var
maqerr
:
Option
[
Int
]
=
config
(
"maqerr"
)
/** return commandline to execute */
def
cmdLine
=
{
required
(
executable
)
+
optional
(
"--threads"
,
nCoresRequest
)
+
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Cat.scala
View file @
196392f1
...
...
@@ -20,6 +20,9 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
java.io.File
/**
* Extension for GNU cat
*/
class
Cat
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Input file"
,
required
=
true
)
var
input
:
List
[
File
]
=
Nil
...
...
@@ -29,10 +32,22 @@ class Cat(val root: Configurable) extends BiopetCommandLineFunction {
executable
=
config
(
"exe"
,
default
=
"cat"
)
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
repeat
(
input
)
+
" > "
+
required
(
output
)
}
/**
* Object for constructors for cat
*/
object
Cat
{
/**
* Basis constructor
* @param root root object for config
* @param input list of files to use
* @param output output File
* @return
*/
def
apply
(
root
:
Configurable
,
input
:
List
[
File
],
output
:
File
)
:
Cat
=
{
val
cat
=
new
Cat
(
root
)
cat
.
input
=
input
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Cutadapt.scala
View file @
196392f1
...
...
@@ -24,6 +24,10 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import
scala.collection.mutable
import
scala.io.Source
/**
* Extension for cutadept
* Based on version 1.5
*/
class
Cutadapt
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
with
Summarizable
{
@Input
(
doc
=
"Input fastq file"
)
var
fastq_input
:
File
=
_
...
...
@@ -39,17 +43,15 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
override
val
versionRegex
=
"""(.*)"""
.
r
var
default_clip_mode
:
String
=
config
(
"default_clip_mode"
,
default
=
"3"
)
var
opt_adapter
:
Set
[
String
]
=
Set
()
if
(
config
.
contains
(
"adapter"
))
for
(
adapter
<-
config
(
"adapter"
).
asList
)
opt_adapter
+=
adapter
.
toString
var
opt_anywhere
:
Set
[
String
]
=
Set
()
if
(
config
.
contains
(
"anywhere"
))
for
(
adapter
<-
config
(
"anywhere"
).
asList
)
opt_anywhere
+=
adapter
.
toString
var
opt_front
:
Set
[
String
]
=
Set
()
if
(
config
.
contains
(
"front"
))
for
(
adapter
<-
config
(
"front"
).
asList
)
opt_front
+=
adapter
.
toString
var
opt_adapter
:
Set
[
String
]
=
config
(
"adapter"
,
default
=
Nil
)
var
opt_anywhere
:
Set
[
String
]
=
config
(
"anywhere"
,
default
=
Nil
)
var
opt_front
:
Set
[
String
]
=
config
(
"front"
,
default
=
Nil
)
var
opt_discard
:
Boolean
=
config
(
"discard"
,
default
=
false
)
var
opt_minimum_length
:
Int
=
config
(
"minimum_length"
,
1
)
var
opt_maximum_length
:
Option
[
Int
]
=
config
(
"maximum_length"
)
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
// options
repeat
(
"-a"
,
opt_adapter
)
+
...
...
@@ -63,6 +65,7 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
required
(
"--output"
,
fastq_output
)
+
" > "
+
required
(
stats_output
)
/** Output summary stats */
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
trimR
=
""".*Trimmed reads: *(\d*) .*"""
.
r
val
tooShortR
=
""".*Too short reads: *(\d*) .*"""
.
r
...
...
@@ -89,6 +92,7 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
)
}
/** Merges values that can be merged for the summary */
override
def
resolveSummaryConflict
(
v1
:
Any
,
v2
:
Any
,
key
:
String
)
:
Any
=
{
(
v1
,
v2
)
match
{
case
(
v1
:
Int
,
v2
:
Int
)
=>
v1
+
v2
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Fastqc.scala
View file @
196392f1
...
...
@@ -22,6 +22,10 @@ import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import
nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import
nl.lumc.sasc.biopet.core.config.Configurable
/**
* Extension for fastqc
* Based on version 0.10.1 and 0.11.2
*/
class
Fastqc
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Contaminants"
,
required
=
false
)
...
...
@@ -48,6 +52,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
override
def
versionCommand
=
executable
+
" --version"
override
val
defaultThreads
=
4
/** Sets contaminants and adapters when not yet set */
override
def
beforeGraph
{
this
.
preProcesExecutable
...
...
@@ -78,6 +83,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
}
}
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
optional
(
"--java"
,
java_exe
)
+
optional
(
"--threads"
,
threads
)
+
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala
View file @
196392f1
...
...
@@ -21,6 +21,9 @@ import org.broadinstitute.gatk.queue.function.InProcessFunction
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
nl.lumc.sasc.biopet.core.config.Configurable
/**
* This class can execute ln as InProcessFunction or used to only generate the ln command
*/
class
Ln
(
val
root
:
Configurable
)
extends
InProcessFunction
with
Configurable
{
this
.
analysisName
=
getClass
.
getSimpleName
...
...
@@ -35,12 +38,14 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
var
relative
:
Boolean
=
true
/** Generate out file for job */
override
def
freezeFieldValues
()
:
Unit
=
{
val
outLog
:
String
=
".%s.%s.out"
.
format
(
out
.
getName
,
analysisName
)
jobOutputFile
=
new
File
(
out
.
getAbsoluteFile
.
getParentFile
,
outLog
)
super
.
freezeFieldValues
()
}
/** return commandline to execute */
lazy
val
cmd
:
String
=
{
lazy
val
inCanonical
:
String
=
{
// need to remove "/~" to correctly expand path with tilde
...
...
@@ -113,7 +118,17 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
}
}
/** Object for constructors for ln */
object
Ln
{
/**
* Basis constructor
* @param root root object for config
* @param input list of files to use
* @param output output File
* @param relative make reletive links (default true)
* @return
*/
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
,
relative
:
Boolean
=
true
)
:
Ln
=
{
val
ln
=
new
Ln
(
root
)
ln
.
in
=
input
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Md5sum.scala
View file @
196392f1
...
...
@@ -32,6 +32,7 @@ class Md5sum(val root: Configurable) extends BiopetCommandLineFunction {
executable
=
config
(
"exe"
,
default
=
"md5sum"
)
/** return commandline to execute */
def
cmdLine
=
required
(
executable
)
+
required
(
input
)
+
" > "
+
required
(
output
)
def
getSummary
:
Json
=
{
...
...
@@ -42,7 +43,9 @@ class Md5sum(val root: Configurable) extends BiopetCommandLineFunction {
}
}
/** Object for constructors for md5sum */
object
Md5sum
{
/** Makes md5sum with md5 file in given dir */
def
apply
(
root
:
Configurable
,
fastqfile
:
File
,
outDir
:
File
)
:
Md5sum
=
{
val
md5sum
=
new
Md5sum
(
root
)
md5sum
.
input
=
fastqfile
...
...
@@ -50,6 +53,7 @@ object Md5sum {
return
md5sum
}
/** Makes md5sum with md5 file in same dir as input file */
def
apply
(
root
:
Configurable
,
file
:
File
)
:
Md5sum
=
{
val
md5sum
=
new
Md5sum
(
root
)
md5sum
.
input
=
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