1 | <%-- $Id: view_rawdata.jsp 5939 2012-01-30 14:42:18Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg |
---|
4 | Copyright (C) 2007 Nicklas Nordborg |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 3 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page pageEncoding="UTF-8" session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.SystemItems" |
---|
30 | import="net.sf.basedb.core.Item" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.Permission" |
---|
33 | import="net.sf.basedb.core.ExtendedProperties" |
---|
34 | import="net.sf.basedb.core.ExtendedProperty" |
---|
35 | import="net.sf.basedb.core.RawDataProperty" |
---|
36 | import="net.sf.basedb.core.RawBioAssay" |
---|
37 | import="net.sf.basedb.core.RawDataType" |
---|
38 | import="net.sf.basedb.core.ReporterType" |
---|
39 | import="net.sf.basedb.core.Reporter" |
---|
40 | import="net.sf.basedb.core.Feature" |
---|
41 | import="net.sf.basedb.core.Well" |
---|
42 | import="net.sf.basedb.core.Plate" |
---|
43 | import="net.sf.basedb.core.ArrayDesignBlock" |
---|
44 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
45 | import="net.sf.basedb.core.PluginDefinition" |
---|
46 | import="net.sf.basedb.core.data.RawData" |
---|
47 | import="net.sf.basedb.core.data.ReporterData" |
---|
48 | import="net.sf.basedb.core.data.FeatureData" |
---|
49 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
50 | import="net.sf.basedb.core.plugin.Plugin" |
---|
51 | import="net.sf.basedb.clients.web.Base" |
---|
52 | import="net.sf.basedb.clients.web.util.HTML" |
---|
53 | import="net.sf.basedb.util.Values" |
---|
54 | import="net.sf.basedb.util.formatter.Formatter" |
---|
55 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
56 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
57 | import="java.util.Date" |
---|
58 | import="java.util.Map" |
---|
59 | import="java.util.Set" |
---|
60 | import="java.util.List" |
---|
61 | %> |
---|
62 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
63 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
64 | <%! |
---|
65 | private static final Item itemType = Item.RAWDATA; |
---|
66 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
67 | %> |
---|
68 | <% |
---|
69 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
70 | final String ID = sc.getId(); |
---|
71 | final int rawBioAssayId = Values.getInt(request.getParameter("rawbioassay_id")); |
---|
72 | final float scale = Base.getScale(sc); |
---|
73 | final DbControl dc = sc.newDbControl(); |
---|
74 | try |
---|
75 | { |
---|
76 | final RawBioAssay rawBioAssay = RawBioAssay.getById(dc, rawBioAssayId); |
---|
77 | final RawDataType rawDataType = rawBioAssay.getRawDataType(); |
---|
78 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, rawDataType.getId(), null, null); |
---|
79 | final int itemId = cc.getId(); |
---|
80 | final boolean hasSpotImages = rawBioAssay.hasSpotImages(); |
---|
81 | |
---|
82 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
83 | |
---|
84 | final RawData rawData = rawBioAssay.getRawDataById(itemId, true); |
---|
85 | String title = "Raw data of "+HTML.encodeTags(rawBioAssay.getName()) + " at position " + rawData.getPosition(); |
---|
86 | |
---|
87 | final ReporterData reporter = rawData.getReporter(); |
---|
88 | final FeatureData feature = rawData.getFeature(); |
---|
89 | Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
90 | WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true); |
---|
91 | WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false); |
---|
92 | %> |
---|
93 | <base:page title="<%=title%>" type="popup"> |
---|
94 | <base:head scripts="tabcontrol.js" styles="tabcontrol.css"> |
---|
95 | <script language="JavaScript"> |
---|
96 | function runPlugin(cmd) |
---|
97 | { |
---|
98 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 540, 460); |
---|
99 | } |
---|
100 | </script> |
---|
101 | </base:head> |
---|
102 | <base:body> |
---|
103 | <h1><%=title%></h3> |
---|
104 | |
---|
105 | <t:tabcontrol id="rawdata" |
---|
106 | subclass="content dialogtabcontrol" |
---|
107 | position="bottom"> |
---|
108 | <t:tab id="raw" title="Raw data"> |
---|
109 | |
---|
110 | <table class="fullform outlined larger"> |
---|
111 | <tbody class="sectionheader"> |
---|
112 | <tr> |
---|
113 | <th colspan="4">Common rawdata properties</th> |
---|
114 | </tr> |
---|
115 | </tbody> |
---|
116 | <tbody> |
---|
117 | <tr> |
---|
118 | <th>Position</th> |
---|
119 | <td><%=rawData.getPosition()%></td> |
---|
120 | <th class="leftborder">Block</th> |
---|
121 | <td><%=rawData.getBlock()%></td> |
---|
122 | </tr> |
---|
123 | <tr> |
---|
124 | <th>Row</th> |
---|
125 | <td><%=rawData.getRow()%></td> |
---|
126 | <th class="leftborder">Column</th> |
---|
127 | <td><%=rawData.getColumn()%></td> |
---|
128 | </tr> |
---|
129 | <tr> |
---|
130 | <th>Meta grid X</th> |
---|
131 | <td><%=rawData.getMetaGridX()%></td> |
---|
132 | <th class="leftborder">Meta grid Y</th> |
---|
133 | <td><%=rawData.getMetaGridY()%></td> |
---|
134 | </tr> |
---|
135 | <tr> |
---|
136 | <th>X</th> |
---|
137 | <td><%=rawData.getX()%></td> |
---|
138 | <th class="leftborder">Y</th> |
---|
139 | <td><%=rawData.getY()%></td> |
---|
140 | </tr> |
---|
141 | <tr> |
---|
142 | <th>Reporter</th> |
---|
143 | <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td> |
---|
144 | <th class="leftborder">Feature</th> |
---|
145 | <td><%=feature == null ? "<i>- none -</i>" : feature.getId()%></td> |
---|
146 | </tr> |
---|
147 | <tr> |
---|
148 | <th>Spot image</t> |
---|
149 | <td> |
---|
150 | <% |
---|
151 | if (hasSpotImages) |
---|
152 | { |
---|
153 | %> |
---|
154 | <img class="spotimage" src="spotimage/<%=ID%>/<%=rawBioAssay.getId()%>/<%=itemId%>/spot<%=rawData.getPosition()%>.png"> |
---|
155 | <% |
---|
156 | } |
---|
157 | else |
---|
158 | { |
---|
159 | %> |
---|
160 | <i>- none -</i> |
---|
161 | <% |
---|
162 | } |
---|
163 | %> |
---|
164 | </td> |
---|
165 | <th class="leftborder"></th> |
---|
166 | <td></td> |
---|
167 | </tr> |
---|
168 | </tbody> |
---|
169 | |
---|
170 | <tbody class="sectionheader"> |
---|
171 | <tr> |
---|
172 | <th colspan="4"><%=rawDataType.getName()%> properties</th> |
---|
173 | </tr> |
---|
174 | </tbody> |
---|
175 | |
---|
176 | <tbody> |
---|
177 | <% |
---|
178 | boolean needsTr = true; |
---|
179 | for (RawDataProperty rawProperty : rawDataType.getProperties()) |
---|
180 | { |
---|
181 | String name = rawProperty.getName(); |
---|
182 | Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, rawProperty); |
---|
183 | String value = f.format(rawData.getExtended(name)); |
---|
184 | title = Values.trimString(rawProperty.getTitle(), 25); |
---|
185 | %> |
---|
186 | <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\"" %> |
---|
187 | <span |
---|
188 | title="<%=HTML.encodeTags(rawProperty.getDescription())%>"><%=HTML.encodeTags(title)%></span> |
---|
189 | </th> |
---|
190 | <td><%=value%></td> |
---|
191 | <%=needsTr ? "" : "</tr>"%> |
---|
192 | <% |
---|
193 | needsTr = !needsTr; |
---|
194 | } |
---|
195 | %> |
---|
196 | <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%> |
---|
197 | <tr class="dynamic"> |
---|
198 | <th></th> |
---|
199 | <td></td> |
---|
200 | <th class="leftborder"></th> |
---|
201 | <td></td> |
---|
202 | </tr> |
---|
203 | </tbody> |
---|
204 | </table> |
---|
205 | |
---|
206 | </t:tab> |
---|
207 | |
---|
208 | <% |
---|
209 | if (reporter != null) |
---|
210 | { |
---|
211 | boolean readCurrentReporterType = true; |
---|
212 | ReporterType currentReporterType = null; |
---|
213 | try |
---|
214 | { |
---|
215 | currentReporterType = Reporter.getReporterType(dc, reporter); |
---|
216 | } |
---|
217 | catch (PermissionDeniedException ex) |
---|
218 | { |
---|
219 | readCurrentReporterType = false; |
---|
220 | } |
---|
221 | %> |
---|
222 | <t:tab id="reporter" title="Reporter" > |
---|
223 | <table class="fullform outlined"> |
---|
224 | <tbody class="sectionheader"> |
---|
225 | <tr> |
---|
226 | <th colspan="4">Common reporter properties</th> |
---|
227 | </tr> |
---|
228 | </tbody> |
---|
229 | <tbody> |
---|
230 | |
---|
231 | <tr> |
---|
232 | <th>Name</th> |
---|
233 | <td><%=HTML.encodeTags(reporter.getName())%></td> |
---|
234 | <th class="leftborder">External ID</th> |
---|
235 | <td><%=HTML.encodeTags(reporter.getExternalId())%></td> |
---|
236 | </tr> |
---|
237 | <tr> |
---|
238 | <th>Gene symbol</td> |
---|
239 | <td><%=HTML.encodeTags(reporter.getSymbol())%></td> |
---|
240 | <th class="leftborder">Type</th> |
---|
241 | <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td> |
---|
242 | </tr> |
---|
243 | <tr> |
---|
244 | <th>Last update</th> |
---|
245 | <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> |
---|
246 | <th class="leftborder">from/by</th> |
---|
247 | <td><%=reporter.getLastSource() %></td> |
---|
248 | </tr> |
---|
249 | <tr> |
---|
250 | <th>Description</th> |
---|
251 | <td colspan="3"><%=HTML.niceFormat(reporter.getDescription())%></td> |
---|
252 | </tr> |
---|
253 | </tbody> |
---|
254 | |
---|
255 | <tbody class="sectionheader"> |
---|
256 | <tr> |
---|
257 | <th colspan="4">Extended reporter properties</th> |
---|
258 | </tr> |
---|
259 | </tbody> |
---|
260 | <tbody> |
---|
261 | <% |
---|
262 | List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData"); |
---|
263 | if (reporterProperties != null) |
---|
264 | { |
---|
265 | boolean needsTr = true; |
---|
266 | for (ExtendedProperty ep : reporterProperties) |
---|
267 | { |
---|
268 | String name = ep.getName(); |
---|
269 | Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep); |
---|
270 | String value = f.format(reporter.getExtended(name)); |
---|
271 | %> |
---|
272 | <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %> |
---|
273 | <%=HTML.encodeTags(ep.getTitle())%></th> |
---|
274 | <td><%=value%></td> |
---|
275 | <%=needsTr ? "" : "</tr>"%> |
---|
276 | <% |
---|
277 | needsTr = !needsTr; |
---|
278 | } |
---|
279 | %> |
---|
280 | <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%> |
---|
281 | <% |
---|
282 | } |
---|
283 | %> |
---|
284 | <tr class="dynamic"> |
---|
285 | <th></th> |
---|
286 | <td></td> |
---|
287 | <th class="leftborder"></th> |
---|
288 | <td></td> |
---|
289 | </tr> |
---|
290 | </tbody> |
---|
291 | </table> |
---|
292 | </t:tab> |
---|
293 | <% |
---|
294 | } |
---|
295 | %> |
---|
296 | <% |
---|
297 | if (feature != null) |
---|
298 | { |
---|
299 | ArrayDesignBlock block = null; |
---|
300 | boolean readBlock = true; |
---|
301 | try |
---|
302 | { |
---|
303 | block = Feature.getArrayDesignBlock(dc, feature); |
---|
304 | } |
---|
305 | catch (PermissionDeniedException ex) |
---|
306 | { |
---|
307 | readBlock = false; |
---|
308 | } |
---|
309 | |
---|
310 | Well well = null; |
---|
311 | boolean readWell = true; |
---|
312 | try |
---|
313 | { |
---|
314 | well = Feature.getWell(dc, feature); |
---|
315 | } |
---|
316 | catch (PermissionDeniedException ex) |
---|
317 | { |
---|
318 | readWell = false; |
---|
319 | } |
---|
320 | %> |
---|
321 | <t:tab id="feature" title="Feature / well" > |
---|
322 | <table class="fullform outlined"> |
---|
323 | <tbody class="sectionheader"> |
---|
324 | <tr> |
---|
325 | <th colspan="6">Feature</th> |
---|
326 | </tr> |
---|
327 | </tbody> |
---|
328 | <tbody> |
---|
329 | <tr> |
---|
330 | <th>Position</td> |
---|
331 | <td><%=feature.getPosition()%></td> |
---|
332 | <th class="leftborder">Meta grid X</td> |
---|
333 | <td><%=readBlock ? Integer.toString(block.getMetaGridX()) : "<i>- denied -</i>"%></td> |
---|
334 | <th class="leftborder">Meta grid Y</th> |
---|
335 | <td><%=readBlock ? Integer.toString(block.getMetaGridY()) : "<i>- denied -</i>"%></td> |
---|
336 | </tr> |
---|
337 | <tr> |
---|
338 | <th>Feature ID</th> |
---|
339 | <td><%=feature.getExternalId() %></td> |
---|
340 | <th class="leftborder">Block size X</th> |
---|
341 | <td><%=readBlock ? Integer.toString(block.getBlockSizeX()) : "<i>- denied -</i>"%></td> |
---|
342 | <th class="leftborder">Block size Y</th> |
---|
343 | <td><%=readBlock ? Integer.toString(block.getBlockSizeY()) : "<i>- denied -</i>"%></td> |
---|
344 | </tr> |
---|
345 | <tr> |
---|
346 | <th>Block number</th> |
---|
347 | <td><%=block.getBlockNumber()%></td> |
---|
348 | <th class="leftborder">Origin X</th> |
---|
349 | <td><%=readBlock ? Integer.toString(block.getOriginX()) : "<i>- denied -</i>"%></td> |
---|
350 | <th class="leftborder">Origin Y</th> |
---|
351 | <td><%=readBlock ? Integer.toString(block.getOriginY()) : "<i>- denied -</i>"%></td> |
---|
352 | </tr> |
---|
353 | <tr> |
---|
354 | <th>Row</th> |
---|
355 | <td><%=feature.getRow()%></td> |
---|
356 | <th class="leftborder">Spacing X</th> |
---|
357 | <td><%=readBlock ? Integer.toString(block.getSpacingX()) : "<i>- denied -</i>"%></td> |
---|
358 | <th class="leftborder">Spacing Y</th> |
---|
359 | <td><%=readBlock ? Integer.toString(block.getSpacingY()) : "<i>- denied -</i>"%></td> |
---|
360 | </tr> |
---|
361 | <tr> |
---|
362 | <th>Column</th> |
---|
363 | <td><%=feature.getColumn()%></td> |
---|
364 | <th class="leftborder"></th> |
---|
365 | <td></td> |
---|
366 | <th class="leftborder"></th> |
---|
367 | <td></td> |
---|
368 | </tr> |
---|
369 | </tbody> |
---|
370 | |
---|
371 | <tbody class="sectionheader"> |
---|
372 | <tr> |
---|
373 | <th colspan="6">Plate position</th> |
---|
374 | </tr> |
---|
375 | </tbody> |
---|
376 | |
---|
377 | <tbody> |
---|
378 | <% |
---|
379 | if (!readWell) |
---|
380 | { |
---|
381 | %> |
---|
382 | <tr> |
---|
383 | <th>Plate</th> |
---|
384 | <td colspan="5"><i>- denied -</i></td> |
---|
385 | </tr> |
---|
386 | <% |
---|
387 | } |
---|
388 | else if (well == null) |
---|
389 | { |
---|
390 | %> |
---|
391 | <tr> |
---|
392 | <th>Plate</th> |
---|
393 | <td colspan="5"><i>- none -</i></td> |
---|
394 | </tr> |
---|
395 | <% |
---|
396 | } |
---|
397 | else |
---|
398 | { |
---|
399 | Plate plate = well.getPlate(); |
---|
400 | %> |
---|
401 | <tr> |
---|
402 | <th>Plate</th> |
---|
403 | <td colspan="5"><%=HTML.encodeTags(plate.getName())%></td> |
---|
404 | </tr> |
---|
405 | <tr> |
---|
406 | <th>Well</th> |
---|
407 | <td colspan="5"><%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%></td> |
---|
408 | </tr> |
---|
409 | <% |
---|
410 | } |
---|
411 | %> |
---|
412 | <tr class="dynamic"> |
---|
413 | <th></th> |
---|
414 | <td colspan="5"></td> |
---|
415 | </tr> |
---|
416 | </tbody> |
---|
417 | </table> |
---|
418 | </t:tab> |
---|
419 | <% |
---|
420 | } |
---|
421 | %> |
---|
422 | </t:tabcontrol> |
---|
423 | |
---|
424 | <base:buttongroup subclass="dialogbuttons"> |
---|
425 | <base:button onclick="window.close()" title="Close" /> |
---|
426 | </base:buttongroup> |
---|
427 | |
---|
428 | </base:body> |
---|
429 | </base:page> |
---|
430 | <% |
---|
431 | } |
---|
432 | finally |
---|
433 | { |
---|
434 | if (dc != null) dc.close(); |
---|
435 | } |
---|
436 | |
---|
437 | %> |
---|