From 3427e4e1654497ea7f4a8ef5a97a8c59e06a9895 Mon Sep 17 00:00:00 2001 From: Peter van 't Hof <p.j.van_t_hof@lumc.nl> Date: Wed, 27 Jan 2016 11:55:50 +0100 Subject: [PATCH] Code improvement --- .../pipelines/mapping/MultisampleMappingReport.scala | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingReport.scala b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingReport.scala index 23338c4d1..4207bf0a3 100644 --- a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingReport.scala +++ b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/MultisampleMappingReport.scala @@ -29,8 +29,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { val wgsExecuted = summary.getSampleValues("bammetrics", "stats", "wgs").values.exists(_.isDefined) val rnaExecuted = summary.getSampleValues("bammetrics", "stats", "rna").values.exists(_.isDefined) val flexiprepExecuted = summary.getLibraryValues("flexiprep") - .filter(_._2.isDefined) - .nonEmpty + .exists { case ((sample, lib), value) => value.isDefined } ReportPage( List("Samples" -> generateSamplesPage(pageArgs)) ++ @@ -67,8 +66,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { /** Files page, can be used general or at sample level */ def filesPage: ReportPage = { val flexiprepExecuted = summary.getLibraryValues("flexiprep") - .filter(_._2.isDefined) - .nonEmpty + .exists { case ((sample, lib), value) => value.isDefined } ReportPage(List(), (if (flexiprepExecuted) List( "Input fastq files" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepInputfiles.ssp"), @@ -82,9 +80,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { /** Single sample page */ def samplePage(sampleId: String, args: Map[String, Any]): ReportPage = { val flexiprepExecuted = summary.getLibraryValues("flexiprep") - .filter(_._1._1 == sampleId) - .filter(_._2.isDefined) - .nonEmpty + .exists { case ((sample, lib), value) => sample == sampleId && value.isDefined } ReportPage(List( "Libraries" -> generateLibraryPage(args), @@ -103,6 +99,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { /** Library page */ def libraryPage(sampleId: String, libId: String, args: Map[String, Any]): ReportPage = { val flexiprepExecuted = summary.getValue(Some(sampleId), Some(libId), "flexiprep").isDefined + ReportPage( ("Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId))) :: (if (flexiprepExecuted) List("QC" -> FlexiprepReport.flexiprepPage) else Nil), -- GitLab