Stats.scala 1.34 KB
Newer Older
1
2
3
4
5
package nl.lumc.sasc.biopet.tools.bamstats

/**
 * Created by pjvanthof on 05/07/16.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
6
7
8
9
10
11
12
13
14
15
case class Stats(var totalReads: Long = 0L,
                 var unmapped: Long = 0L,
                 var secondary: Long = 0L,
                 mappingQualityHistogram: Histogram[Int] = new Histogram[Int](),
                 insertSizeHistogram: Histogram[Int] = new Histogram[Int](),
                 clippingHistogram: Histogram[Int] = new Histogram[Int](),
                 leftClippingHistogram: Histogram[Int] = new Histogram[Int](),
                 rightClippingHistogram: Histogram[Int] = new Histogram[Int](),
                 _5_ClippingHistogram: Histogram[Int] = new Histogram[Int](),
                 _3_ClippingHistogram: Histogram[Int] = new Histogram[Int]()) {
16

Peter van 't Hof's avatar
Peter van 't Hof committed
17
  /** This will add an other [[Stats]] inside `this` */
Peter van 't Hof's avatar
Peter van 't Hof committed
18
  def +=(other: Stats): Stats = {
19
    this.totalReads += other.totalReads
20
    this.unmapped += other.unmapped
Peter van 't Hof's avatar
Peter van 't Hof committed
21
22
    this.mappingQualityHistogram += other.mappingQualityHistogram
    this.insertSizeHistogram += other.insertSizeHistogram
Peter van 't Hof's avatar
Peter van 't Hof committed
23
24
25
26
27
    this.clippingHistogram += other.clippingHistogram
    this.leftClippingHistogram += other.leftClippingHistogram
    this.rightClippingHistogram += other.rightClippingHistogram
    this._5_ClippingHistogram += other._5_ClippingHistogram
    this._3_ClippingHistogram += other._3_ClippingHistogram
28
29
30
    this
  }
}