Commit 10518502 authored by bow's avatar bow
Browse files

Documentation updates

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