1 | <%-- $Id: view_rawdata.jsp 7635 2019-03-11 10:01:10Z 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 boolean readReporter = !sc.hasPermission(Permission.DENIED, Item.REPORTER); |
---|
77 | final RawBioAssay rawBioAssay = RawBioAssay.getById(dc, rawBioAssayId); |
---|
78 | final RawDataType rawDataType = rawBioAssay.getRawDataType(); |
---|
79 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, rawDataType.getId(), null, null); |
---|
80 | final int itemId = cc.getId(); |
---|
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 = readReporter ? rawData.getReporter() : null; |
---|
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" id="view-page"> |
---|
94 | <base:head scripts="tabcontrol-2.js,~rawdata.js" styles="tabcontrol.css" /> |
---|
95 | <base:body data-read-only="1"> |
---|
96 | <h1><%=title%></h1> |
---|
97 | |
---|
98 | <t:tabcontrol id="rawdata" |
---|
99 | subclass="content dialogtabcontrol" |
---|
100 | position="bottom"> |
---|
101 | <t:tab id="raw" title="Raw data"> |
---|
102 | |
---|
103 | <table class="fullform outlined larger"> |
---|
104 | <tbody class="sectionheader"> |
---|
105 | <tr> |
---|
106 | <th colspan="4">Common rawdata properties</th> |
---|
107 | </tr> |
---|
108 | </tbody> |
---|
109 | <tbody> |
---|
110 | <tr> |
---|
111 | <th>Position</th> |
---|
112 | <td><%=rawData.getPosition()%></td> |
---|
113 | <th class="leftborder">Block</th> |
---|
114 | <td><%=rawData.getBlock()%></td> |
---|
115 | </tr> |
---|
116 | <tr> |
---|
117 | <th>Row</th> |
---|
118 | <td><%=rawData.getRow()%></td> |
---|
119 | <th class="leftborder">Column</th> |
---|
120 | <td><%=rawData.getColumn()%></td> |
---|
121 | </tr> |
---|
122 | <tr> |
---|
123 | <th>Meta grid X</th> |
---|
124 | <td><%=rawData.getMetaGridX()%></td> |
---|
125 | <th class="leftborder">Meta grid Y</th> |
---|
126 | <td><%=rawData.getMetaGridY()%></td> |
---|
127 | </tr> |
---|
128 | <tr> |
---|
129 | <th>X</th> |
---|
130 | <td><%=rawData.getX()%></td> |
---|
131 | <th class="leftborder">Y</th> |
---|
132 | <td><%=rawData.getY()%></td> |
---|
133 | </tr> |
---|
134 | <tr> |
---|
135 | <th>Reporter</th> |
---|
136 | <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td> |
---|
137 | <th class="leftborder">Feature</th> |
---|
138 | <td><%=feature == null ? "<i>- none -</i>" : feature.getId()%></td> |
---|
139 | </tr> |
---|
140 | </tbody> |
---|
141 | |
---|
142 | <tbody class="sectionheader"> |
---|
143 | <tr> |
---|
144 | <th colspan="4"><%=rawDataType.getName()%> properties</th> |
---|
145 | </tr> |
---|
146 | </tbody> |
---|
147 | |
---|
148 | <tbody> |
---|
149 | <% |
---|
150 | boolean needsTr = true; |
---|
151 | for (RawDataProperty rawProperty : rawDataType.getProperties()) |
---|
152 | { |
---|
153 | String name = rawProperty.getName(); |
---|
154 | Formatter<Object> f = FormatterFactory.getExtendedPropertyFormatter(sc, rawProperty); |
---|
155 | String value = f.format(rawData.getExtended(name)); |
---|
156 | title = Values.trimString(rawProperty.getTitle(), 25); |
---|
157 | %> |
---|
158 | <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %> |
---|
159 | <span |
---|
160 | title="<%=HTML.encodeTags(rawProperty.getDescription())%>"><%=HTML.encodeTags(title)%></span> |
---|
161 | </th> |
---|
162 | <td><%=value%></td> |
---|
163 | <%=needsTr ? "" : "</tr>"%> |
---|
164 | <% |
---|
165 | needsTr = !needsTr; |
---|
166 | } |
---|
167 | %> |
---|
168 | <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%> |
---|
169 | <tr class="dynamic"> |
---|
170 | <th></th> |
---|
171 | <td></td> |
---|
172 | <th class="leftborder"></th> |
---|
173 | <td></td> |
---|
174 | </tr> |
---|
175 | </tbody> |
---|
176 | </table> |
---|
177 | |
---|
178 | </t:tab> |
---|
179 | <t:tab id="reporter" title="Reporter" > |
---|
180 | <% |
---|
181 | if (reporter == null) |
---|
182 | { |
---|
183 | %> |
---|
184 | <table class="fullcc bg-filled-50"><tr><td> |
---|
185 | <b><%=readReporter ? "No reporter" : "Denied" %></b> |
---|
186 | </td></tr></table> |
---|
187 | <% |
---|
188 | } |
---|
189 | else |
---|
190 | { |
---|
191 | boolean readCurrentReporterType = true; |
---|
192 | ReporterType currentReporterType = null; |
---|
193 | try |
---|
194 | { |
---|
195 | currentReporterType = Reporter.getReporterType(dc, reporter); |
---|
196 | } |
---|
197 | catch (PermissionDeniedException ex) |
---|
198 | { |
---|
199 | readCurrentReporterType = false; |
---|
200 | } |
---|
201 | %> |
---|
202 | <table class="fullform outlined"> |
---|
203 | <tbody class="sectionheader"> |
---|
204 | <tr> |
---|
205 | <th colspan="4">Common reporter properties</th> |
---|
206 | </tr> |
---|
207 | </tbody> |
---|
208 | <tbody> |
---|
209 | |
---|
210 | <tr> |
---|
211 | <th>Name</th> |
---|
212 | <td><%=HTML.encodeTags(reporter.getName())%></td> |
---|
213 | <th class="leftborder">External ID</th> |
---|
214 | <td><%=HTML.encodeTags(reporter.getExternalId())%></td> |
---|
215 | </tr> |
---|
216 | <tr> |
---|
217 | <th>Gene symbol</th> |
---|
218 | <td><%=HTML.encodeTags(reporter.getSymbol())%></td> |
---|
219 | <th class="leftborder">Type</th> |
---|
220 | <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td> |
---|
221 | </tr> |
---|
222 | <tr> |
---|
223 | <th>Last update</th> |
---|
224 | <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> |
---|
225 | <th class="leftborder">from/by</th> |
---|
226 | <td><%=reporter.getLastSource() %></td> |
---|
227 | </tr> |
---|
228 | <tr> |
---|
229 | <th>Description</th> |
---|
230 | <td colspan="3"><%=HTML.niceFormat(reporter.getDescription())%></td> |
---|
231 | </tr> |
---|
232 | </tbody> |
---|
233 | |
---|
234 | <tbody class="sectionheader"> |
---|
235 | <tr> |
---|
236 | <th colspan="4">Extended reporter properties</th> |
---|
237 | </tr> |
---|
238 | </tbody> |
---|
239 | <tbody> |
---|
240 | <% |
---|
241 | List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData"); |
---|
242 | if (reporterProperties != null) |
---|
243 | { |
---|
244 | boolean needsTr = true; |
---|
245 | for (ExtendedProperty ep : reporterProperties) |
---|
246 | { |
---|
247 | String name = ep.getName(); |
---|
248 | Formatter<Object> f = FormatterFactory.getExtendedPropertyFormatter(sc, ep); |
---|
249 | String value = f.format(reporter.getExtended(name)); |
---|
250 | %> |
---|
251 | <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %> |
---|
252 | <%=HTML.encodeTags(ep.getTitle())%></th> |
---|
253 | <td><%=value%></td> |
---|
254 | <%=needsTr ? "" : "</tr>"%> |
---|
255 | <% |
---|
256 | needsTr = !needsTr; |
---|
257 | } |
---|
258 | %> |
---|
259 | <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%> |
---|
260 | <% |
---|
261 | } |
---|
262 | %> |
---|
263 | <tr class="dynamic"> |
---|
264 | <th></th> |
---|
265 | <td></td> |
---|
266 | <th class="leftborder"></th> |
---|
267 | <td></td> |
---|
268 | </tr> |
---|
269 | </tbody> |
---|
270 | </table> |
---|
271 | <% |
---|
272 | } |
---|
273 | %> |
---|
274 | </t:tab> |
---|
275 | <% |
---|
276 | if (feature != null) |
---|
277 | { |
---|
278 | ArrayDesignBlock block = null; |
---|
279 | boolean readBlock = true; |
---|
280 | try |
---|
281 | { |
---|
282 | block = Feature.getArrayDesignBlock(dc, feature); |
---|
283 | } |
---|
284 | catch (PermissionDeniedException ex) |
---|
285 | { |
---|
286 | readBlock = false; |
---|
287 | } |
---|
288 | |
---|
289 | Well well = null; |
---|
290 | boolean readWell = true; |
---|
291 | try |
---|
292 | { |
---|
293 | well = Feature.getWell(dc, feature); |
---|
294 | } |
---|
295 | catch (PermissionDeniedException ex) |
---|
296 | { |
---|
297 | readWell = false; |
---|
298 | } |
---|
299 | %> |
---|
300 | <t:tab id="feature" title="Feature / well" > |
---|
301 | <table class="fullform outlined"> |
---|
302 | <tbody class="sectionheader"> |
---|
303 | <tr> |
---|
304 | <th colspan="6">Feature</th> |
---|
305 | </tr> |
---|
306 | </tbody> |
---|
307 | <tbody> |
---|
308 | <tr> |
---|
309 | <th>Position</th> |
---|
310 | <td><%=feature.getPosition()%></td> |
---|
311 | <th class="leftborder">Meta grid X</th> |
---|
312 | <td><%=readBlock ? Integer.toString(block.getMetaGridX()) : "<i>- denied -</i>"%></td> |
---|
313 | <th class="leftborder">Meta grid Y</th> |
---|
314 | <td><%=readBlock ? Integer.toString(block.getMetaGridY()) : "<i>- denied -</i>"%></td> |
---|
315 | </tr> |
---|
316 | <tr> |
---|
317 | <th>Feature ID</th> |
---|
318 | <td><%=feature.getExternalId() %></td> |
---|
319 | <th class="leftborder">Block size X</th> |
---|
320 | <td><%=readBlock ? Integer.toString(block.getBlockSizeX()) : "<i>- denied -</i>"%></td> |
---|
321 | <th class="leftborder">Block size Y</th> |
---|
322 | <td><%=readBlock ? Integer.toString(block.getBlockSizeY()) : "<i>- denied -</i>"%></td> |
---|
323 | </tr> |
---|
324 | <tr> |
---|
325 | <th>Block number</th> |
---|
326 | <td><%=block.getBlockNumber()%></td> |
---|
327 | <th class="leftborder">Origin X</th> |
---|
328 | <td><%=readBlock ? Integer.toString(block.getOriginX()) : "<i>- denied -</i>"%></td> |
---|
329 | <th class="leftborder">Origin Y</th> |
---|
330 | <td><%=readBlock ? Integer.toString(block.getOriginY()) : "<i>- denied -</i>"%></td> |
---|
331 | </tr> |
---|
332 | <tr> |
---|
333 | <th>Row</th> |
---|
334 | <td><%=feature.getRow()%></td> |
---|
335 | <th class="leftborder">Spacing X</th> |
---|
336 | <td><%=readBlock ? Integer.toString(block.getSpacingX()) : "<i>- denied -</i>"%></td> |
---|
337 | <th class="leftborder">Spacing Y</th> |
---|
338 | <td><%=readBlock ? Integer.toString(block.getSpacingY()) : "<i>- denied -</i>"%></td> |
---|
339 | </tr> |
---|
340 | <tr> |
---|
341 | <th>Column</th> |
---|
342 | <td><%=feature.getColumn()%></td> |
---|
343 | <th class="leftborder"></th> |
---|
344 | <td></td> |
---|
345 | <th class="leftborder"></th> |
---|
346 | <td></td> |
---|
347 | </tr> |
---|
348 | </tbody> |
---|
349 | |
---|
350 | <tbody class="sectionheader"> |
---|
351 | <tr> |
---|
352 | <th colspan="6">Plate position</th> |
---|
353 | </tr> |
---|
354 | </tbody> |
---|
355 | |
---|
356 | <tbody> |
---|
357 | <% |
---|
358 | if (!readWell) |
---|
359 | { |
---|
360 | %> |
---|
361 | <tr> |
---|
362 | <th>Plate</th> |
---|
363 | <td colspan="5"><i>- denied -</i></td> |
---|
364 | </tr> |
---|
365 | <% |
---|
366 | } |
---|
367 | else if (well == null) |
---|
368 | { |
---|
369 | %> |
---|
370 | <tr> |
---|
371 | <th>Plate</th> |
---|
372 | <td colspan="5"><i>- none -</i></td> |
---|
373 | </tr> |
---|
374 | <% |
---|
375 | } |
---|
376 | else |
---|
377 | { |
---|
378 | Plate plate = well.getPlate(); |
---|
379 | %> |
---|
380 | <tr> |
---|
381 | <th>Plate</th> |
---|
382 | <td colspan="5"><%=HTML.encodeTags(plate.getName())%></td> |
---|
383 | </tr> |
---|
384 | <tr> |
---|
385 | <th>Well</th> |
---|
386 | <td colspan="5"><%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%></td> |
---|
387 | </tr> |
---|
388 | <% |
---|
389 | } |
---|
390 | %> |
---|
391 | <tr class="dynamic"> |
---|
392 | <th></th> |
---|
393 | <td colspan="5"></td> |
---|
394 | </tr> |
---|
395 | </tbody> |
---|
396 | </table> |
---|
397 | </t:tab> |
---|
398 | <% |
---|
399 | } |
---|
400 | %> |
---|
401 | </t:tabcontrol> |
---|
402 | |
---|
403 | <base:buttongroup subclass="dialogbuttons"> |
---|
404 | <base:button id="close" title="Close" /> |
---|
405 | </base:buttongroup> |
---|
406 | |
---|
407 | </base:body> |
---|
408 | </base:page> |
---|
409 | <% |
---|
410 | } |
---|
411 | finally |
---|
412 | { |
---|
413 | if (dc != null) dc.close(); |
---|
414 | } |
---|
415 | |
---|
416 | %> |
---|