Commit 4945f3ce authored by bow's avatar bow
Browse files

Store adapter stats name in a single variable

parent 9bdd6fdd
......@@ -43,6 +43,9 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
def versionCommand = executable + " --version"
def versionRegex = """(.*)""".r
/** Name of the key containing clipped adapters information in the summary stats. */
def adaptersStatsName = "adapters"
var default_clip_mode: String = config("default_clip_mode", default = "3")
var opt_adapter: Set[String] = config("adapter", default = Nil)
var opt_anywhere: Set[String] = config("anywhere", default = Nil)
......@@ -89,7 +92,7 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction with Su
Map("num_reads_affected" -> stats("trimmed"),
"num_reads_discarded_too_short" -> stats("tooshort"),
"num_reads_discarded_too_long" -> stats("toolong"),
"adapters" -> adapter_stats.toMap
adaptersStatsName -> adapter_stats.toMap
)
}
......
......@@ -36,7 +36,7 @@ class Cutadapt(root: Configurable, fastqc: Fastqc) extends nl.lumc.sasc.biopet.e
override def summaryStats: Map[String, Any] = {
val initStats = super.summaryStats
// Map of adapter sequence and how many times it is found
val adapterCounts: Map[String, Map[String, Any]] = initStats.get("adapters") match {
val adapterCounts: Map[String, Map[String, Any]] = initStats.get(adaptersStatsName) match {
// "adapters" key found in statistics
case Some(v) => v match {
case m: Map[String, Int] => m.toSeq
......@@ -59,6 +59,6 @@ class Cutadapt(root: Configurable, fastqc: Fastqc) extends nl.lumc.sasc.biopet.e
// "adapters" key not found ~ something went wrong in our part
case _ => throw new RuntimeException(s"Required key 'adapters' not found in stats entry '$fastq_input'.")
}
initStats.updated("adapters", adapterCounts)
initStats.updated(adaptersStatsName, adapterCounts)
}
}
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