flexiprepFastQcPlot.ssp 3.32 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
2
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
Peter van 't Hof's avatar
Peter van 't Hof committed
3
4
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
5
6
7
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
Peter van 't Hof's avatar
Peter van 't Hof committed
8
9
10
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(org.apache.commons.io.FileUtils)
#import(java.io.File)
Peter van 't Hof's avatar
Peter van 't Hof committed
11
#import(nl.lumc.sasc.biopet.core.report.ReportBuilder.ec)
12
13
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
Peter van 't Hof's avatar
Peter van 't Hof committed
14
<%@ var run: Run %>
15
16
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
Peter van 't Hof's avatar
Peter van 't Hof committed
17
18
19
<%@ var plot: String %>
<%@ var outputDir: File %>
#{
Peter van 't Hof's avatar
Peter van 't Hof committed
20
    val settings = summary.getSettingKeys(runId, "flexiprep", NoModule, SampleId(sampleId.get), LibraryId(libId.get), keyValues = Map(
21
    "skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
Peter van 't Hof's avatar
Peter van 't Hof committed
22
    val run = Await.result(summary.getRuns(runId = Some(runId)).map(_.head), Duration.Inf)
23
24
25
26

    val paired: Boolean = settings("paired") == Some(true)
    val skipClip: Boolean = settings("skip_clip") == Some(true)
    val skipTrim: Boolean = settings("skip_trim") == Some(true)
Peter van 't Hof's avatar
Peter van 't Hof committed
27
28

    def getPlot(read:String) = {
Peter van 't Hof's avatar
Peter van 't Hof committed
29
        val file = Await.result(summary.getFile(runId, "flexiprep", read, SampleId(sampleId.get), LibraryId(libId.get), plot), Duration.Inf)
30
        file.collect {
31
            case path => {
Peter van 't Hof's avatar
Peter van 't Hof committed
32
                val file = new File(run.outputDir + File.separator + path.path.toString)
Peter van 't Hof's avatar
Peter van 't Hof committed
33
                val newFile = new File(outputDir, read + "_" + file.getName)
34
                if (file.exists()) FileUtils.copyFile(file, newFile)
Peter van 't Hof's avatar
Peter van 't Hof committed
35
36
37
38
                newFile.getName
            }
        }
    }
39
40

    def plotAvailable(read:String) = {
Peter van 't Hof's avatar
Peter van 't Hof committed
41
        val file = Await.result(summary.getFile(runId, "flexiprep", read, SampleId(sampleId.get), LibraryId(libId.get), plot), Duration.Inf)
Peter van 't Hof's avatar
Peter van 't Hof committed
42
        file.map(x => new File(run.outputDir + File.separator + x.path).exists()).getOrElse(false)
43
44
    }

Peter van 't Hof's avatar
Peter van 't Hof committed
45
46
}#

Peter van 't Hof's avatar
Peter van 't Hof committed
47
48
49
50
51
52
53
<div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-5"><b>Before QC</b></div>
    #if (!skipTrim || !skipClip) <div class="col-md-5"><b>After QC</b></div> #end
</div>
<div class="row">
    <div class="col-md-1"><b>R1</b></div>
54
    <div class="col-md-5">
55
    #if (plotAvailable( "fastqc_R1" ))
56
        <img class="img-responsive" src="${getPlot("fastqc_R1")}" />
57
58
59
    #else
        Image was not generated by FastQC
    #end
60
    </div>
Peter van 't Hof's avatar
Peter van 't Hof committed
61
62
    #if (!skipTrim || !skipClip)
    <div class="col-md-5">
63
    #if (plotAvailable( "fastqc_R1_qc" ))
64
        <img class="img-responsive" src="${getPlot("fastqc_R1_qc")}" />
65
66
67
    #else
        Image was not generated by FastQC
    #end
Peter van 't Hof's avatar
Peter van 't Hof committed
68
69
70
    </div>
     #end
</div>
Peter van 't Hof's avatar
Peter van 't Hof committed
71
#if (paired)
Peter van 't Hof's avatar
Peter van 't Hof committed
72
73
    <div class="row">
        <div class="col-md-1"><b>R2</b></div>
74
        <div class="col-md-5">
75
        #if (plotAvailable( "fastqc_R2" ))
76
            <img class="img-responsive" src="${getPlot("fastqc_R2")}" />
77
78
79
        #else
            Image was not generated by FastQC
        #end
80
        </div>
Peter van 't Hof's avatar
Peter van 't Hof committed
81
82
        #if (!skipTrim || !skipClip)
        <div class="col-md-5">
83
        #if (plotAvailable( "fastqc_R2_qc" ))
84
            <img class="img-responsive" src="${getPlot("fastqc_R2_qc")}" />
85
86
87
        #else
            Image was not generated by FastQC
        #end
Peter van 't Hof's avatar
Peter van 't Hof committed
88
89
90
        </div>
         #end
    </div>
Peter van 't Hof's avatar
Peter van 't Hof committed
91
#end