Commit 884091eb authored by Peter van 't Hof's avatar Peter van 't Hof

Changed custom adapters feeding

parent d4934ea6
......@@ -29,7 +29,15 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
class Cutadapt(root: Configurable, fastqc: Fastqc) extends nl.lumc.sasc.biopet.extensions.Cutadapt(root) {
val ignoreFastqcAdapters: Boolean = config("ignore_fastqc_adapters", default = false)
val customAdaptersConfig: Map[String, Any] = config("custom_adapters", default = Map.empty)
val customAdaptersEnd: Map[String, Any] = config("custom_adapters_end", default = Map())
adapter ++= customAdaptersEnd.values.map(_.toString)
val customAdaptersFront: Map[String, Any] = config("custom_adapters_front", default = Map())
front ++= customAdaptersEnd.values.map(_.toString)
val customAdaptersAny: Map[String, Any] = config("custom_adapters_any", default = Map())
anywhere ++= customAdaptersEnd.values.map(_.toString)
/** Clipped adapter names from FastQC */
protected def seqToName: Map[String, String] = {
......@@ -42,7 +50,7 @@ class Cutadapt(root: Configurable, fastqc: Fastqc) extends nl.lumc.sasc.biopet.e
}
def customAdapters: Set[AdapterSequence] = {
customAdaptersConfig.flatMap(adapter => {
(customAdaptersEnd ++ customAdaptersFront ++ customAdaptersAny).flatMap(adapter => {
adapter match {
case (adapterName: String, sequence: String) =>
Some(AdapterSequence(adapterName, sequence))
......
......@@ -103,13 +103,11 @@ class QcCommand(val root: Configurable, val fastqc: Fastqc) extends BiopetComman
clip = if (!flexiprep.skipClip) {
val cutadapt = clip.getOrElse(new Cutadapt(root, fastqc))
val foundAdapters = if (!cutadapt.ignoreFastqcAdapters) {
fastqc.foundAdapters.map(_.seq) ++ cutadapt.customAdapters.map(_.seq)
} else {
cutadapt.customAdapters.map(_.seq)
}
val foundAdapters: Set[String] = if (!cutadapt.ignoreFastqcAdapters) {
fastqc.foundAdapters.map(_.seq)
} else Set()
if (foundAdapters.nonEmpty) {
if (foundAdapters.nonEmpty || cutadapt.adapter.nonEmpty || cutadapt.front.nonEmpty || cutadapt.anywhere.nonEmpty) {
cutadapt.fastqInput = seqtk.output
cutadapt.fastqOutput = new File(output.getParentFile, input.getName + ".cutadapt.fq")
cutadapt.statsOutput = new File(flexiprep.outputDir, s"${flexiprep.sampleId.getOrElse("x")}-${flexiprep.libId.getOrElse("x")}.$read.clip.stats")
......
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