flexiprepFastQcPlot.ssp 2.97 KB
Newer Older
1
2
3
4
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#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
5
6
7
#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
8
9
#import(scalaz._)
#import(Scalaz._)
10
11
12
13
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
Peter van 't Hof's avatar
Peter van 't Hof committed
14
15
16
<%@ var plot: String %>
<%@ var outputDir: File %>
#{
Peter van 't Hof's avatar
Peter van 't Hof committed
17
    val settings = summary.getSettingKeys(runId, "flexiprep".right, None, sampleId.map(_.left), libId.map(_.left), keyValues = Map(
18
19
20
21
22
    "skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))

    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
23
24

    def getPlot(read:String) = {
Peter van 't Hof's avatar
Peter van 't Hof committed
25
        val file = Await.result(summary.getFile(runId, "flexiprep".right, Some(read.right), sampleId.map(_.left), libId.map(_.left), plot), Duration.Inf)
26
        file.collect {
27
            case path => {
28
                val file = new File(path.path.toString)
Peter van 't Hof's avatar
Peter van 't Hof committed
29
                val newFile = new File(outputDir, read + "_" + file.getName)
30
                if (file.exists()) FileUtils.copyFile(file, newFile)
Peter van 't Hof's avatar
Peter van 't Hof committed
31
32
33
34
                newFile.getName
            }
        }
    }
35
36

    def plotAvailable(read:String) = {
Peter van 't Hof's avatar
Peter van 't Hof committed
37
        val file = Await.result(summary.getFile(runId, "flexiprep".right, Some(read.right), sampleId.map(_.left), libId.map(_.left), plot), Duration.Inf)
38
        file.map(x => new File(x.path).exists()).getOrElse(false)
39
40
    }

Peter van 't Hof's avatar
Peter van 't Hof committed
41
42
}#

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