Commit f73038d3 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added getFoundAdapters method

parent 06536548
......@@ -13,11 +13,6 @@
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.lumc.sasc.biopet.pipelines.flexiprep
......@@ -52,6 +47,30 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
return null // Could be default Sanger with a warning in the log
}
protected case class Sequence(name: String, seq: String)
def getFoundAdapters: List[Sequence] = {
def getSeqs(file: File) = {
if (file != null) {
(for (
line <- Source.fromFile(file).getLines() if line.startsWith("#");
values = line.split("\t") if values.size >= 2
) yield Sequence(values(0), values(1))).toList
} else Nil
}
val seqs = getSeqs(adapters) ::: getSeqs(contaminants)
val block = getDataBlock("Overrepresented sequences")
if (block == null) return Nil
val found = for (
line <- block if !line.startsWith("#");
values = line.split("\t") if values.size >= 4
) yield values(3)
seqs.filter(x => found.exists(_.startsWith(x.name)))
}
def getSummary: Json = {
val subfixs = Map("plot_duplication_levels" -> "Images/duplication_levels.png",
"plot_kmer_profiles" -> "Images/kmer_profiles.png",
......
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