From ae94babe64fc8b3390aef505c914757135a8f623 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Mon, 29 Jun 2015 15:12:27 +0200
Subject: [PATCH] Added scala docs

---
 .../sasc/biopet/core/summary/Summary.scala    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/Summary.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/Summary.scala
index 662ec7048..d1ebec6bc 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/Summary.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/Summary.scala
@@ -10,6 +10,7 @@ import nl.lumc.sasc.biopet.utils.ConfigUtils
 class Summary(file: File) {
   val map = ConfigUtils.fileToConfigMap(file)
 
+  /** List of all samples in the summary */
   lazy val samples: Set[String] = {
     ConfigUtils.getValueFromPath(map, List("samples")) match {
       case Some(samples) => ConfigUtils.any2map(samples).keySet
@@ -17,6 +18,7 @@ class Summary(file: File) {
     }
   }
 
+  /** List of all libraries for each sample */
   lazy val libraries: Map[String, Set[String]] = {
     (for (sample <- samples) yield sample -> {
       ConfigUtils.getValueFromPath(map, List("samples", sample, "libraries")) match {
@@ -26,26 +28,33 @@ class Summary(file: File) {
     }).toMap
   }
 
+  /** getValue from on given nested path */
   def getValue(path: String*): Option[Any] = {
     ConfigUtils.getValueFromPath(map, path.toList)
   }
 
+  /** getValue from on given nested path with prefix "samples" -> [sampleId] */
   def getSampleValue(sampleId: String, path: String*): Option[Any] = {
     ConfigUtils.getValueFromPath(map, "samples" :: sampleId :: path.toList)
   }
 
+  /** Get values for all samples on given path with prefix "samples" -> [sampleId] */
   def getSampleValues(path: String*): Map[String, Option[Any]] = {
     (for (sample <- samples) yield sample -> getSampleValue(sample, path: _*)).toMap
   }
 
+  /** Executes given function for each sample */
   def getSampleValues(function: (Summary, String) => Option[Any]): Map[String, Option[Any]] = {
     (for (sample <- samples) yield sample -> function(this, sample)).toMap
   }
 
+  /** Get value on nested path with prefix "samples" -> [sampleId] -> "libraries" -> [libId] */
   def getLibraryValue(sampleId: String, libId: String, path: String*): Option[Any] = {
     ConfigUtils.getValueFromPath(map, "samples" :: sampleId :: "libraries" :: libId :: path.toList)
   }
 
+  //TODO: rename method
+  /** Get value on nested path with prefix depending is sampleId and/or libId is None or not */
   def getLibraryValue(sampleId: Option[String], libId: Option[String], path: String*): Option[Any] = {
     (sampleId, libId) match {
       case (Some(sample), Some(lib)) => getLibraryValue(sample, lib, path: _*)
@@ -54,12 +63,22 @@ class Summary(file: File) {
     }
   }
 
+  /**
+   * Get values for all libraries on a given path
+   * @param path path to of value
+   * @return (sampleId, libId) -> value
+   */
   def getLibraryValues(path: String*): Map[(String, String), Option[Any]] = {
     (for (sample <- samples; lib <- libraries.getOrElse(sample, Set())) yield {
       (sample, lib) -> getLibraryValue(sample, lib, path: _*)
     }).toMap
   }
 
+  /**
+   * Executes method for each library
+   * @param function Function to execute
+   * @return (sampleId, libId) -> value
+   */
   def getLibraryValues(function: (Summary, String, String) => Option[Any]): Map[(String, String), Option[Any]] = {
     (for (sample <- samples; lib <- libraries.getOrElse(sample, Set())) yield {
       (sample, lib) -> function(this, sample, lib)
-- 
GitLab