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

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

Implemented basic exporting functionality

File size: 5.9 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.enterTagsDialog.js" />
11                <g:javascript src="assay.show.runDialogs.js" />
12                <g:javascript src="assay.show.showRunDialog.js" />
13
14                <g:javascript src="showSampleDialogUniversal.js" />
15                <g:javascript src="addFilesDialog.js" />
16
17                <g:javascript src="fileuploader.new.js" />
18                <g:javascript src="fileuploads.new.js" />
19               
20                <script>
21                        var assayId = ${assay.id};
22                        var numOtherRuns = ${otherRuns.size()};
23
24                        // Create a variable with assay names to check for existing names
25                        var runNames = [];
26                        <g:each in="${assay.runs + otherRuns}" var="run">
27                                runNames[ runNames.length ] = {id: ${run.id}, name: '${run.name}', alreadyAdded: ${ run.assays.contains( assay ) ? 'true' : 'false' }};
28                        </g:each>
29                       
30                        function initializeUploadedFiles( selector ) {
31                                if( selector == undefined )
32                                        selector = "";
33                               
34                                $( selector + ' .uploadedFile').each( function( idx, el ) {
35                                        $(el).html( createFileHTML( $(el).text(), 'getPermanent' ) );
36                                });
37                        }
38
39                        // Initializefiles on load
40                        $(function() { initializeUploadedFiles(); });
41                </script>
42        </head>
43<body>
44        <h1>
45                ${assay.study.name} - ${assay.name}
46        </h1>
47       
48        <label>Study</label>: <a target="_top" href="${ assay.study.viewUrl() }">${assay.study.name}</a><br />
49        <label>Assay</label>: ${assay.name}<br />
50        <label># samples</label>: ${assay.assaySamples?.size()}<br />
51        <label># sequences</label>: ${assay.numSequences()}<br />
52        <label># files</label>: ${assay.numFiles()}<br />
53
54        <!-- Samples -->
55        <h2>Samples</h2>
56        <g:if test="${assay.assaySamples == null || assay.assaySamples.size() == 0}">
57                No samples found in assay.
58                <g:if test="${editable}">
59                        Associate samples with this assay in <a target="_top" href="${ assay.study.viewUrl() }">GSCF</a>.
60                </g:if>
61        </g:if>
62        <g:else>
63                <table class="paginate">
64                        <thead>
65                                <tr>
66                                        <th nowrap>name</th>
67                                        <th nowrap>run</th>
68                                        <th nowrap>tag name</th>
69                                        <th nowrap>tag sequence</th>
70                                        <th nowrap># sequences</th>
71                                        <th nowrap># qual</th>
72                                </tr>
73                        </thead>                       
74                        <tbody>
75                                <% def assaySamples = assay.assaySamples.toList().sort { it.sample.name }; %>
76                                <g:each in="${assaySamples}" var="assaySample">
77                                        <tr>
78                                                <td><a href="#" onClick="showSample(${assaySample.id}, 'assay'); return false;">${assaySample.sample.name}</a></td>
79                                                <td>${assaySample.run?.name}</td>
80                                                <td>${assaySample.tagName}</td>
81                                                <td>${assaySample.tagSequence}</td>
82                                                <td>
83                                                        <g:if test="${assaySample.numSequenceFiles() > 0}">
84                                                                ${assaySample.numSequences()}
85                                                        </g:if>
86                                                        <g:else>
87                                                                -
88                                                        </g:else>
89                                                </td>
90                                                <td>
91                                                        <g:if test="${assaySample.numQualityFiles() > 0}">
92                                                                ${assaySample.numQualScores()}
93                                                        </g:if>
94                                                        <g:else>
95                                                                -
96                                                        </g:else>
97                                                </td>
98                                        </tr>
99                                </g:each>
100                        </tbody>
101                </table>
102                <g:if test="${editable}">
103                        <input type="button" value="Edit sample data" onClick="showEnterTagsDialog();">
104                        <input type="button" value="Add sequence files" onClick="showAddFilesDialog();" <g:if test="${assay.runs == null || assay.runs.size() == 0}">disabled="disabled"</g:if>>
105                        <g:render template="enterTagsDialog" model="[assay: assay, sortedAssaySamples: assaySamples]" />
106                        <g:render template="addFilesDialog" model="[assay: assay]" />
107                </g:if>
108                <div id="showSampleDialog" class="dialog"></div>
109        </g:else>       
110
111        <!-- Runs -->
112        <h2>Runs</h2>
113        <g:if test="${assay.runs == null || assay.runs.size() == 0}">
114                No runs found for this assay.
115        </g:if>
116        <g:else>
117                <table class="paginate">
118                        <thead>
119                                <tr>
120                                        <th nowrap>name</th>
121                                        <th nowrap>date</th>
122                                        <th nowrap>supplier</th>
123                                        <th nowrap>machine</th>
124                                        <th nowrap>parameter file</th>
125                                        <th nowrap>other assays</th>
126                                        <th class="nonsortable"></th>
127                                        <th class="nonsortable"></th>
128                                </tr>
129                        </thead>                       
130                        <tbody>
131                                <% def runs = assay.runs.toList().sort { it.name }; %>
132                                <g:each in="${runs}" var="run">
133                                        <tr>
134                                                <td><g:link controller="run" action="show" id="${run.id}">${run.name}</g:link></td>
135                                                <td><g:formatDate format="dd-MM-yyyy" date="${run.date}"/></td>
136                                                <td>${run.supplier}</td>
137                                                <td>${run.machine}</td>
138                                                <td><g:uploadedFile value="${run.parameterFile}"/></td>
139                                                <td>
140                                                        <g:if test="${run.assays?.size() == 1}">
141                                                                <% /* If only 1 assay is found, then it is the current one */ %>
142                                                                -
143                                                        </g:if>
144                                                        <g:else>
145                                                                <g:each in="${run.assays - assay}" var="otherAssay">
146                                                                        <g:link action="show" id="${otherAssay.id}">${otherAssay.name}</g:link><br />
147                                                                </g:each>
148                                                        </g:else>
149                                                </td>
150                                                <td class="button"><a href="#" onClick="showEditRunDialog( ${run.id} ); return false;"><img src="${fam.icon(name: 'application_edit')}" /></a></td>
151                                                <td class="button">
152                                                        <g:if test="${run.samples(assay.id).size()}">
153                                                                <img src="${fam.icon(name: 'application_delete')}" class="disabled" title="You can't remove this assay because sequences from this assay are coupled to this run." />
154                                                        </g:if>
155                                                        <g:else>
156                                                                <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>
157                                                        </g:else>
158                                                </td>
159                                        </tr>
160                                </g:each>
161                        </tbody>
162                </table>
163        </g:else>
164        <g:if test="${editable}">
165                <input type="button" value="Add run" onClick="showAddRunDialog();">
166                <g:render template="addRunDialog" model="[assay: assay]" />
167                <div id="editRunDialog" class="dialog"></div>
168        </g:if>
169        <div id="showRunDialog" class="dialog"></div>
170</body>
171</html>
Note: See TracBrowser for help on using the repository browser.