Commit 1579a88b authored by Peter van 't Hof's avatar Peter van 't Hof

Split methods

parent 30633108
......@@ -77,7 +77,7 @@ object BamStats extends ToolCommand {
}
/**
* This is the main running function of [[BamStats]]. This will start the thereads and collect and write the results.
* This is the main running function of [[BamStats]]. This will start the threads and collect and write the results.
*
* @param outputDir All output files will be placed here
* @param bamFile Input bam file
......
......@@ -17,7 +17,8 @@ case class Stats(flagstat: FlagstatCollector = new FlagstatCollector(),
_3_ClippingHistogram: Histogram[Int] = new Histogram[Int]()) {
flagstat.loadDefaultFunctions()
flagstat.loadAditionalFunctions(1, 0)
flagstat.loadQualityFunctions(1, 0)
flagstat.loadOrientationFunctions
/** This will add an other [[Stats]] inside `this` */
def +=(other: Stats): Stats = {
......
......@@ -62,7 +62,7 @@ object BiopetFlagstat extends ToolCommand {
val flagstatCollector = new FlagstatCollector
flagstatCollector.loadDefaultFunctions()
flagstatCollector.loadAditionalFunctions()
flagstatCollector.loadQualityFunctions()
logger.info("Start reading file: " + commandArgs.inputFile)
for (record <- iterSam) {
......
......@@ -40,9 +40,21 @@ class FlagstatCollector {
addFunction("SecondaryOrSupplementary", record => record.isSecondaryOrSupplementary)
}
def loadAditionalFunctions(m: Int = 10, max: Int = 60): Unit = {
/**
* The method will aditional checks based on mapping quality of the sam records.
*
* @param m steps of qaulity
* @param max maximum quality
*/
def loadQualityFunctions(m: Int = 10, max: Int = 60): Unit = {
for (t <- 0 to (max / m))
this.addFunction("MAPQ>" + (t * m), record => record.getMappingQuality > (t * m))
}
/**
* This method will add functions to check orientation, for this a combination of flags and read positions are used.
*/
def loadOrientationFunctions = {
this.addFunction("First normal, second read inverted (paired end orientation)", record => {
if (record.getReadPairedFlag &&
record.getReferenceIndex == record.getMateReferenceIndex && record.getReadNegativeStrandFlag != record.getMateNegativeStrandFlag &&
......
Markdown is supported
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