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
0358aae4
Commit
0358aae4
authored
Oct 17, 2016
by
Sander Bollen
Browse files
Merge branch 'develop' into add-cnmops-kopisu
parents
3ce0cd9f
4db54050
Changes
19
Hide whitespace changes
Inline
Side-by-side
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Cuffquant.scala
View file @
0358aae4
...
...
@@ -35,11 +35,11 @@ class Cuffquant(val root: Configurable) extends BiopetCommandLineFunction with V
means we have 2 samples, each with 2 replicates
so our input is a list of lists of Files
*/
var
input
:
List
[
List
[
File
]]
=
List
.
empty
[
List
[
File
]]
var
input
:
List
[
List
[
File
]]
=
Nil
/** input GTF file */
@Input
(
doc
=
"Input GTF file"
,
required
=
true
)
var
transcriptsGtf
:
File
=
null
var
transcriptsGtf
:
File
=
_
/** output file, computed automatically from output directory */
@Output
(
doc
=
"Output CXB file"
)
...
...
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Gzip.scala
View file @
0358aae4
...
...
@@ -40,6 +40,8 @@ class Gzip(val root: Configurable) extends BiopetCommandLineFunction with Versio
object
Gzip
{
def
apply
(
root
:
Configurable
)
:
Gzip
=
new
Gzip
(
root
)
def
apply
(
root
:
Configurable
,
input
:
File
,
output
:
File
)
:
Gzip
=
Gzip
(
root
,
List
(
input
),
output
)
def
apply
(
root
:
Configurable
,
input
:
List
[
File
],
output
:
File
)
:
Gzip
=
{
val
gzip
=
new
Gzip
(
root
)
gzip
.
input
=
input
...
...
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/centrifuge/Centrifuge.scala
0 → 100644
View file @
0358aae4
package
nl.lumc.sasc.biopet.extensions.centrifuge
import
java.io.File
import
nl.lumc.sasc.biopet.core.
{
BiopetCommandLineFunction
,
Version
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.util.matching.Regex
/**
* Created by pjvanthof on 19/09/16.
*/
class
Centrifuge
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
with
Version
{
@Input
(
doc
=
"Input: FastQ or FastA"
,
required
=
true
)
var
inputR1
:
File
=
_
@Input
(
doc
=
"Input: FastQ or FastA"
,
required
=
false
)
var
inputR2
:
Option
[
File
]
=
None
var
index
:
File
=
config
(
"centrifuge_index"
)
@Output
(
doc
=
"Output with hits per sequence"
)
var
output
:
File
=
_
@Output
(
doc
=
"Output with hits per sequence"
)
var
report
:
Option
[
File
]
=
None
override
def
defaultThreads
=
8
executable
=
config
(
"exe"
,
default
=
"centrifuge"
,
freeVar
=
false
)
/** Command to get version of executable */
def
versionCommand
:
String
=
s
"$executable --version"
/** Regex to get version from version command output */
def
versionRegex
:
Regex
=
".* version (.*)"
.
r
override
def
beforeGraph
()
:
Unit
=
{
super
.
beforeGraph
()
deps
:+=
new
File
(
index
+
".1.cf"
)
deps
:+=
new
File
(
index
+
".2.cf"
)
deps
:+=
new
File
(
index
+
".3.cf"
)
}
/**
* This function needs to be implemented to define the command that is executed
*
* @return Command to run
*/
def
cmdLine
:
String
=
executable
+
//TODO: Options
optional
(
"--threads"
,
threads
)
+
required
(
"-x"
,
index
)
+
(
inputR2
match
{
case
Some
(
r2
)
=>
required
(
"-1"
,
inputR1
)
+
required
(
"-2"
,
r2
)
case
_
=>
required
(
"-U"
,
inputR1
)
})
+
(
if
(
outputAsStsout
)
""
else
required
(
"-S"
,
output
))
+
optional
(
"--report-file"
,
report
)
}
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/centrifuge/CentrifugeKreport.scala
0 → 100644
View file @
0358aae4
package
nl.lumc.sasc.biopet.extensions.centrifuge
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 19/09/16.
*/
class
CentrifugeKreport
(
val
root
:
Configurable
)
extends
BiopetCommandLineFunction
{
@Input
(
doc
=
"Output files centrifuge"
,
required
=
true
)
var
centrifugeOutputFiles
:
List
[
File
]
=
Nil
@Output
(
doc
=
"Output report"
)
var
output
:
File
=
_
var
index
:
File
=
config
(
"centrifuge_index"
,
namespace
=
"centrifuge"
)
var
onlyUnique
:
Boolean
=
config
(
"only_unique"
,
default
=
false
)
var
showZeros
:
Boolean
=
config
(
"show_zeros"
,
default
=
false
)
var
isCounts
:
Boolean
=
config
(
"is_counts"
,
default
=
false
)
var
minScore
:
Option
[
Double
]
=
config
(
"min_score"
)
var
minLength
:
Option
[
Int
]
=
config
(
"min_length"
)
override
def
defaultCoreMemory
=
4.0
executable
=
config
(
"exe"
,
default
=
"centrifuge-kreport"
,
freeVar
=
false
)
override
def
beforeGraph
()
:
Unit
=
{
super
.
beforeGraph
()
deps
:+=
new
File
(
index
+
".1.cf"
)
deps
:+=
new
File
(
index
+
".2.cf"
)
deps
:+=
new
File
(
index
+
".3.cf"
)
}
def
cmdLine
=
executable
+
conditional
(
onlyUnique
,
"--only-unique"
)
+
conditional
(
showZeros
,
"--show-zeros"
)
+
conditional
(
isCounts
,
"--is-counts"
)
+
optional
(
"--min-score="
,
minScore
,
spaceSeparated
=
false
)
+
optional
(
"--min-length="
,
minLength
,
spaceSeparated
=
false
)
+
required
(
"-x"
,
index
)
+
repeat
(
centrifugeOutputFiles
)
+
" > "
+
required
(
output
)
}
biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/KrakenReportToJson.scala
View file @
0358aae4
...
...
@@ -42,7 +42,7 @@ class KrakenReportToJson(val root: Configurable) extends ToolCommandFunction wit
@Output
(
doc
=
"Output JSON"
,
shortName
=
"output"
,
required
=
true
)
var
output
:
File
=
_
override
def
defaultCoreMemory
=
2
.0
override
def
defaultCoreMemory
=
4
.0
override
def
cmdLine
=
super
.
cmdLine
+
...
...
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfFilter.scala
View file @
0358aae4
...
...
@@ -19,7 +19,7 @@ import java.io.File
import
htsjdk.variant.variantcontext.
{
GenotypeType
,
VariantContext
}
import
htsjdk.variant.variantcontext.writer.
{
AsyncVariantContextWriter
,
VariantContextWriterBuilder
}
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.utils.ToolCommand
import
nl.lumc.sasc.biopet.utils.
{
ToolCommand
,
VcfUtils
}
import
scala.collection.JavaConversions._
import
scala.io.Source
...
...
@@ -315,11 +315,11 @@ object VcfFilter extends ToolCommand {
* Checks if given samples does have a variant hin this record
*
* @param record VCF record
* @param
mustHaveVariant
List of samples that should have this variant
* @param
samples
List of samples that should have this variant
* @return true if filter passed
*/
def
mustHaveVariant
(
record
:
VariantContext
,
mustHaveVariant
:
List
[
String
])
:
Boolean
=
{
!
mustHaveVariant
.
map
(
record
.
getGenotype
).
exists
(
a
=>
a
.
isHomRef
||
a
.
isNoCall
)
def
mustHaveVariant
(
record
:
VariantContext
,
samples
:
List
[
String
])
:
Boolean
=
{
!
samples
.
map
(
record
.
getGenotype
).
exists
(
a
=>
a
.
isHomRef
||
a
.
isNoCall
||
VcfUtils
.
isCompoundNoCall
(
a
)
)
}
/** Checks if given samples have the same genotype */
...
...
biopet-tools/src/test/resources/star_genotype.vcf.gz
0 → 100644
View file @
0358aae4
File added
biopet-tools/src/test/resources/star_genotype.vcf.gz.tbi
0 → 100644
View file @
0358aae4
File added
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala
View file @
0358aae4
...
...
@@ -39,7 +39,9 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers {
}
val
veppedPath
=
resourcePath
(
"/VEP_oneline.vcf"
)
val
starPath
=
resourcePath
(
"/star_genotype.vcf.gz"
)
val
vepped
=
new
File
(
veppedPath
)
val
star
=
new
File
(
starPath
)
val
rand
=
new
Random
()
@Test
def
testOutputTypeVcf
()
=
{
...
...
@@ -183,6 +185,9 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers {
mustHaveVariant
(
record
,
List
(
"Sample_101"
))
shouldBe
true
mustHaveVariant
(
record
,
List
(
"Sample_101"
,
"Sample_102"
))
shouldBe
true
mustHaveVariant
(
record
,
List
(
"Sample_101"
,
"Sample_102"
,
"Sample_103"
))
shouldBe
false
val
starReader
=
new
VCFFileReader
(
star
,
false
)
starReader
.
iterator
().
foreach
(
x
=>
mustHaveVariant
(
x
,
List
(
"Sample_101"
))
shouldBe
false
)
}
@Test
def
testSameGenotype
()
=
{
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/VcfUtils.scala
View file @
0358aae4
...
...
@@ -140,4 +140,13 @@ object VcfUtils {
reader
.
close
()
!
hasNext
}
/**
* Check whether genotype is of the form 0/.
* @param genotype genotype
* @return boolean
*/
def
isCompoundNoCall
(
genotype
:
Genotype
)
:
Boolean
=
{
genotype
.
isCalled
&&
genotype
.
getAlleles
.
exists
(
_
.
isNoCall
)
&&
genotype
.
getAlleles
.
exists
(
_
.
isReference
)
}
}
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/package.scala
View file @
0358aae4
...
...
@@ -64,4 +64,30 @@ package object utils {
case
_
if
fallBack
=>
Try
(
raw
)
case
_
=>
Try
(
throw
new
Exception
(
s
"Can not extract number from string $raw"
))
}
val
semanticVersionRegex
=
"(\\d+)\\.(\\d+)\\.(\\d+)(-.*)?"
.
r
/**
* Check whether a version string is a semantic version.
*
* @param version version string
* @return boolean
*/
def
isSemanticVersion
(
version
:
String
)
:
Boolean
=
getSemanticVersion
(
version
).
isDefined
case
class
SemanticVersion
(
major
:
Int
,
minor
:
Int
,
patch
:
Int
,
build
:
Option
[
String
]
=
None
)
/**
* Check whether a version string is a semantic version.
* Note: the toInt calls here are only safe because the regex only matches numbers
*
* @param version version string
* @return SemanticVersion case class
*/
def
getSemanticVersion
(
version
:
String
)
=
{
version
match
{
case
semanticVersionRegex
(
major
,
minor
,
patch
,
build
)
=>
Some
(
SemanticVersion
(
major
.
toInt
,
minor
.
toInt
,
patch
.
toInt
,
Option
(
build
).
map
(
x
=>
x
.
stripPrefix
(
"-"
))))
case
_
=>
None
}
}
}
biopet-utils/src/test/scala/VcfUtilsTest.scala
0 → 100644
View file @
0358aae4
import
htsjdk.variant.variantcontext.
{
Allele
,
Genotype
,
GenotypeBuilder
}
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.Test
import
scala.collection.JavaConversions._
import
nl.lumc.sasc.biopet.utils.VcfUtils
/**
* Created by Sander Bollen on 4-10-16.
*/
class
VcfUtilsTest
extends
TestNGSuite
with
Matchers
{
@Test
def
testCompoundNoCall
()
:
Unit
=
{
val
noAllele
=
Allele
.
NO_CALL
val
refAllele
=
Allele
.
create
(
"A"
,
true
)
val
compoundNoCall
=
GenotypeBuilder
.
create
(
"sample_01"
,
List
(
noAllele
,
refAllele
))
VcfUtils
.
isCompoundNoCall
(
compoundNoCall
)
shouldBe
true
val
altAllele
=
Allele
.
create
(
"G"
,
false
)
val
normalGenotype
=
GenotypeBuilder
.
create
(
"sample_01"
,
List
(
refAllele
,
altAllele
))
VcfUtils
.
isCompoundNoCall
(
normalGenotype
)
shouldBe
false
val
completeNoCall
=
GenotypeBuilder
.
create
(
"sample_01"
,
List
(
noAllele
,
noAllele
))
VcfUtils
.
isCompoundNoCall
(
completeNoCall
)
shouldBe
false
}
}
biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/UtilsTest.scala
0 → 100644
View file @
0358aae4
package
nl.lumc.sasc.biopet.utils
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.Test
/**
* Created by Sander Bollen on 12-10-16.
*/
class
UtilsTest
extends
TestNGSuite
with
Matchers
{
val
semanticVersion
=
"1.2.3"
val
semanticVersionWithBuild
=
"1.2.3-alpha0.1"
val
nonSemanticVersion
=
"v1222.1"
@Test
def
testIsSemantic
()
=
{
isSemanticVersion
(
semanticVersion
)
shouldBe
true
isSemanticVersion
(
semanticVersionWithBuild
)
shouldBe
true
isSemanticVersion
(
nonSemanticVersion
)
shouldBe
false
}
@Test
def
testMajorVersion
()
=
{
getSemanticVersion
(
semanticVersion
).
map
(
_
.
major
)
shouldBe
Some
(
1
)
getSemanticVersion
(
semanticVersionWithBuild
).
map
(
_
.
major
)
shouldBe
Some
(
1
)
}
@Test
def
testMinorVersion
()
=
{
getSemanticVersion
(
semanticVersion
).
map
(
_
.
minor
)
shouldBe
Some
(
2
)
getSemanticVersion
(
semanticVersionWithBuild
).
map
(
_
.
minor
)
shouldBe
Some
(
2
)
}
@Test
def
testPatchVersion
()
=
{
getSemanticVersion
(
semanticVersion
).
map
(
_
.
patch
)
shouldBe
Some
(
3
)
getSemanticVersion
(
semanticVersionWithBuild
).
map
(
_
.
patch
)
shouldBe
Some
(
3
)
}
@Test
def
testBuildVersion
()
=
{
getSemanticVersion
(
semanticVersion
).
flatMap
(
_
.
build
)
shouldBe
None
getSemanticVersion
(
semanticVersionWithBuild
).
flatMap
(
_
.
build
)
shouldBe
Some
(
"alpha0.1"
)
}
}
gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp
View file @
0358aae4
...
...
@@ -10,11 +10,13 @@
<%@ var libId: Option[String] = None %>
<%@ var args: Map[String, Any] %>
<%@ var outputDir: File %>
<%@ var summaryStatsTag: String = "krakenreport" %>
<%@ var summaryModuleTag: String = "gearskraken" %>
<%
val summaries = if (sampleId.isEmpty && libId.isEmpty) {
summary.getSampleValues(
"gearskraken", "stats", "krakenreport"
).map(x => x._1 -> x._2.get.asInstanceOf[Map[String, Any]])
} else summary.getValue(sampleId, libId,
"gearskraken", "stats", "krakenreport"
).map(sampleId.get -> _.asInstanceOf[Map[String, Any]]).toList.toMap
summary.getSampleValues(
summaryModuleTag, "stats", summaryStatsTag
).map(x => x._1 -> x._2.get.asInstanceOf[Map[String, Any]])
} else summary.getValue(sampleId, libId,
summaryModuleTag, "stats", summaryStatsTag
).map(sampleId.get -> _.asInstanceOf[Map[String, Any]]).toList.toMap
val tempFile = File.createTempFile("krona.", ".xml")
tempFile.deleteOnExit()
...
...
@@ -24,10 +26,10 @@
args ++ Map("kronaXml" -> tempFile))
val file = new File(outputDir,
"kraken_krona
.html")
val file = new File(outputDir,
s"$summaryModuleTag-$summaryStatsTag
.html")
val writer = new PrintWriter(file)
writer.println(output)
writer.close()
%>
<iframe src="
kraken_krona
.html" style="width:100%;height:80vh;border:none;"></iframe>
<iframe src="
${summaryModuleTag}-${summaryStatsTag}
.html" style="width:100%;height:80vh;border:none;"></iframe>
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsCentrifuge.scala
0 → 100644
View file @
0358aae4
package
nl.lumc.sasc.biopet.pipelines.gears
import
nl.lumc.sasc.biopet.core.SampleLibraryTag
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.extensions.Gzip
import
nl.lumc.sasc.biopet.extensions.centrifuge.
{
Centrifuge
,
CentrifugeKreport
}
import
nl.lumc.sasc.biopet.extensions.tools.KrakenReportToJson
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvanthof on 19/09/16.
*/
class
GearsCentrifuge
(
val
root
:
Configurable
)
extends
QScript
with
SummaryQScript
with
SampleLibraryTag
{
var
fastqR1
:
File
=
_
var
fastqR2
:
Option
[
File
]
=
None
var
outputName
:
String
=
_
override
def
fixedValues
=
Map
(
"centrifugekreport"
->
Map
(
"only_unique"
->
false
))
def
init
()
:
Unit
=
{
require
(
fastqR1
!=
null
)
require
(
outputName
!=
null
)
}
def
centrifugeOutput
=
new
File
(
outputDir
,
s
"$outputName.centrifuge.gz"
)
def
biopetScript
()
:
Unit
=
{
val
centrifuge
=
new
Centrifuge
(
this
)
centrifuge
.
inputR1
=
fastqR1
centrifuge
.
inputR2
=
fastqR2
centrifuge
.
output
=
new
File
(
outputDir
,
s
"$outputName.centrifuge"
)
centrifuge
.
report
=
Some
(
new
File
(
outputDir
,
s
"$outputName.centrifuge.report"
))
centrifuge
.
isIntermediate
=
true
add
(
centrifuge
)
add
(
Gzip
(
this
,
centrifuge
.
output
,
centrifugeOutput
))
makeKreport
(
List
(
centrifuge
.
output
),
"centrifuge"
,
unique
=
false
)
makeKreport
(
List
(
centrifuge
.
output
),
"centrifuge_unique"
,
unique
=
true
)
addSummaryJobs
()
}
protected
def
makeKreport
(
inputFiles
:
List
[
File
],
name
:
String
,
unique
:
Boolean
)
:
Unit
=
{
val
centrifugeKreport
=
new
CentrifugeKreport
(
this
)
centrifugeKreport
.
centrifugeOutputFiles
=
inputFiles
centrifugeKreport
.
output
=
new
File
(
outputDir
,
s
"$outputName.$name.kreport"
)
centrifugeKreport
.
onlyUnique
=
unique
add
(
centrifugeKreport
)
val
krakenReportJSON
=
new
KrakenReportToJson
(
this
)
krakenReportJSON
.
inputReport
=
centrifugeKreport
.
output
krakenReportJSON
.
output
=
new
File
(
outputDir
,
s
"$outputName.$name.krkn.json"
)
krakenReportJSON
.
skipNames
=
config
(
"skipNames"
,
default
=
false
)
add
(
krakenReportJSON
)
addSummarizable
(
krakenReportJSON
,
s
"${name}_report"
)
}
/** Location of summary file */
def
summaryFile
=
new
File
(
outputDir
,
sampleId
.
getOrElse
(
"sampleName_unknown"
)
+
".centrifuge.summary.json"
)
/** Pipeline settings shown in the summary file */
def
summarySettings
:
Map
[
String
,
Any
]
=
Map
()
/** Statistics shown in the summary file */
def
summaryFiles
:
Map
[
String
,
File
]
=
outputFiles
+
(
"input_R1"
->
fastqR1
,
"centrifuge_output"
->
centrifugeOutput
)
++
(
fastqR2
match
{
case
Some
(
file
)
=>
Map
(
"input_R2"
->
file
)
case
_
=>
Map
()
})
}
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsKraken.scala
View file @
0358aae4
...
...
@@ -41,10 +41,7 @@ class GearsKraken(val root: Configurable) extends QScript with SummaryQScript wi
def
init
()
:
Unit
=
{
require
(
fastqR1
!=
null
)
if
(
outputName
==
null
)
outputName
=
fastqR1
.
getName
.
stripSuffix
(
".gz"
)
.
stripSuffix
(
".fq"
)
.
stripSuffix
(
".fastq"
)
require
(
outputName
!=
null
)
}
lazy
val
krakenConvertToFasta
:
Boolean
=
config
(
"kraken_discard_quality"
,
default
=
false
)
...
...
@@ -107,7 +104,7 @@ class GearsKraken(val root: Configurable) extends QScript with SummaryQScript wi
def
summaryFile
=
new
File
(
outputDir
,
sampleId
.
getOrElse
(
"sampleName_unknown"
)
+
".kraken.summary.json"
)
/** Pipeline settings shown in the summary file */
def
summarySettings
:
Map
[
String
,
Any
]
=
Map
.
empty
def
summarySettings
:
Map
[
String
,
Any
]
=
Map
()
/** Statistics shown in the summary file */
def
summaryFiles
:
Map
[
String
,
File
]
=
outputFiles
+
(
"input_R1"
->
fastqR1
)
++
(
fastqR2
match
{
...
...
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala
View file @
0358aae4
...
...
@@ -38,13 +38,20 @@ object GearsReport extends MultisampleReportBuilder {
def
indexPage
=
{
val
krakenExecuted
=
summary
.
getSampleValues
(
"gearskraken"
,
"stats"
,
"krakenreport"
).
values
.
forall
(
_
.
isDefined
)
val
centrifugeExecuted
=
summary
.
getSampleValues
(
"gearscentrifuge"
,
"stats"
,
"centrifuge_report"
).
values
.
forall
(
_
.
isDefined
)
val
qiimeClosesOtuTable
=
summary
.
getValue
(
"gears"
,
"files"
,
"pipeline"
,
"qiime_closed_otu_table"
,
"path"
)
.
map
(
x
=>
new
File
(
x
.
toString
))
val
qiimeOpenOtuTable
=
summary
.
getValue
(
"gears"
,
"files"
,
"pipeline"
,
"qiime_open_otu_table"
,
"path"
)
.
map
(
x
=>
new
File
(
x
.
toString
))
ReportPage
(
(
if
(
krakenExecuted
)
List
(
"Kraken analysis"
->
ReportPage
(
List
(),
List
(
(
if
(
centrifugeExecuted
)
List
(
"Centriguge analysis"
->
ReportPage
(
List
(
"Non-unique"
->
ReportPage
(
List
(),
List
(
"All mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_report"
)
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken analysis"
->
ReportPage
(
List
(),
List
(
"Krona plot"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
else
Nil
)
:::
(
if
(
qiimeClosesOtuTable
.
isDefined
)
List
(
"Qiime closed reference analysis"
->
ReportPage
(
List
(),
List
(
...
...
@@ -74,12 +81,19 @@ object GearsReport extends MultisampleReportBuilder {
/** Single sample page */
def
samplePage
(
sampleId
:
String
,
args
:
Map
[
String
,
Any
])
:
ReportPage
=
{
val
krakenExecuted
=
summary
.
getValue
(
Some
(
sampleId
),
None
,
"gearskraken"
,
"stats"
,
"krakenreport"
).
isDefined
val
centrifugeExecuted
=
summary
.
getValue
(
Some
(
sampleId
),
None
,
"gearscentrifuge"
,
"stats"
,
"centrifuge_report"
).
isDefined
val
qiimeClosesOtuTable
=
summary
.
getValue
(
Some
(
sampleId
),
None
,
"gearsqiimeclosed"
,
"files"
,
"pipeline"
,
"otu_table"
,
"path"
)
.
map
(
x
=>
new
File
(
x
.
toString
))
val
qiimeOpenOtuTable
=
summary
.
getValue
(
Some
(
sampleId
),
None
,
"gearsqiimeopen"
,
"files"
,
"pipeline"
,
"otu_table"
,
"path"
)
.
map
(
x
=>
new
File
(
x
.
toString
))
ReportPage
((
if
(
krakenExecuted
)
List
(
"Kraken"
->
ReportPage
(
List
(),
List
(
ReportPage
((
if
(
centrifugeExecuted
)
List
(
"Centriguge analysis"
->
ReportPage
(
List
(
"Non-unique"
->
ReportPage
(
List
(),
List
(
"All mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_report"
)
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken"
->
ReportPage
(
List
(),
List
(
"Kraken analysis"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
else
Nil
)
:::
(
if
(
qiimeClosesOtuTable
.
isDefined
)
List
(
"Qiime closed reference analysis"
->
ReportPage
(
List
(),
List
(
...
...
@@ -99,6 +113,7 @@ object GearsReport extends MultisampleReportBuilder {
def
libraryPage
(
sampleId
:
String
,
libId
:
String
,
args
:
Map
[
String
,
Any
])
:
ReportPage
=
{
val
flexiprepExecuted
=
summary
.
getLibraryValue
(
sampleId
,
libId
,
"flexiprep"
).
isDefined
val
krakenExecuted
=
summary
.
getValue
(
Some
(
sampleId
),
Some
(
libId
),
"gearskraken"
,
"stats"
,
"krakenreport"
).
isDefined
val
centrifugeExecuted
=
summary
.
getValue
(
Some
(
sampleId
),
Some
(
libId
),
"gearscentrifuge"
,
"stats"
,
"centrifuge_report"
).
isDefined
val
qiimeClosesOtuTable
=
summary
.
getValue
(
Some
(
sampleId
),
Some
(
libId
),
"gearsqiimeclosed"
,
"files"
,
"pipeline"
,
"otu_table"
,
"path"
)
.
map
(
x
=>
new
File
(
x
.
toString
))
val
qiimeOpenOtuTable
=
summary
.
getValue
(
Some
(
sampleId
),
Some
(
libId
),
"gearsqiimeopen"
,
"files"
,
"pipeline"
,
"otu_table"
,
"path"
)
...
...
@@ -106,7 +121,13 @@ object GearsReport extends MultisampleReportBuilder {
ReportPage
(
(
if
(
flexiprepExecuted
)
List
(
"QC"
->
FlexiprepReport
.
flexiprepPage
)
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken"
->
ReportPage
(
List
(),
List
(
)
:::
(
if
(
centrifugeExecuted
)
List
(
"Centriguge analysis"
->
ReportPage
(
List
(
"Non-unique"
->
ReportPage
(
List
(),
List
(
"All mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_report"
)
)),
Map
())),
List
(
"Unique mappings"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
,
Map
(
"summaryStatsTag"
->
"centrifuge_unique_report"
)
)),
Map
(
"summaryModuleTag"
->
"gearscentrifuge"
)))
else
Nil
)
:::
(
if
(
krakenExecuted
)
List
(
"Kraken"
->
ReportPage
(
List
(),
List
(
"Kraken analysis"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)),
Map
()))
else
Nil
)
:::
(
if
(
qiimeClosesOtuTable
.
isDefined
)
List
(
"Qiime closed reference analysis"
->
ReportPage
(
List
(),
List
(
...
...
gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsSingle.scala
View file @
0358aae4
...
...
@@ -41,6 +41,7 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
var
outputName
:
String
=
_
lazy
val
krakenScript
=
if
(
config
(
"gears_use_kraken"
,
default
=
true
))
Some
(
new
GearsKraken
(
this
))
else
None
lazy
val
centrifugeScript
=
if
(
config
(
"gears_use_centrifuge"
,
default
=
false
))
Some
(
new
GearsCentrifuge
(
this
))
else
None
lazy
val
qiimeRatx
=
if
(
config
(
"gears_use_qiime_rtax"
,
default
=
false
))
Some
(
new
GearsQiimeRtax
(
this
))
else
None
lazy
val
qiimeClosed
=
if
(
config
(
"gears_use_qiime_closed"
,
default
=
false
))
Some
(
new
GearsQiimeClosed
(
this
))
else
None
lazy
val
qiimeOpen
=
if
(
config
(
"gears_use_qiime_open"
,
default
=
false
))
Some
(
new
GearsQiimeOpen
(
this
))
else
None
...
...
@@ -126,6 +127,14 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
add
(
kraken
)
}
centrifugeScript
foreach
{
centrifuge
=>
centrifuge
.
outputDir
=
new
File
(
outputDir
,
"centrifuge"
)
centrifuge
.
fastqR1
=
r1
centrifuge
.
fastqR2
=
r2
centrifuge
.
outputName
=
outputName
add
(
centrifuge
)
}
qiimeRatx
foreach
{
qiimeRatx
=>
qiimeRatx
.
outputDir
=
new
File
(
outputDir
,
"qiime_rtax"
)
qiimeRatx
.
fastqR1
=
r1
...
...
gears/src/test/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsSingleTest.scala
View file @
0358aae4
...
...
@@ -17,6 +17,8 @@ package nl.lumc.sasc.biopet.pipelines.gears
import
java.io.File
import
com.google.common.io.Files
import
nl.lumc.sasc.biopet.core.BiopetPipe
import
nl.lumc.sasc.biopet.extensions.centrifuge.
{
Centrifuge
,
CentrifugeKreport
}
import
nl.lumc.sasc.biopet.extensions.kraken.
{
Kraken
,
KrakenReport
}
import
nl.lumc.sasc.biopet.extensions.picard.SamToFastq
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsView
...
...
@@ -49,6 +51,7 @@ abstract class TestGearsSingle extends TestNGSuite with Matchers {
def
paired
:
Boolean
=
false
def
hasOutputName
:
Boolean
=
false
def
kraken
:
Option
[
Boolean
]
=
None
def
centrifuge
:
Boolean
=
false
def
qiimeClosed
:
Boolean
=
false
def
qiimeOpen
:
Boolean
=
false
def
qiimeRtax
:
Boolean
=
false
...
...
@@ -61,6 +64,7 @@ abstract class TestGearsSingle extends TestNGSuite with Matchers {
def
testGears
()
:
Unit
=
{
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"gears_use_qiime_rtax"
->
qiimeRtax
,
"gears_use_centrifuge"
->
centrifuge
,
"gears_use_qiime_closed"
->
qiimeClosed
,
"gears_use_qiime_open"
->
qiimeOpen
,
"gears_use_seq_count"
->
seqCount
,
...
...
@@ -102,12 +106,15 @@ abstract class TestGearsSingle extends TestNGSuite with Matchers {
gears
.
outputName
shouldBe
(
if
(
inputMode
==
Some
(
"bam"
))
"bamfile"
else
"R1"
)