Skip to content
Snippets Groups Projects
Commit 81e0124f authored by bow's avatar bow
Browse files

Merge branch 'develop' into feature-gentrap

parents f1441306 6b6fa613
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -53,7 +53,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
(for (f <- qscript.functions if f.isInstanceOf[BiopetCommandLineFunctionTrait]) yield { (for (f <- qscript.functions if f.isInstanceOf[BiopetCommandLineFunctionTrait]) yield {
f match { f match {
case f: BiopetCommandLineFunctionTrait => { case f: BiopetCommandLineFunctionTrait => {
f.configName -> Map("version" -> f.getVersion, f.configName -> Map("version" -> f.getVersion.getOrElse(None),
"md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None)) "md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None))
} }
case _ => throw new IllegalStateException("This should not be possible") case _ => throw new IllegalStateException("This should not be possible")
......
...@@ -164,14 +164,11 @@ object Seqstat extends ToolCommand { ...@@ -164,14 +164,11 @@ object Seqstat extends ToolCommand {
case class ReadStat(qual: mutable.ArrayBuffer[Long] = mutable.ArrayBuffer(), case class ReadStat(qual: mutable.ArrayBuffer[Long] = mutable.ArrayBuffer(),
nuc: mutable.ArrayBuffer[Long] = mutable.ArrayBuffer.fill('T'.toInt + 1)(0), nuc: mutable.ArrayBuffer[Long] = mutable.ArrayBuffer.fill('T'.toInt + 1)(0),
var withN: Long, var withN: Long = 0L,
lengths: mutable.ArrayBuffer[Int] = mutable.ArrayBuffer()) lengths: mutable.ArrayBuffer[Int] = mutable.ArrayBuffer())
val baseStats: mutable.ArrayBuffer[BaseStat] = mutable.ArrayBuffer() val baseStats: mutable.ArrayBuffer[BaseStat] = mutable.ArrayBuffer()
val readStats: ReadStat = new ReadStat(mutable.ArrayBuffer(), val readStats: ReadStat = new ReadStat()
mutable.ArrayBuffer.fill('T'.toInt + 1)(0),
0L,
mutable.ArrayBuffer())
/** /**
* Compute the quality metric per read * Compute the quality metric per read
...@@ -194,6 +191,9 @@ object Seqstat extends ToolCommand { ...@@ -194,6 +191,9 @@ object Seqstat extends ToolCommand {
val readQual = record.getBaseQualityString val readQual = record.getBaseQualityString
val readNucleotides = record.getReadString val readNucleotides = record.getReadString
if (record.length >= readStats.lengths.size) // Extends array when length not yet possible
(0 to (record.length - readStats.lengths.size)).foreach(_ => readStats.lengths.append(0))
readStats.lengths(record.length) += 1 readStats.lengths(record.length) += 1
for (t <- 0 until record.length()) { for (t <- 0 until record.length()) {
...@@ -211,10 +211,7 @@ object Seqstat extends ToolCommand { ...@@ -211,10 +211,7 @@ object Seqstat extends ToolCommand {
readStats.qual ++= mutable.ArrayBuffer.fill(avgQual - readStats.qual.length + 1)(0) readStats.qual ++= mutable.ArrayBuffer.fill(avgQual - readStats.qual.length + 1)(0)
} }
readStats.qual(avgQual) += 1 readStats.qual(avgQual) += 1
readStats.withN += { if (readNucleotides.contains("N")) readStats.withN += 1L
if (readNucleotides.contains("N")) 1L
else 0L
}
} }
/** /**
...@@ -278,7 +275,7 @@ object Seqstat extends ToolCommand { ...@@ -278,7 +275,7 @@ object Seqstat extends ToolCommand {
} }
for (pos <- 0 until readStats.qual.length) { for (pos <- 0 until readStats.qual.length) {
var key: Int = pos - phredEncoding.id val key: Int = pos - phredEncoding.id
if (key > 0) { if (key > 0) {
// count till the max of baseHistogram.length // count till the max of baseHistogram.length
for (histokey <- 0 until key + 1) { for (histokey <- 0 until key + 1) {
...@@ -319,7 +316,7 @@ object Seqstat extends ToolCommand { ...@@ -319,7 +316,7 @@ object Seqstat extends ToolCommand {
), ),
("stats", Map( ("stats", Map(
("bases", Map( ("bases", Map(
("num_n", nucleotideHistoMap('N')), ("num_n", nucleotideHistoMap.getOrElse('N', 0)),
("num_total", nucleotideHistoMap.values.sum), ("num_total", nucleotideHistoMap.values.sum),
("num_qual_gte", baseQualHistoMap.toMap), ("num_qual_gte", baseQualHistoMap.toMap),
("nucleotides", nucleotideHistoMap.toMap) ("nucleotides", nucleotideHistoMap.toMap)
...@@ -335,9 +332,6 @@ object Seqstat extends ToolCommand { ...@@ -335,9 +332,6 @@ object Seqstat extends ToolCommand {
)) ))
) )
val jsonReport: Json = { println(ConfigUtils.mapToJson(report).spaces2)
ConfigUtils.mapToJson(report)
}
println(jsonReport.spaces2)
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment