Commit 0f4f1881 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Bugfix in KrakenReportToJson, include Root and Unclassified in any case.

parent 3ded0090
...@@ -19,13 +19,13 @@ package nl.lumc.sasc.biopet.tools ...@@ -19,13 +19,13 @@ package nl.lumc.sasc.biopet.tools
* Created by wyleung on 25-9-15. * Created by wyleung on 25-9-15.
*/ */
import java.io.{ PrintWriter, File } import java.io.{File, PrintWriter}
import nl.lumc.sasc.biopet.utils.ConfigUtils._ import nl.lumc.sasc.biopet.utils.ConfigUtils._
import nl.lumc.sasc.biopet.utils.ToolCommand import nl.lumc.sasc.biopet.utils.ToolCommand
import scala.collection.mutable.ListBuffer
import scala.collection.mutable
import scala.collection.mutable
import scala.collection.mutable.ListBuffer
import scala.io.Source import scala.io.Source
case class KrakenHit(taxonomyID: Long, case class KrakenHit(taxonomyID: Long,
...@@ -120,7 +120,6 @@ object KrakenReportToJson extends ToolCommand { ...@@ -120,7 +120,6 @@ object KrakenReportToJson extends ToolCommand {
def reportToJson(reportRaw: File, skipNames: Boolean): String = { def reportToJson(reportRaw: File, skipNames: Boolean): String = {
val reader = Source.fromFile(reportRaw) val reader = Source.fromFile(reportRaw)
// val lines = reader.getLines().toList.filter(!_.isEmpty)
/* /*
* http://ccb.jhu.edu/software/kraken/MANUAL.html * http://ccb.jhu.edu/software/kraken/MANUAL.html
...@@ -135,7 +134,7 @@ object KrakenReportToJson extends ToolCommand { ...@@ -135,7 +134,7 @@ object KrakenReportToJson extends ToolCommand {
lines = reader.getLines() lines = reader.getLines()
.map(line => parseLine(line, skipNames)) .map(line => parseLine(line, skipNames))
.filter(p => p.head._2.cladeSize > 0) .filter(p => (p.head._2.cladeSize > 0) || List(0L, 1L).contains(p.head._2.taxonomyID))
.foldLeft(Map.empty[Long, KrakenHit])((a, b) => { .foldLeft(Map.empty[Long, KrakenHit])((a, b) => {
a + b.head a + b.head
}) })
......
...@@ -17,10 +17,10 @@ package nl.lumc.sasc.biopet.pipelines.gears ...@@ -17,10 +17,10 @@ package nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.core.PipelineCommand import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.core.summary.SummaryQScript import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.extensions.kraken.{ Kraken, KrakenReport } import nl.lumc.sasc.biopet.extensions.kraken.{Kraken, KrakenReport}
import nl.lumc.sasc.biopet.extensions.picard.SamToFastq import nl.lumc.sasc.biopet.extensions.picard.SamToFastq
import nl.lumc.sasc.biopet.extensions.sambamba.SambambaView import nl.lumc.sasc.biopet.extensions.sambamba.SambambaView
import nl.lumc.sasc.biopet.extensions.tools.{ FastqSync, KrakenReportToJson } import nl.lumc.sasc.biopet.extensions.tools.{FastqSync, KrakenReportToJson}
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
...@@ -44,8 +44,8 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -44,8 +44,8 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
/** Executed before running the script */ /** Executed before running the script */
def init(): Unit = { def init(): Unit = {
require(fastqR1.isDefined || bamFile.isDefined, "Must define fastq file(s) or a bam file") require(fastqR1.isDefined || bamFile.isDefined, "Please specify fastq-file(s) or bam file")
require(fastqR1.isDefined != bamFile.isDefined, "Can't define a bam file and a R1 file") require(fastqR1.isDefined != bamFile.isDefined, "Provide either a bam file or la R1 file")
if (outputName == null) { if (outputName == null) {
if (fastqR1.isDefined) outputName = fastqR1.map(_.getName if (fastqR1.isDefined) outputName = fastqR1.map(_.getName
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment