source: trunk/grails-app/views/assay/show.gsp @ 3

Last change on this file since 3 was 3, checked in by robert@…, 12 years ago

Externalized configuration; improved assay view (detail views of runs and samples); implemented uploading and parsing of FASTA and QUAL files

File size: 5.7 KB
Line 
1<html>
2        <head>
3                <meta name="layout" content="main" />
4                <title>Show assay ${assay.name} | Metagenomics | dbNP</title>
5               
6                <link rel="stylesheet" href="<g:resource dir="css" file="showAssay.css" />" type="text/css"/>
7                <link rel="stylesheet" href="<g:resource dir="css" file="fileuploader.new.css" />" type="text/css"/>
8               
9                <g:javascript src="jquery.ui.tabbeddialog.js" />
10                <g:javascript src="assay.show.addFilesDialog.js" />
11                <g:javascript src="assay.show.enterTagsDialog.js" />
12                <g:javascript src="assay.show.runDialogs.js" />
13                <g:javascript src="assay.show.showSampleDialog.js" />
14                <g:javascript src="assay.show.showRunDialog.js" />
15
16                <g:javascript src="fileuploader.new.js" />
17                <g:javascript src="fileuploads.new.js" />
18               
19                <script>
20                        var assayId = ${assay.id};
21                        var numOtherRuns = ${otherRuns.size()};
22
23                        // Create a variable with assay names to check for existing names
24                        var runNames = [];
25                        <g:each in="${assay.runs + otherRuns}" var="run">
26                                runNames[ runNames.length ] = {id: ${run.id}, name: '${run.name}', alreadyAdded: ${ run.assays.contains( assay ) ? 'true' : 'false' }};
27                        </g:each>
28                       
29                        $(function() {
30                                $('.uploadedFile').each( function( idx, el ) {
31                                        $(el).html( createFileHTML( $(el).text(), 'getPermanent' ) );
32                                });
33                        });
34                </script>
35        </head>
36<body>
37        <h1>
38                ${assay.study.name} - ${assay.name}
39        </h1>
40       
41        <label>Study</label>: <a target="_top" href="${ assay.study.viewUrl() }">${assay.study.name}</a><br />
42        <label>Assay</label>: ${assay.name}<br />
43        <label># samples</label>: ${assay.assaySamples?.size()}<br />
44        <label># sequences</label>: ${assay.numSequences()}<br />
45        <label># files</label>: ${assay.numFiles()}<br />
46
47        <!-- Samples -->
48        <h2>Samples</h2>
49        <g:if test="${assay.assaySamples == null || assay.assaySamples.size() == 0}">
50                No samples found in assay.
51                <g:if test="${editable}">
52                        Associate samples with this assay in <a target="_top" href="${ assay.study.viewUrl() }">GSCF</a>.
53                </g:if>
54        </g:if>
55        <g:else>
56                <table class="paginate">
57                        <thead>
58                                <tr>
59                                        <th nowrap>name</th>
60                                        <th nowrap>tag sequence</th>
61                                        <th nowrap># sequences</th>
62                                        <th nowrap>avg quality</th>
63                                        <th nowrap># unique sequences</th>
64                                </tr>
65                        </thead>                       
66                        <tbody>
67                                <% def assaySamples = assay.assaySamples.toList().sort { it.sample.name }; %>
68                                <g:each in="${assaySamples}" var="assaySample">
69                                        <tr>
70                                                <td><a href="#" onClick="showSample(${assaySample.id}); return false;">${assaySample.sample.name}</a></td>
71                                                <td>${assaySample.tagSequence}</td>
72                                                <td>${assaySample.numSequences()}</td>
73                                                <td>
74                                                        <g:if test="${assaySample.averageQuality() > 0.0}">
75                                                                <g:formatNumber number="${assaySample.averageQuality()}" format="0.0" />
76                                                        </g:if>
77                                                        <g:else>
78                                                                -
79                                                        </g:else>
80                                                </td>
81                                                <td>
82                                                        <g:if test="${assaySample.numUniqueSequences > 0}">
83                                                                ${assaySample.numUniqueSequences}
84                                                        </g:if>
85                                                        <g:else>
86                                                                -
87                                                        </g:else>
88                                                </td>
89                                        </tr>
90                                </g:each>
91                        </tbody>
92                </table>
93                <g:if test="${editable}">
94                        <input type="button" value="Edit sample data" onClick="showEnterTagsDialog();">
95                        <input type="button" value="Add sequence files" onClick="showAddFilesDialog();" <g:if test="${assay.runs == null || assay.runs.size() == 0}">disabled="disabled"</g:if>>
96                        <g:render template="enterTagsDialog" model="[assay: assay, sortedAssaySamples: assaySamples]" />
97                        <g:render template="addFilesDialog" model="[assay: assay]" />
98                </g:if>
99                <g:render template="showSampleDialog" model="[assay: assay]" />
100        </g:else>       
101
102        <!-- Runs -->
103        <h2>Runs</h2>
104        <g:if test="${assay.runs == null || assay.runs.size() == 0}">
105                No runs found for this assay.
106        </g:if>
107        <g:else>
108                <table class="paginate">
109                        <thead>
110                                <tr>
111                                        <th nowrap>name</th>
112                                        <th nowrap>date</th>
113                                        <th nowrap>supplier</th>
114                                        <th nowrap>machine</th>
115                                        <th nowrap>parameter file</th>
116                                        <th nowrap>other assays</th>
117                                        <th class="nonsortable"></th>
118                                        <th class="nonsortable"></th>
119                                </tr>
120                        </thead>                       
121                        <tbody>
122                                <% def runs = assay.runs.toList().sort { it.name }; %>
123                                <g:each in="${runs}" var="run">
124                                        <tr>
125                                                <td><a href="#" onClick="showRun(${run.id}); return false;">${run.name}</a></td>
126                                                <td><g:formatDate format="dd-MM-yyyy" date="${run.date}"/></td>
127                                                <td>${run.supplier}</td>
128                                                <td>${run.machine}</td>
129                                                <td><g:uploadedFile value="${run.parameterFile}"/></td>
130                                                <td>
131                                                        <g:if test="${run.assays?.size() == 1}">
132                                                                <% /* If only 1 assay is found, then it is the current one */ %>
133                                                                -
134                                                        </g:if>
135                                                        <g:else>
136                                                                <g:each in="${run.assays - assay}" var="otherAssay">
137                                                                        <g:link action="show" id="${otherAssay.id}">${otherAssay.name}</g:link><br />
138                                                                </g:each>
139                                                        </g:else>
140                                                </td>
141                                                <td class="button"><a href="#" onClick="showEditRunDialog( ${run.id}, '${run.name?.encodeAsJavaScript()}', '${run.date ? run.date.format( 'yyyy-mm-dd' ).encodeAsJavaScript() : ''}', '${run.machine?.encodeAsJavaScript()}', '${run.supplier?.encodeAsJavaScript()}', '${run.parameterFile?.encodeAsJavaScript()}' ); return false;"><img src="${fam.icon(name: 'application_edit')}" /></a></td>
142                                                <td class="button"><g:link onClick="return confirm( 'Are you sure you want to remove the selected run from this assay?' );" controller="assay" action="removeRun" id="${assay.id}" params="${[run_id: run.id]}" ><img src="${fam.icon(name: 'application_delete')}" /></g:link></td>
143                                        </tr>
144                                </g:each>
145                        </tbody>
146                </table>
147        </g:else>
148        <g:if test="${editable}">
149                <input type="button" value="Add run" onClick="showAddRunDialog();">
150                <g:render template="addRunDialog" model="[assay: assay]" />
151                <g:render template="editRunDialog" model="[assay: assay]" />
152        </g:if>
153        <g:render template="showRunDialog" model="[assay: assay]" />
154       
155</body>
156</html>
Note: See TracBrowser for help on using the repository browser.