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
d82b56a0
Commit
d82b56a0
authored
Oct 19, 2015
by
Wai Yi Leung
Browse files
Updated krakentojson report and enforce check-names with-in Kraken
parent
ceaa8fd0
Changes
5
Hide whitespace changes
Inline
Side-by-side
public/biopet-extentsions/src/main/scala/nl/lumc/sasc/biopet/extensions/kraken/Kraken.scala
View file @
d82b56a0
...
...
@@ -39,11 +39,6 @@ class Kraken(val root: Configurable) extends BiopetCommandLineFunction {
var
db
:
File
=
config
(
"db"
)
var
inputFastQ
:
Boolean
=
true
var
compression
:
Boolean
=
false
var
compressionGzip
:
Boolean
=
false
var
compressionBzip
:
Boolean
=
false
var
quick
:
Boolean
=
false
var
minHits
:
Option
[
Int
]
=
config
(
"min_hits"
)
...
...
@@ -68,8 +63,6 @@ class Kraken(val root: Configurable) extends BiopetCommandLineFunction {
def
cmdLine
=
required
(
executable
)
+
"--db"
+
required
(
db
)
+
optional
(
"--threads"
,
nCoresRequest
)
+
conditional
(
inputFastQ
,
"--fastq-input"
)
+
conditional
(!
inputFastQ
,
"--fasta-input"
)
+
conditional
(
quick
,
"--quick"
)
+
optional
(
"--min_hits"
,
minHits
)
+
optional
(
"--unclassified-out "
,
unclassified_out
.
get
)
+
...
...
@@ -77,5 +70,6 @@ class Kraken(val root: Configurable) extends BiopetCommandLineFunction {
"--output"
+
required
(
output
)
+
conditional
(
preLoad
,
"--preload"
)
+
conditional
(
paired
,
"--paired"
)
+
conditional
(
paired
,
"--check-names"
)
+
repeat
(
input
)
}
public/biopet-extentsions/src/main/scala/nl/lumc/sasc/biopet/extensions/kraken/KrakenReport.scala
View file @
d82b56a0
...
...
@@ -44,9 +44,9 @@ class KrakenReport(val root: Configurable) extends BiopetCommandLineFunction {
var
output
:
File
=
_
def
cmdLine
:
String
=
{
val
cmd
:
String
=
"--db "
+
required
(
db
)
+
val
cmd
:
String
=
required
(
executable
)
+
"--db "
+
required
(
db
)
+
conditional
(
show_zeros
,
"--show-zeros"
)
+
input
.
getAbsolutePath
+
"
>
"
+
output
.
getAbsolutePath
required
(
input
.
getAbsolutePath
)
+
"
>
"
+
required
(
output
.
getAbsolutePath
)
cmd
}
}
public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/KrakenReportToJson.scala
View file @
d82b56a0
...
...
@@ -24,14 +24,17 @@ class KrakenReportToJson(val root: Configurable) extends ToolCommandFuntion with
var
inputReport
:
File
=
null
@Argument
(
required
=
false
)
var
skipNames
:
Boolean
=
tru
e
var
skipNames
:
Boolean
=
fals
e
@Output
(
doc
=
"Output JSON"
,
shortName
=
"output"
,
required
=
true
)
var
output
:
File
=
null
override
def
defaultCoreMemory
=
1.0
override
def
cmdLine
=
super
.
cmdLine
+
required
(
"-i"
,
inputReport
)
+
required
(
"-o"
,
output
)
override
def
cmdLine
=
super
.
cmdLine
+
required
(
"-i"
,
inputReport
)
+
required
(
"-o"
,
output
)
+
conditional
(
skipNames
,
"--skipnames"
)
def
summaryStats
:
Map
[
String
,
Any
]
=
{
val
map
=
ConfigUtils
.
fileToConfigMap
(
output
)
...
...
public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/KrakenReportToJson.scala
View file @
d82b56a0
...
...
@@ -56,7 +56,7 @@ object KrakenReportToJson extends ToolCommand {
var
cladeIDs
:
mutable.ArrayBuffer
[
Long
]
=
mutable
.
ArrayBuffer
.
fill
(
32
)(
0
)
val
spacePattern
=
"^( +)"
.
r
case
class
Args
(
krakenreport
:
File
=
null
,
outputJson
:
Option
[
File
]
=
None
,
skipNames
:
Boolean
=
tru
e
)
extends
AbstractArgs
case
class
Args
(
krakenreport
:
File
=
null
,
outputJson
:
Option
[
File
]
=
None
,
skipNames
:
Boolean
=
fals
e
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
...
...
@@ -93,6 +93,9 @@ object KrakenReportToJson extends ToolCommand {
def
parseLine
(
krakenRawHit
:
String
,
skipNames
:
Boolean
)
:
Map
[
Long
,
KrakenHit
]
=
{
val
values
:
Array
[
String
]
=
krakenRawHit
.
stripLineEnd
.
split
(
"\t"
)
assert
(
values
.
length
==
6
)
val
scientificName
:
String
=
values
(
5
)
val
cladeLevel
=
spacePattern
.
findFirstIn
(
scientificName
).
getOrElse
(
""
).
length
/
2
...
...
public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/Gears.scala
View file @
d82b56a0
...
...
@@ -74,16 +74,10 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
samFilterUnmapped
.
isIntermediate
=
false
add
(
samFilterUnmapped
)
val
samNameSort
=
new
SortSam
(
qscript
)
samNameSort
.
input
=
samFilterUnmapped
.
output
samNameSort
.
output
=
new
File
(
outputDir
,
s
"$outputName.unmapped.nsort.bam"
)
samNameSort
.
sortOrder
=
"queryname"
samNameSort
.
isIntermediate
=
false
add
(
samNameSort
)
// start bam to fastq (only on unaligned reads) also extract the matesam
val
samToFastq
=
new
SamToFastq
(
qscript
)
samToFastq
.
input
=
samNameSort
.
output
samToFastq
.
input
=
samFilterUnmapped
.
output
samToFastq
.
stringency
=
Some
(
"LENIENT"
)
samToFastq
.
fastqR1
=
new
File
(
outputDir
,
s
"$outputName.unmapped.R1.fq.gz"
)
samToFastq
.
fastqR2
=
new
File
(
outputDir
,
s
"$outputName.unmapped.R2.fq.gz"
)
samToFastq
.
fastqUnpaired
=
new
File
(
outputDir
,
s
"$outputName.unmapped.singleton.fq.gz"
)
...
...
@@ -136,9 +130,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
GearsOutputFiles
++
Map
(
"kraken_report_output"
->
krakenReport
.
output
)
val
krakenReportJSON
=
new
KrakenReportToJson
(
qscript
)
krakenReportJSON
.
inputReport
=
kraken
Analysis
.
output
krakenReportJSON
.
inputReport
=
kraken
Report
.
output
krakenReportJSON
.
output
=
new
File
(
outputDir
,
s
"$outputName.krkn.json"
)
krakenReportJSON
.
skipNames
=
config
(
"skipNames"
,
default
=
tru
e
)
krakenReportJSON
.
skipNames
=
config
(
"skipNames"
,
default
=
fals
e
)
add
(
krakenReportJSON
)
addSummaryJobs
()
...
...
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