From 105185025d85f2ca3f19c000a7e432ec194a3b19 Mon Sep 17 00:00:00 2001
From: bow <bow@bow.web.id>
Date: Thu, 4 Dec 2014 09:50:49 +0100
Subject: [PATCH] Documentation updates

---
 .../biopet/tools/ExtractAlignedFastq.scala    | 22 ++++++++++++++++++-
 .../nl/lumc/sasc/biopet/tools/WipeReads.scala | 17 +++++---------
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
index e56202dfa..b05591cbf 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
@@ -19,9 +19,10 @@ import nl.lumc.sasc.biopet.core.ToolCommand
 
 object ExtractAlignedFastq extends ToolCommand {
 
+  /** type alias for Fastq input (may or may not be paired) */
   type FastqInput = (FastqRecord, Option[FastqRecord])
 
-  /** function to get FastqRecord ID */
+  /** Get the FastqRecord ID */
   def fastqId(rec: FastqRecord) = rec.getReadHeader.split(" ")(0)
 
   /**
@@ -125,6 +126,13 @@ object ExtractAlignedFastq extends ToolCommand {
     }
   }
 
+  /**
+   * Extracts reads from the given input Fastq file and writes to a new output Fastq file
+   *
+   * @param memFunc Predicate for extracting reads. If evaluates to true, the read is extracted.
+   * @param inputFastq1 Input [[FastqReader]] object.
+   * @param outputFastq1 Output [[BasicFastqWriter]] object.
+   */
   def extractReads(memFunc: FastqInput => Boolean,
                    inputFastq1: FastqReader, outputFastq1: BasicFastqWriter): Unit =
     inputFastq1.iterator.asScala
@@ -132,6 +140,15 @@ object ExtractAlignedFastq extends ToolCommand {
       .filter(rec => memFunc(rec._1, rec._2))
       .foreach(rec => outputFastq1.write(rec._1))
 
+  /**
+   * Extracts reads from the given input Fastq pairs and writes to new output Fastq pair files
+   *
+   * @param memFunc Predicate for extracting reads. If evaluates to true, the read is extracted.
+   * @param inputFastq1 Input [[FastqReader]] object for pair 1.
+   * @param outputFastq1 Input [[FastqReader]] object for pair 2.
+   * @param inputFastq2 Output [[BasicFastqWriter]] object for pair 1.
+   * @param outputFastq2 Output [[BasicFastqWriter]] object for pair 2.
+   */
   def extractReads(memFunc: FastqInput => Boolean,
                    inputFastq1: FastqReader, outputFastq1: BasicFastqWriter,
                    inputFastq2: FastqReader, outputFastq2: BasicFastqWriter): Unit =
@@ -143,6 +160,7 @@ object ExtractAlignedFastq extends ToolCommand {
         outputFastq2.write(rec._2)
       })
 
+  /** Default arguments */
   case class Args(inputBam: File = new File(""),
                   intervals: List[String] = List.empty[String],
                   inputFastq1: File = new File(""),
@@ -152,6 +170,7 @@ object ExtractAlignedFastq extends ToolCommand {
                   minMapQ: Int = 0,
                   commonSuffixLength: Int = 0) extends AbstractArgs
 
+  /** Command line argument parser */
   class OptParser extends AbstractOptParser {
 
     head(
@@ -213,6 +232,7 @@ object ExtractAlignedFastq extends ToolCommand {
     }
   }
 
+  /** Parses the command line argument */
   def parseArgs(args: Array[String]): Args =
     new OptParser()
       .parse(args, Args())
diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala
index 9bfb15686..82014b589 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala
@@ -47,12 +47,7 @@ class WipeReads(val root: Configurable) extends BiopetJavaCommandLineFunction {
 
 object WipeReads extends ToolCommand {
 
-  /**
-   * Creates a SamReader object from an input BAM file, ensuring it is indexed
-   *
-   * @param inBam input BAM file
-   * @return
-   */
+  /** Creates a SamReader object from an input BAM file, ensuring it is indexed */
   private def prepInBam(inBam: File): SamReader = {
     val bam = SamReaderFactory
       .make()
@@ -62,6 +57,7 @@ object WipeReads extends ToolCommand {
     bam
   }
 
+  /** Creates a [[SAMFileWriter]] object for writing, indexed */
   private def prepOutBam(outBam: File, templateBam: File,
                          writeIndex: Boolean = true, async: Boolean = true): SAMFileWriter =
     new SAMFileWriterFactory()
@@ -336,6 +332,7 @@ object WipeReads extends ToolCommand {
     }
   }
 
+  /** Default arguments */
   case class Args(inputBam: File = new File(""),
                   targetRegions: File = new File(""),
                   outputBam: File = new File(""),
@@ -348,6 +345,7 @@ object WipeReads extends ToolCommand {
                   bloomSize: Long = 70000000,
                   bloomFp: Double = 4e-7) extends AbstractArgs
 
+  /** Command line argument parser */
   class OptParser extends AbstractOptParser {
 
     head(
@@ -418,12 +416,7 @@ object WipeReads extends ToolCommand {
 
   }
 
-  /**
-   * Parses the command line argument
-   *
-   * @param args Array of arguments
-   * @return
-   */
+  /** Parses the command line argument */
   def parseArgs(args: Array[String]): Args = new OptParser()
     .parse(args, Args())
     .getOrElse(sys.exit(1))
-- 
GitLab