1 | <%-- $Id: view_rawdata.jsp 5905 2011-12-12 08:42:09Z 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 | <p> |
---|
104 | <h3 class="docked"><%=title%></h3> |
---|
105 | |
---|
106 | <t:tabcontrol id="rawdata" contentstyle="<%="height: "+(int)(scale*340)+"px;"%>" position="bottom"> |
---|
107 | <t:tab id="raw" title="Raw data"> |
---|
108 | |
---|
109 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
110 | <tr > |
---|
111 | <td> |
---|
112 | <table class="form" cellspacing=0> |
---|
113 | <tr> |
---|
114 | <td class="prompt">Position</td> |
---|
115 | <td><%=rawData.getPosition()%></td> |
---|
116 | </tr> |
---|
117 | <tr> |
---|
118 | <td class="prompt">Block</td> |
---|
119 | <td><%=rawData.getBlock()%></td> |
---|
120 | </tr> |
---|
121 | <tr> |
---|
122 | <td class="prompt">Row</td> |
---|
123 | <td><%=rawData.getRow()%></td> |
---|
124 | </tr> |
---|
125 | <tr> |
---|
126 | <td class="prompt">Column</td> |
---|
127 | <td><%=rawData.getColumn()%></td> |
---|
128 | </tr> |
---|
129 | <tr> |
---|
130 | <td class="prompt">Meta grid X</td> |
---|
131 | <td><%=rawData.getMetaGridX()%></td> |
---|
132 | </tr> |
---|
133 | <tr> |
---|
134 | <td class="prompt">Meta grid Y</td> |
---|
135 | <td><%=rawData.getMetaGridY()%></td> |
---|
136 | </tr> |
---|
137 | <tr> |
---|
138 | <td class="prompt">X</td> |
---|
139 | <td><%=rawData.getX()%></td> |
---|
140 | </tr> |
---|
141 | <tr> |
---|
142 | <td class="prompt">Y</td> |
---|
143 | <td><%=rawData.getY()%></td> |
---|
144 | </tr> |
---|
145 | <% |
---|
146 | if (reporter == null) |
---|
147 | { |
---|
148 | %> |
---|
149 | <tr> |
---|
150 | <td class="prompt">Reporter</td> |
---|
151 | <td><i>- none -</i></td> |
---|
152 | </tr> |
---|
153 | <% |
---|
154 | } |
---|
155 | %> |
---|
156 | <% |
---|
157 | if (feature == null) |
---|
158 | { |
---|
159 | %> |
---|
160 | <tr> |
---|
161 | <td class="prompt">Feature / well</td> |
---|
162 | <td><i>- none -</i></td> |
---|
163 | </tr> |
---|
164 | <% |
---|
165 | } |
---|
166 | %> |
---|
167 | <tr > |
---|
168 | <td class="prompt">Spot image</td> |
---|
169 | <td> |
---|
170 | <% |
---|
171 | if (hasSpotImages) |
---|
172 | { |
---|
173 | %> |
---|
174 | <img class="spotimage" src="spotimage/<%=ID%>/<%=rawBioAssay.getId()%>/<%=itemId%>/spot<%=rawData.getPosition()%>.png"> |
---|
175 | <% |
---|
176 | } |
---|
177 | else |
---|
178 | { |
---|
179 | %> |
---|
180 | <i>- none -</i> |
---|
181 | <% |
---|
182 | } |
---|
183 | %> |
---|
184 | </td> |
---|
185 | </tr> |
---|
186 | </table> |
---|
187 | </td> |
---|
188 | <td> </td> |
---|
189 | <td> |
---|
190 | <table class="form" cellspacing=0> |
---|
191 | <% |
---|
192 | boolean needsTr = true; |
---|
193 | for (RawDataProperty rawProperty : rawDataType.getProperties()) |
---|
194 | { |
---|
195 | String name = rawProperty.getName(); |
---|
196 | Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, rawProperty); |
---|
197 | String value = f.format(rawData.getExtended(name)); |
---|
198 | title = Values.trimString(rawProperty.getTitle(), 25); |
---|
199 | %> |
---|
200 | <%=needsTr ? "<tr>" : "" %> |
---|
201 | <td class="prompt"><span |
---|
202 | title="<%=HTML.encodeTags(rawProperty.getDescription())%>"><%=HTML.encodeTags(title)%></span> |
---|
203 | </td> |
---|
204 | <td><%=value%></td> |
---|
205 | <td> </td> |
---|
206 | <%=needsTr ? "" : "</tr>"%> |
---|
207 | <% |
---|
208 | needsTr = !needsTr; |
---|
209 | } |
---|
210 | %> |
---|
211 | <%=needsTr ? "" : "</tr>"%> |
---|
212 | </table> |
---|
213 | |
---|
214 | </td> |
---|
215 | </tr> |
---|
216 | </table> |
---|
217 | |
---|
218 | </t:tab> |
---|
219 | |
---|
220 | <% |
---|
221 | if (reporter != null) |
---|
222 | { |
---|
223 | boolean readCurrentReporterType = true; |
---|
224 | ReporterType currentReporterType = null; |
---|
225 | try |
---|
226 | { |
---|
227 | currentReporterType = Reporter.getReporterType(dc, reporter); |
---|
228 | } |
---|
229 | catch (PermissionDeniedException ex) |
---|
230 | { |
---|
231 | readCurrentReporterType = false; |
---|
232 | } |
---|
233 | %> |
---|
234 | <t:tab id="reporter" title="Reporter" > |
---|
235 | <table border="0" cellspacing="0" cellpadding="0"> |
---|
236 | <tr > |
---|
237 | <td> |
---|
238 | <table class="form" cellspacing=0> |
---|
239 | <tr> |
---|
240 | <td class="prompt">Name</td> |
---|
241 | <td><%=HTML.encodeTags(reporter.getName())%></td> |
---|
242 | </tr> |
---|
243 | <tr> |
---|
244 | <td class="prompt">External ID</td> |
---|
245 | <td><%=HTML.encodeTags(reporter.getExternalId())%></td> |
---|
246 | </tr> |
---|
247 | <tr> |
---|
248 | <td class="prompt">Type</td> |
---|
249 | <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td> |
---|
250 | </tr> |
---|
251 | <tr> |
---|
252 | <td class="prompt">Gene symbol</td> |
---|
253 | <td><%=HTML.encodeTags(reporter.getSymbol())%></td> |
---|
254 | </tr> |
---|
255 | <tr > |
---|
256 | <td class="prompt">Description</td> |
---|
257 | <td><%=HTML.niceFormat(reporter.getDescription())%></td> |
---|
258 | </tr> |
---|
259 | <tr> |
---|
260 | <td class="prompt">Last update</td> |
---|
261 | <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> |
---|
262 | </tr> |
---|
263 | </table> |
---|
264 | </td> |
---|
265 | <td> </td> |
---|
266 | <td> |
---|
267 | <table class="form" cellspacing=0> |
---|
268 | <% |
---|
269 | List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData"); |
---|
270 | if (reporterProperties != null) |
---|
271 | { |
---|
272 | boolean needsTr = true; |
---|
273 | for (ExtendedProperty ep : reporterProperties) |
---|
274 | { |
---|
275 | String name = ep.getName(); |
---|
276 | Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep); |
---|
277 | String value = f.format(reporter.getExtended(name)); |
---|
278 | %> |
---|
279 | <%=needsTr ? "<tr>" : "" %> |
---|
280 | <td class="prompt"><%=HTML.encodeTags(ep.getTitle())%></td> |
---|
281 | <td><%=value%></td> |
---|
282 | <td> </td> |
---|
283 | <%=needsTr ? "" : "</tr>"%> |
---|
284 | <% |
---|
285 | needsTr = !needsTr; |
---|
286 | } |
---|
287 | %> |
---|
288 | <%=needsTr ? "" : "</tr>"%> |
---|
289 | <% |
---|
290 | } |
---|
291 | %> |
---|
292 | </table> |
---|
293 | </td> |
---|
294 | </tr> |
---|
295 | </table> |
---|
296 | </t:tab> |
---|
297 | <% |
---|
298 | } |
---|
299 | %> |
---|
300 | |
---|
301 | <% |
---|
302 | if (feature != null) |
---|
303 | { |
---|
304 | ArrayDesignBlock block = null; |
---|
305 | boolean readBlock = true; |
---|
306 | try |
---|
307 | { |
---|
308 | block = Feature.getArrayDesignBlock(dc, feature); |
---|
309 | } |
---|
310 | catch (PermissionDeniedException ex) |
---|
311 | { |
---|
312 | readBlock = false; |
---|
313 | } |
---|
314 | |
---|
315 | Well well = null; |
---|
316 | boolean readWell = true; |
---|
317 | try |
---|
318 | { |
---|
319 | well = Feature.getWell(dc, feature); |
---|
320 | } |
---|
321 | catch (PermissionDeniedException ex) |
---|
322 | { |
---|
323 | readWell = false; |
---|
324 | } |
---|
325 | %> |
---|
326 | <t:tab id="feature" title="Feature / well" > |
---|
327 | <h4>Feature</h4> |
---|
328 | <table class="form" cellspacing=0> |
---|
329 | <tr> |
---|
330 | <td class="prompt">Position</td> |
---|
331 | <td><%=feature.getPosition()%></td> |
---|
332 | <td> </td> |
---|
333 | <td class="prompt">Meta grid X</td> |
---|
334 | <td><%=readBlock ? Integer.toString(block.getMetaGridX()) : "<i>- denied -</i>"%></td> |
---|
335 | <td> </td> |
---|
336 | <td class="prompt">Meta grid Y</td> |
---|
337 | <td><%=readBlock ? Integer.toString(block.getMetaGridY()) : "<i>- denied -</i>"%></td> |
---|
338 | </tr> |
---|
339 | <tr> |
---|
340 | <td class="prompt">Row</td> |
---|
341 | <td><%=feature.getRow()%></td> |
---|
342 | <td> </td> |
---|
343 | <td class="prompt">Block size X</td> |
---|
344 | <td><%=readBlock ? Integer.toString(block.getBlockSizeX()) : "<i>- denied -</i>"%></td> |
---|
345 | <td> </td> |
---|
346 | <td class="prompt">Block size Y</td> |
---|
347 | <td><%=readBlock ? Integer.toString(block.getBlockSizeY()) : "<i>- denied -</i>"%></td> |
---|
348 | </tr> |
---|
349 | <tr> |
---|
350 | <td class="prompt">Column</td> |
---|
351 | <td><%=feature.getColumn()%></td> |
---|
352 | <td> </td> |
---|
353 | <td class="prompt">Origin X</td> |
---|
354 | <td><%=readBlock ? Integer.toString(block.getOriginX()) : "<i>- denied -</i>"%></td> |
---|
355 | <td> </td> |
---|
356 | <td class="prompt">Origin Y</td> |
---|
357 | <td><%=readBlock ? Integer.toString(block.getOriginY()) : "<i>- denied -</i>"%></td> |
---|
358 | </tr> |
---|
359 | <tr> |
---|
360 | <td class="prompt">Block number</td> |
---|
361 | <td><%=block.getBlockNumber()%></td> |
---|
362 | <td> </td> |
---|
363 | <td class="prompt">Spacing X</td> |
---|
364 | <td><%=readBlock ? Integer.toString(block.getSpacingX()) : "<i>- denied -</i>"%></td> |
---|
365 | <td> </td> |
---|
366 | <td class="prompt">Spacing Y</td> |
---|
367 | <td><%=readBlock ? Integer.toString(block.getSpacingY()) : "<i>- denied -</i>"%></td> |
---|
368 | </tr> |
---|
369 | </table> |
---|
370 | |
---|
371 | <h4>Well</h4> |
---|
372 | <% |
---|
373 | if (!readWell) |
---|
374 | { |
---|
375 | %> |
---|
376 | <i>- denied -</i> |
---|
377 | <% |
---|
378 | } |
---|
379 | else if (well == null) |
---|
380 | { |
---|
381 | %> |
---|
382 | <i>- none -</i> |
---|
383 | <% |
---|
384 | } |
---|
385 | else |
---|
386 | { |
---|
387 | Plate plate = well.getPlate(); |
---|
388 | %> |
---|
389 | <table class="form" cellspacing=0> |
---|
390 | <tr> |
---|
391 | <td class="prompt">Plate</td> |
---|
392 | <td><%=HTML.encodeTags(plate.getName())%></td> |
---|
393 | </tr> |
---|
394 | <tr> |
---|
395 | <td class="prompt">Row</td> |
---|
396 | <td><%=rowFormatter.format(well.getRow())%></td> |
---|
397 | </tr> |
---|
398 | <tr> |
---|
399 | <td class="prompt">Column</td> |
---|
400 | <td><%=columnFormatter.format(well.getColumn())%></td> |
---|
401 | </tr> |
---|
402 | </table> |
---|
403 | <% |
---|
404 | } |
---|
405 | %> |
---|
406 | </t:tab> |
---|
407 | <% |
---|
408 | } |
---|
409 | %> |
---|
410 | </t:tabcontrol> |
---|
411 | |
---|
412 | <div align="center"> |
---|
413 | <table> |
---|
414 | <tr> |
---|
415 | <td><base:button onclick="window.close()" title="Close" /></td> |
---|
416 | </tr> |
---|
417 | </table> |
---|
418 | </div> |
---|
419 | |
---|
420 | </base:body> |
---|
421 | </base:page> |
---|
422 | <% |
---|
423 | } |
---|
424 | finally |
---|
425 | { |
---|
426 | if (dc != null) dc.close(); |
---|
427 | } |
---|
428 | |
---|
429 | %> |
---|