1 | <%-- $Id: view_experiment.jsp 5937 2012-01-27 11:00:26Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson, Gregory Vincic |
---|
4 | Copyright (C) 2007 Nicklas Nordborg, Martin Svensson |
---|
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 import="net.sf.basedb.core.VirtualTable"%> |
---|
27 | <%@ page pageEncoding="UTF-8" session="false" |
---|
28 | import="net.sf.basedb.core.SessionControl" |
---|
29 | import="net.sf.basedb.core.DbControl" |
---|
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.Experiment" |
---|
34 | import="net.sf.basedb.core.VirtualDb" |
---|
35 | import="net.sf.basedb.core.RawBioAssay" |
---|
36 | import="net.sf.basedb.core.AnnotationType" |
---|
37 | import="net.sf.basedb.core.AnnotationSet" |
---|
38 | import="net.sf.basedb.core.Annotation" |
---|
39 | import="net.sf.basedb.core.Annotatable" |
---|
40 | import="net.sf.basedb.core.Unit" |
---|
41 | import="net.sf.basedb.core.Type" |
---|
42 | import="net.sf.basedb.core.User" |
---|
43 | import="net.sf.basedb.core.Group" |
---|
44 | import="net.sf.basedb.core.ItemQuery" |
---|
45 | import="net.sf.basedb.core.ItemResultList" |
---|
46 | import="net.sf.basedb.core.ItemResultIterator" |
---|
47 | import="net.sf.basedb.core.Include" |
---|
48 | import="net.sf.basedb.core.MultiPermissions" |
---|
49 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
50 | import="net.sf.basedb.core.PluginDefinition" |
---|
51 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
52 | import="net.sf.basedb.core.plugin.Plugin" |
---|
53 | import="net.sf.basedb.core.Project" |
---|
54 | import="net.sf.basedb.core.query.Orders" |
---|
55 | import="net.sf.basedb.core.query.Hql" |
---|
56 | import="net.sf.basedb.clients.web.Base" |
---|
57 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
58 | import="net.sf.basedb.clients.web.ChangeHistoryUtil" |
---|
59 | import="net.sf.basedb.clients.web.util.HTML" |
---|
60 | import="net.sf.basedb.util.Values" |
---|
61 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
62 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
63 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
64 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
65 | import="net.sf.basedb.util.formatter.Formatter" |
---|
66 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
67 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
68 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
69 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
70 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
71 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
72 | import="java.util.Collections" |
---|
73 | import="java.util.Date" |
---|
74 | import="java.util.Map" |
---|
75 | import="java.util.HashMap" |
---|
76 | import="java.util.Set" |
---|
77 | import="java.util.HashSet" |
---|
78 | import="java.util.List" |
---|
79 | import="java.util.LinkedList" |
---|
80 | import="java.util.Date" |
---|
81 | %> |
---|
82 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
83 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
84 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
85 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
86 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
87 | <%! |
---|
88 | private static final Item itemType = Item.EXPERIMENT; |
---|
89 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
90 | %> |
---|
91 | <% |
---|
92 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
93 | final String ID = sc.getId(); |
---|
94 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
95 | final int itemId = cc.getId(); |
---|
96 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
97 | final float scale = Base.getScale(sc); |
---|
98 | final String root = request.getContextPath(); |
---|
99 | final DbControl dc = sc.newDbControl(); |
---|
100 | try |
---|
101 | { |
---|
102 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
103 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
104 | |
---|
105 | String title = null; |
---|
106 | Experiment experiment = Experiment.getById(dc, itemId); |
---|
107 | VirtualDb virtualDb = experiment.getVirtualDb(); |
---|
108 | |
---|
109 | final boolean writePermission = experiment.hasPermission(Permission.WRITE); |
---|
110 | final boolean deletePermission = experiment.hasPermission(Permission.DELETE); |
---|
111 | final boolean sharePermission = experiment.hasPermission(Permission.SET_PERMISSION); |
---|
112 | final boolean setOwnerPermission = experiment.hasPermission(Permission.SET_OWNER); |
---|
113 | final boolean isOwner = experiment.isOwner(); |
---|
114 | final boolean isRemoved = experiment.isRemoved(); |
---|
115 | final boolean isUsed = isRemoved && experiment.isUsed(); |
---|
116 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
117 | |
---|
118 | Map<AnnotationType, Set<Object>> usedFactorValues = |
---|
119 | new HashMap<AnnotationType, Set<Object>>(); |
---|
120 | Map<AnnotationType, Integer> factorValuesCount = new HashMap<AnnotationType, Integer>(); |
---|
121 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, experiment); |
---|
122 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
123 | %> |
---|
124 | <base:page title="<%=title%>"> |
---|
125 | <base:head scripts="table.js,tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
126 | <ext:scripts context="<%=jspContext%>" /> |
---|
127 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
128 | <script language="JavaScript"> |
---|
129 | function editItem() |
---|
130 | { |
---|
131 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
132 | } |
---|
133 | function shareItem() |
---|
134 | { |
---|
135 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareRawBioAssay', 600, 400); |
---|
136 | } |
---|
137 | function deleteItem() |
---|
138 | { |
---|
139 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
140 | } |
---|
141 | function restoreItem() |
---|
142 | { |
---|
143 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
144 | } |
---|
145 | function deleteItemPermanently() |
---|
146 | { |
---|
147 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted'); |
---|
148 | } |
---|
149 | function itemDeleted() |
---|
150 | { |
---|
151 | Main.listItems('<%=ID%>', '<%=itemType.name()%>'); |
---|
152 | } |
---|
153 | function showUsingItems() |
---|
154 | { |
---|
155 | Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
156 | } |
---|
157 | function setOwner() |
---|
158 | { |
---|
159 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300); |
---|
160 | } |
---|
161 | function runPlugin(cmd) |
---|
162 | { |
---|
163 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500); |
---|
164 | } |
---|
165 | function analyzeItem() |
---|
166 | { |
---|
167 | location.href = '<%=root%>/analyze/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; |
---|
168 | } |
---|
169 | function viewBioAssaySets() |
---|
170 | { |
---|
171 | location.href = 'bioassaysets/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; |
---|
172 | } |
---|
173 | function viewClonedReporters() |
---|
174 | { |
---|
175 | location.href = 'reporters/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>'; |
---|
176 | } |
---|
177 | function switchTab(tabControlId, tabId) |
---|
178 | { |
---|
179 | if (TabControl.isActive(tabControlId, tabId)) return; |
---|
180 | if ((tabId == 'overview' || tabId == 'history') && tabId != '<%=tab%>') |
---|
181 | { |
---|
182 | location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId; |
---|
183 | } |
---|
184 | else if (tabId == 'clonedreporters') |
---|
185 | { |
---|
186 | viewClonedReporters(); |
---|
187 | } |
---|
188 | else if (tabId == 'bioassaysets') |
---|
189 | { |
---|
190 | viewBioAssaySets(); |
---|
191 | } |
---|
192 | else |
---|
193 | { |
---|
194 | TabControl.setActiveTab(tabControlId, tabId); |
---|
195 | } |
---|
196 | } |
---|
197 | function editAnnotation(itemType, itemId, annotationTypeId) |
---|
198 | { |
---|
199 | var url = getRoot() + 'common/annotations/annotate.jsp?ID=<%=ID%>'; |
---|
200 | url += '&item_type='+itemType; |
---|
201 | url += '&item_id='+itemId; |
---|
202 | url += '&annotationtype_id='+annotationTypeId; |
---|
203 | url += '&standalone=1'; |
---|
204 | Main.openPopup(url, 'EditAnnotation', 700, 460); |
---|
205 | } |
---|
206 | function editInheritedAnnotation(itemType, itemId, annotationTypeId) |
---|
207 | { |
---|
208 | var url = getRoot() + 'common/annotations/inherit.jsp?ID=<%=ID%>'; |
---|
209 | url += '&item_type='+itemType; |
---|
210 | url += '&item_id='+itemId; |
---|
211 | url += '&annotationtype_id='+annotationTypeId; |
---|
212 | url += '&standalone=1'; |
---|
213 | Main.openPopup(url, 'EditAnnotation', 700, 460); |
---|
214 | } |
---|
215 | function setUsedFactorValue(annotationTypeId, values) |
---|
216 | { |
---|
217 | var div = document.getElementById('usedvalues.'+annotationTypeId); |
---|
218 | div.innerHTML = values; |
---|
219 | if (values && values.length > 50) |
---|
220 | { |
---|
221 | Main.addClass(div, 'constrained unchecked autoshow'); |
---|
222 | if (window.textOverflowChecker) |
---|
223 | { |
---|
224 | window.textOverflowChecker.checkTag(div); |
---|
225 | } |
---|
226 | } |
---|
227 | } |
---|
228 | var hasMissingFactors = false; |
---|
229 | function showStatus(annotationTypeId, numTotal, numInherited) |
---|
230 | { |
---|
231 | var sss = document.getElementById('status.'+annotationTypeId); |
---|
232 | var html; |
---|
233 | if (numInherited >= numTotal) |
---|
234 | { |
---|
235 | html = '<img src="../../images/ok.png" title="All ' + numTotal + |
---|
236 | ' raw bioassays have a value for this experimental factor">'; |
---|
237 | } |
---|
238 | else |
---|
239 | { |
---|
240 | var numMissing = numTotal - numInherited; |
---|
241 | html = '<table border="0" cellspacing="0" cellpadding="0"><tr>'; |
---|
242 | html += '<td width="20"><img src="../../images/warning.gif" border="0"'; |
---|
243 | html += ' title="' + numMissing + ' raw bioassays are missing a value for this experimental factor"></td>'; |
---|
244 | html += '<td width="20" style="text-align: center;">'; |
---|
245 | html += '<input type="checkbox" name="autoinherit" id="autoinherit'+annotationTypeId+'" value="'+annotationTypeId+'" checked'; |
---|
246 | html += ' title="Select to automatically inherit annotations from parents"></td>'; |
---|
247 | html += '<td> <label for="autoinherit'+annotationTypeId+'">' + numMissing + ' missing</label></td>' |
---|
248 | html += '</tr></table>'; |
---|
249 | |
---|
250 | if (!hasMissingFactors) |
---|
251 | { |
---|
252 | hasMissingFactors = true; |
---|
253 | var checkAll = '<table border="0" cellspacing="0" cellpadding="0"><tr>'; |
---|
254 | checkAll += '<td width="20"></td>'; |
---|
255 | checkAll += '<td width="20" style="text-align: center;">'; |
---|
256 | checkAll += '<a href="javascript:checkFactors()" title="Check/uncheck all">'; |
---|
257 | checkAll += '<img src="../../images/check_uncheck.gif" border="0"></a></td>'; |
---|
258 | checkAll += '<td width="20"><img src="../../images/bullet.gif" border="0"></td>'; |
---|
259 | checkAll += '<td><a href="javascript:autoInherit()"'; |
---|
260 | checkAll += ' title="Automatically try to inherit values for the selected experimental factors from parent items">'; |
---|
261 | checkAll += 'Auto-inherit</a></td>' |
---|
262 | checkAll += '</tr></table>'; |
---|
263 | document.getElementById('status').innerHTML = checkAll; |
---|
264 | Main.show('warning.missing'); |
---|
265 | } |
---|
266 | } |
---|
267 | sss.innerHTML = html; |
---|
268 | } |
---|
269 | function checkFactors() |
---|
270 | { |
---|
271 | var frm = document.forms['experimentalFactors']; |
---|
272 | Forms.checkUncheck(frm, /autoinherit/); |
---|
273 | } |
---|
274 | function autoInherit() |
---|
275 | { |
---|
276 | var frm = document.forms['experimentalFactors']; |
---|
277 | if (Forms.numChecked(frm, /autoinherit/) == 0) |
---|
278 | { |
---|
279 | alert('Please select at least on experimental factor'); |
---|
280 | return; |
---|
281 | } |
---|
282 | Main.openPopup('../../common/progress_reporter.jsp?ID=<%=ID%>&progress=autoinherit&title=Inheriting experimental factors', 'Progress', 300, 200); |
---|
283 | frm.cmd.value = 'AutoInherit'; |
---|
284 | frm.submit(); |
---|
285 | } |
---|
286 | function cloneReporters() |
---|
287 | { |
---|
288 | Main.openPopup('clone_reporters.jsp?ID=<%=ID%>&item_id=<%=itemId%>', 'CloneReporters', 600, 400); |
---|
289 | } |
---|
290 | function removeClonedReporters() |
---|
291 | { |
---|
292 | if (confirm('Are you sure that you want to remove all cloned reporter annotations?\nThis action can\'t be undone.')) |
---|
293 | { |
---|
294 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=RemoveClonedReporters&item_id=<%=itemId%>', 'RemoveClonedReporters', 450, 300); |
---|
295 | } |
---|
296 | } |
---|
297 | </script> |
---|
298 | </base:head> |
---|
299 | <base:body onload="initUsedFactorValues()"> |
---|
300 | <p> |
---|
301 | <p:path> |
---|
302 | <p:pathelement title="Experiments" href="<%="index.jsp?ID="+ID%>" /> |
---|
303 | <p:pathelement title="<%=HTML.encodeTags(experiment.getName())%>" /> |
---|
304 | </p:path> |
---|
305 | |
---|
306 | <t:tabcontrol id="main" active="<%=tab%>" switch="switchTab" remember="false"> |
---|
307 | <t:tab id="properties" title="Properties"> |
---|
308 | |
---|
309 | <tbl:toolbar |
---|
310 | > |
---|
311 | <tbl:button |
---|
312 | disabled="<%=writePermission ? false : true%>" |
---|
313 | image="edit.gif" |
---|
314 | onclick="editItem()" |
---|
315 | title="Edit…" |
---|
316 | tooltip="<%=writePermission ? "Edit this experiment" : "You do not have permission to edit this experiment"%>" |
---|
317 | /> |
---|
318 | <tbl:button |
---|
319 | disabled="<%=deletePermission ? false : true%>" |
---|
320 | image="delete.gif" |
---|
321 | onclick="deleteItem()" |
---|
322 | title="Delete" |
---|
323 | visible="<%=!experiment.isRemoved()%>" |
---|
324 | tooltip="<%=deletePermission ? "Delete this experiment" : "You do not have permission to delete this experiment"%>" |
---|
325 | /> |
---|
326 | <tbl:button |
---|
327 | disabled="<%=writePermission ? false : true%>" |
---|
328 | image="restore.gif" |
---|
329 | onclick="restoreItem()" |
---|
330 | title="Restore" |
---|
331 | visible="<%=experiment.isRemoved()%>" |
---|
332 | tooltip="<%=writePermission ? "Restore this experiment" : "You do not have permission to restore this experiment"%>" |
---|
333 | /> |
---|
334 | <tbl:button |
---|
335 | disabled="<%=sharePermission ? false : true%>" |
---|
336 | image="share.gif" |
---|
337 | onclick="shareItem()" |
---|
338 | title="Share…" |
---|
339 | tooltip="<%=sharePermission ? "Share this experiment to other user, groups and projects" : "You do not have permission to share this experiment"%>" |
---|
340 | /> |
---|
341 | <tbl:button |
---|
342 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
343 | image="take_ownership.png" |
---|
344 | onclick="setOwner()" |
---|
345 | title="Set owner…" |
---|
346 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
347 | /> |
---|
348 | <tbl:button |
---|
349 | visible="<%=writePermission && (virtualDb.hasTable(VirtualTable.POSITION) || experiment.getRawDataType().isStoredInDb()) %>" |
---|
350 | image="copy.gif" |
---|
351 | onclick="cloneReporters()" |
---|
352 | title="Clone reporters…" |
---|
353 | tooltip="Clone reporter annotations for all reporters that are used in this experiment" |
---|
354 | /> |
---|
355 | <tbl:button |
---|
356 | visible="<%=writePermission && virtualDb.hasClonedReporters() %>" |
---|
357 | image="delete_permanently.png" |
---|
358 | onclick="removeClonedReporters()" |
---|
359 | title="Remove cloned reporters…" |
---|
360 | tooltip="Remove all cloned reporter annotations" |
---|
361 | /> |
---|
362 | <tbl:button |
---|
363 | image="import.gif" |
---|
364 | onclick="runPlugin('ImportItem')" |
---|
365 | title="Import…" |
---|
366 | tooltip="Import data" |
---|
367 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
368 | /> |
---|
369 | <tbl:button |
---|
370 | image="export.gif" |
---|
371 | onclick="runPlugin('ExportItem')" |
---|
372 | title="Export…" |
---|
373 | tooltip="Export data" |
---|
374 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
375 | /> |
---|
376 | <tbl:button |
---|
377 | image="runplugin.gif" |
---|
378 | onclick="runPlugin('RunPlugin')" |
---|
379 | title="Run plugin…" |
---|
380 | tooltip="Run a plugin" |
---|
381 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
382 | /> |
---|
383 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
384 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
385 | <tbl:button |
---|
386 | image="help.png" |
---|
387 | onclick="<%="Main.openHelp('" + ID +"', 'experiment.view.properties')"%>" |
---|
388 | title="Help…" |
---|
389 | tooltip="Get help about this page" |
---|
390 | /> |
---|
391 | </tbl:toolbar> |
---|
392 | <div class="boxedbottom"> |
---|
393 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(experiment)%></i></div> |
---|
394 | <% |
---|
395 | if (experiment.isRemoved() || experiment.isShared()) |
---|
396 | { |
---|
397 | %> |
---|
398 | <div class="itemstatus"> |
---|
399 | <base:icon |
---|
400 | image="<%=deletePermanentlyPermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
401 | onclick="<%=deletePermanentlyPermission ? "deleteItemPermanently()" : null%>" |
---|
402 | tooltip="<%=deletePermanentlyPermission ? "Permanently delete this item" : null%>" |
---|
403 | visible="<%=isRemoved%>"> This item has been flagged for deletion<br></base:icon> |
---|
404 | <base:icon image="used.gif" |
---|
405 | onclick="showUsingItems()" |
---|
406 | tooltip="Show the items that are using this one" |
---|
407 | visible="<%=isUsed%>"> This item is used by other items and can't be permanently deleted<br></base:icon> |
---|
408 | <base:icon image="shared.gif" |
---|
409 | visible="<%=experiment.isShared()%>"> This item is shared to other users, groups and/or projects</base:icon> |
---|
410 | </div> |
---|
411 | <% |
---|
412 | } |
---|
413 | %> |
---|
414 | <table class="form" cellspacing="0"> |
---|
415 | <tr> |
---|
416 | <td class="prompt">Name</td> |
---|
417 | <td><%=HTML.encodeTags(experiment.getName())%></td> |
---|
418 | </tr> |
---|
419 | <tr> |
---|
420 | <td class="prompt">Registered</td> |
---|
421 | <td><%=dateFormatter.format(experiment.getEntryDate())%></td> |
---|
422 | </tr> |
---|
423 | <tr> |
---|
424 | <td class="prompt">Raw data type</td> |
---|
425 | <td><base:catch><%=HTML.encodeTags(experiment.getRawDataType().getName())%></base:catch></td> |
---|
426 | </tr> |
---|
427 | <tr> |
---|
428 | <td class="prompt">Directory</td> |
---|
429 | <td><base:propertyvalue item="<%=experiment%>" property="directory" /></td> |
---|
430 | </tr> |
---|
431 | <tr> |
---|
432 | <td class="prompt">Reporter clone template</td> |
---|
433 | <td><base:propertyvalue item="<%=experiment%>" property="virtualDb.reporterCloneTemplate" nulltext="<i>- no cloned reporters -</i>" /></td> |
---|
434 | </tr> |
---|
435 | <tr> |
---|
436 | <td class="prompt">Bytes</td> |
---|
437 | <td><%=Values.formatBytes(experiment.getBytes())%></td> |
---|
438 | </tr> |
---|
439 | <tr> |
---|
440 | <td class="prompt">Owner</td> |
---|
441 | <td><base:propertyvalue item="<%=experiment%>" property="owner" /></td> |
---|
442 | </tr> |
---|
443 | <tr> |
---|
444 | <td class="prompt">Description</td> |
---|
445 | <td><%=HTML.niceFormat(experiment.getDescription())%></td> |
---|
446 | </tr> |
---|
447 | </table> |
---|
448 | |
---|
449 | <base:section |
---|
450 | id="publication" |
---|
451 | title="Publication" |
---|
452 | context="<%=cc%>" |
---|
453 | > |
---|
454 | <table class="form" cellspacing="0"> |
---|
455 | <tr> |
---|
456 | <td class="prompt">PubMed ID</td> |
---|
457 | <td> |
---|
458 | <%=HTML.encodeTags(experiment.getPubMedId())%> |
---|
459 | <% |
---|
460 | int pubMedId = Values.getInt(experiment.getPubMedId(), -1); |
---|
461 | if (pubMedId != -1) |
---|
462 | { |
---|
463 | %> |
---|
464 | <b>Link to:</b> |
---|
465 | <a href="http://www.ebi.ac.uk/citexplore/citationDetails.do?externalId=<%=pubMedId%>&dataSource=MED" |
---|
466 | target="_new" title="External link to EBI Citation database" |
---|
467 | >EBI Citation database</a>, |
---|
468 | <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=PureSearch&db=pubmed&details_term=<%=pubMedId%>" |
---|
469 | target="_new" title="External link to NCBI Entrez PubMed">NCBI Entrez PubMed</a> |
---|
470 | <% |
---|
471 | } |
---|
472 | %> |
---|
473 | </td> |
---|
474 | </tr> |
---|
475 | <tr> |
---|
476 | <td class="prompt">Title</td> |
---|
477 | <td><%=HTML.niceFormat(experiment.getTitle())%></td> |
---|
478 | </tr> |
---|
479 | <tr> |
---|
480 | <td class="prompt">Publication date</td> |
---|
481 | <td><%=dateFormatter.format(experiment.getPublicationDate())%></td> |
---|
482 | </tr> |
---|
483 | <tr> |
---|
484 | <td class="prompt">Abstract</td> |
---|
485 | <td><%=HTML.niceFormat(experiment.getAbstract())%></td> |
---|
486 | </tr> |
---|
487 | <tr> |
---|
488 | <td class="prompt">Experiment design</td> |
---|
489 | <td><%=HTML.niceFormat(experiment.getExperimentDesign())%></td> |
---|
490 | </tr> |
---|
491 | <tr> |
---|
492 | <td class="prompt">Experiment type</td> |
---|
493 | <td><%=HTML.niceFormat(experiment.getExperimentType())%></td> |
---|
494 | </tr> |
---|
495 | <tr> |
---|
496 | <td class="prompt">Affiliations</td> |
---|
497 | <td><%=HTML.niceFormat(experiment.getAffiliations())%></td> |
---|
498 | </tr> |
---|
499 | <tr> |
---|
500 | <td class="prompt">Authors</td> |
---|
501 | <td><%=HTML.niceFormat(experiment.getAuthors())%></td> |
---|
502 | </tr> |
---|
503 | <tr> |
---|
504 | <td class="prompt">Publication</td> |
---|
505 | <td><%=HTML.niceFormat(experiment.getPublication())%></td> |
---|
506 | </tr> |
---|
507 | </table> |
---|
508 | </base:section> |
---|
509 | |
---|
510 | <% |
---|
511 | ItemQuery<AnnotationType> efQuery = experiment.getExperimentalFactors(); |
---|
512 | efQuery.include(Include.ALL); |
---|
513 | efQuery.order(Orders.asc(Hql.property("name"))); |
---|
514 | ItemResultList<AnnotationType> experimentalFactors = efQuery.list(dc); |
---|
515 | if (experimentalFactors.size() == 0) |
---|
516 | { |
---|
517 | %> |
---|
518 | <h4>Experimental factors</h4> |
---|
519 | No experimental factors has been added to this experiment |
---|
520 | (or, you don't have permission to view them). |
---|
521 | <% |
---|
522 | } |
---|
523 | else |
---|
524 | { |
---|
525 | %> |
---|
526 | <base:section |
---|
527 | id="experimentalFactors" |
---|
528 | title="<%="Experimental factors (" + experimentalFactors.size() +")"%>" |
---|
529 | context="<%=cc%>" |
---|
530 | > |
---|
531 | <table border="0" cellspacing="0" cellpadding="0" style="width: 100%; max-width: 1000px;"><tr><td> |
---|
532 | <tbl:table |
---|
533 | id="experimentalFactors" |
---|
534 | |
---|
535 | columns="all" |
---|
536 | action="index.jsp" |
---|
537 | > |
---|
538 | <tbl:hidden name="item_id" value="<%=Integer.toString(itemId)%>" /> |
---|
539 | <tbl:columndef |
---|
540 | id="name" |
---|
541 | title="Name" |
---|
542 | /> |
---|
543 | <tbl:columndef |
---|
544 | id="type" |
---|
545 | title="Value type" |
---|
546 | /> |
---|
547 | <tbl:columndef |
---|
548 | id="values" |
---|
549 | title="Used values" |
---|
550 | /> |
---|
551 | <tbl:columndef |
---|
552 | id="description" |
---|
553 | title="Description" |
---|
554 | /> |
---|
555 | <tbl:columndef |
---|
556 | id="status" |
---|
557 | title="Status" |
---|
558 | /> |
---|
559 | <tbl:data> |
---|
560 | <tbl:columns> |
---|
561 | </tbl:columns> |
---|
562 | <tbl:rows> |
---|
563 | <% |
---|
564 | for (AnnotationType item : experimentalFactors) |
---|
565 | { |
---|
566 | Type valueType = item.getValueType(); |
---|
567 | usedFactorValues.put(item, new HashSet<Object>()); |
---|
568 | factorValuesCount.put(item, 0); |
---|
569 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, valueType); |
---|
570 | %> |
---|
571 | <tbl:row> |
---|
572 | <tbl:cell column="name"><base:icon |
---|
573 | image="deleted.gif" |
---|
574 | tooltip="This item has been scheduled for deletion" |
---|
575 | visible="<%=item.isRemoved()%>" |
---|
576 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
577 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
578 | <tbl:cell column="type"> |
---|
579 | <%=valueType%> |
---|
580 | <%=item.isEnumeration() ? "(enumeration)" : ""%> |
---|
581 | </tbl:cell> |
---|
582 | <tbl:cell column="values"> |
---|
583 | <% |
---|
584 | if (!item.isEnumeration() && (valueType == Type.TEXT || valueType == Type.STRING)) |
---|
585 | { |
---|
586 | %> |
---|
587 | N/A |
---|
588 | <% |
---|
589 | } |
---|
590 | else |
---|
591 | { |
---|
592 | %> |
---|
593 | <div id="usedvalues.<%=item.getId()%>">Loading...</div> |
---|
594 | <% |
---|
595 | } |
---|
596 | %> |
---|
597 | </tbl:cell> |
---|
598 | <tbl:cell column="status" id="<%="status." + item.getId()%>"> |
---|
599 | </tbl:cell> |
---|
600 | </tbl:row> |
---|
601 | <% |
---|
602 | } |
---|
603 | %> |
---|
604 | </tbl:rows> |
---|
605 | </tbl:data> |
---|
606 | </tbl:table> |
---|
607 | <div align="right" id="warning.missing" style="display: none;"> |
---|
608 | <base:icon image="warning.gif" /> = Some raw bioassays are missing this factor value<br> |
---|
609 | <base:icon image="ok.png" /> = All raw bioassays have a value for this factor |
---|
610 | </div> |
---|
611 | </td></tr></table> |
---|
612 | </base:section> |
---|
613 | <% |
---|
614 | } |
---|
615 | %> |
---|
616 | <% |
---|
617 | ItemQuery<RawBioAssay> rbaQuery = experiment.getRawBioAssays(); |
---|
618 | rbaQuery.include(Include.ALL); |
---|
619 | rbaQuery.order(Orders.asc(Hql.property("name"))); |
---|
620 | ItemResultList<RawBioAssay> rawBioAssays = rbaQuery.list(dc); |
---|
621 | if (rawBioAssays.size() == 0) |
---|
622 | { |
---|
623 | %> |
---|
624 | <h4>Raw bioassays</h4> |
---|
625 | No raw bioassays has been added to this experiment |
---|
626 | (or, you don't have permission to view them). |
---|
627 | <% |
---|
628 | } |
---|
629 | else |
---|
630 | { |
---|
631 | %> |
---|
632 | <base:section |
---|
633 | id="rawbioassays" |
---|
634 | title="<%="Raw bioassays (" + rawBioAssays.size() +")"%>" |
---|
635 | context="<%=cc%>"> |
---|
636 | <tbl:table |
---|
637 | id="rawbioassays" |
---|
638 | |
---|
639 | columns="all" |
---|
640 | > |
---|
641 | <tbl:columndef |
---|
642 | id="name" |
---|
643 | title="Name" |
---|
644 | /> |
---|
645 | <tbl:columndef |
---|
646 | id="description" |
---|
647 | title="Description" |
---|
648 | /> |
---|
649 | <% |
---|
650 | for (AnnotationType at : experimentalFactors) |
---|
651 | { |
---|
652 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
653 | %> |
---|
654 | <tbl:columndef |
---|
655 | id="<%="at"+at.getId()%>" |
---|
656 | title="<%=HTML.encodeTags(at.getName())%>" |
---|
657 | formatter="<%=formatter%>" |
---|
658 | /> |
---|
659 | <% |
---|
660 | } |
---|
661 | %> |
---|
662 | <tbl:data> |
---|
663 | <tbl:columns> |
---|
664 | </tbl:columns> |
---|
665 | <tbl:rows> |
---|
666 | <% |
---|
667 | SnapshotManager manager = new SnapshotManager(); |
---|
668 | AnnotationTypeFilter annotationTypeFilter = new AnnotationTypeFilter(); |
---|
669 | for (RawBioAssay item : rawBioAssays) |
---|
670 | { |
---|
671 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
672 | AnnotationSetSnapshot snapshot = as == null ? null : manager.getSnapshot(dc, as.getId()); |
---|
673 | %> |
---|
674 | <tbl:row> |
---|
675 | <tbl:cell column="name"><base:icon |
---|
676 | image="deleted.gif" |
---|
677 | tooltip="This item has been scheduled for deletion" |
---|
678 | visible="<%=item.isRemoved()%>" |
---|
679 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
680 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
681 | <% |
---|
682 | for (AnnotationType at : experimentalFactors) |
---|
683 | { |
---|
684 | Unit unit = at.getDefaultUnit(); |
---|
685 | String unitSymbol = unit == null ? "" : " " + unit.getDisplaySymbol(); |
---|
686 | |
---|
687 | String value = "<i>- none -</i>"; |
---|
688 | annotationTypeFilter.setAnnotationType(at); |
---|
689 | List<AnnotationSnapshot> all = snapshot == null ? |
---|
690 | null : manager.findAnnotations(dc, snapshot, annotationTypeFilter, true); |
---|
691 | Map<Annotatable, List> factorValues = new HashMap<Annotatable, List>(); |
---|
692 | if (all != null && all.size() > 0) |
---|
693 | { |
---|
694 | for (AnnotationSnapshot a : all) |
---|
695 | { |
---|
696 | List values = a.getValues(); |
---|
697 | usedFactorValues.get(at).addAll(values); |
---|
698 | factorValuesCount.put(at, factorValuesCount.get(at)+1); |
---|
699 | Annotatable aItem = null; |
---|
700 | try |
---|
701 | { |
---|
702 | aItem = a.getItem(dc); |
---|
703 | } |
---|
704 | catch (Throwable t) |
---|
705 | {} |
---|
706 | List toAdd = factorValues.get(aItem); |
---|
707 | if (toAdd == null) |
---|
708 | { |
---|
709 | toAdd = new LinkedList(); |
---|
710 | factorValues.put(aItem, toAdd); |
---|
711 | } |
---|
712 | toAdd.addAll(values); |
---|
713 | } |
---|
714 | } |
---|
715 | %> |
---|
716 | <tbl:cell column="<%="at"+at.getId()%>" |
---|
717 | > |
---|
718 | <% |
---|
719 | for (Map.Entry<Annotatable, List> entry : factorValues.entrySet()) |
---|
720 | { |
---|
721 | Annotatable aItem = entry.getKey(); |
---|
722 | List values = entry.getValue(); |
---|
723 | %> |
---|
724 | <tbl:cellvalue list="<%=values%>" suffix="<%=unitSymbol%>"/> |
---|
725 | <% |
---|
726 | if (aItem != null && aItem.hasPermission(Permission.WRITE)) |
---|
727 | { |
---|
728 | %>: <base:icon image="edit.gif" |
---|
729 | onclick="<%="editAnnotation('"+aItem.getType().name()+"',"+aItem.getId()+","+at.getId()+")"%>" |
---|
730 | tooltip="Modify the values of this experimental factor" /> |
---|
731 | <% |
---|
732 | } |
---|
733 | } |
---|
734 | %> |
---|
735 | </tbl:cell> |
---|
736 | <% |
---|
737 | } |
---|
738 | %> |
---|
739 | </tbl:row> |
---|
740 | <% |
---|
741 | } |
---|
742 | %> |
---|
743 | </tbl:rows> |
---|
744 | </tbl:data> |
---|
745 | </tbl:table> |
---|
746 | </base:section> |
---|
747 | <% |
---|
748 | } |
---|
749 | %> |
---|
750 | <jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
---|
751 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
752 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
753 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
754 | <jsp:param name="title" value="Other items related to this experiment" /> |
---|
755 | </jsp:include> |
---|
756 | <% |
---|
757 | // Tables with users/groups/projects that this item is shared to |
---|
758 | MultiPermissions mp = new MultiPermissions(Collections.singleton(experiment)); |
---|
759 | ItemResultIterator<User> users = mp.getUsers().iterate(dc); |
---|
760 | ItemResultIterator<Group> groups = mp.getGroups().iterate(dc); |
---|
761 | ItemResultIterator<Project> projects = mp.getProjects().iterate(dc); |
---|
762 | |
---|
763 | if (users.hasNext() || groups.hasNext() || projects.hasNext()) |
---|
764 | { |
---|
765 | %> |
---|
766 | <base:section |
---|
767 | id="sharedTo" |
---|
768 | title="Shared to" |
---|
769 | context="<%=cc%>"> |
---|
770 | <tbl:table |
---|
771 | id="itemsSharedTo" |
---|
772 | |
---|
773 | columns="all" |
---|
774 | > |
---|
775 | <tbl:columndef |
---|
776 | id="itemType" |
---|
777 | title="Item type" |
---|
778 | /> |
---|
779 | <tbl:columndef |
---|
780 | id="name" |
---|
781 | title="Name" |
---|
782 | /> |
---|
783 | <tbl:columndef |
---|
784 | id="permissions" |
---|
785 | title="Permissions" |
---|
786 | /> |
---|
787 | <tbl:data> |
---|
788 | <tbl:columns> |
---|
789 | </tbl:columns> |
---|
790 | <tbl:rows> |
---|
791 | <% |
---|
792 | while(projects.hasNext()) |
---|
793 | { |
---|
794 | Project project = projects.next(); |
---|
795 | Set<Permission> permissions = mp.getPermissions(project).values().iterator().next(); |
---|
796 | %> |
---|
797 | <tbl:row> |
---|
798 | <tbl:cell column="itemType"><%=project.getType()%></tbl:cell> |
---|
799 | <tbl:cell column="name"><base:icon |
---|
800 | image="deleted.gif" |
---|
801 | tooltip="This item has been scheduled for deletion" |
---|
802 | visible="<%=project.isRemoved()%>" |
---|
803 | /><%=Base.getLinkedName(ID, project, false, true)%></tbl:cell> |
---|
804 | <tbl:cell column="permissions"> |
---|
805 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
806 | </tbl:cell> |
---|
807 | </tbl:row> |
---|
808 | <% |
---|
809 | } |
---|
810 | while(groups.hasNext()) |
---|
811 | { |
---|
812 | Group group = groups.next(); |
---|
813 | Set<Permission> permissions = mp.getPermissions(group).values().iterator().next(); |
---|
814 | %> |
---|
815 | <tbl:row> |
---|
816 | <tbl:cell column="itemType"><%=group.getType()%></tbl:cell> |
---|
817 | <tbl:cell column="name"><base:icon |
---|
818 | image="deleted.gif" |
---|
819 | tooltip="This item has been scheduled for deletion" |
---|
820 | visible="<%=group.isRemoved()%>" |
---|
821 | /><%=Base.getLinkedName(ID, group, false, true)%></tbl:cell> |
---|
822 | <tbl:cell column="permissions"> |
---|
823 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
824 | </tbl:cell> |
---|
825 | </tbl:row> |
---|
826 | <% |
---|
827 | } |
---|
828 | while (users.hasNext()) |
---|
829 | { |
---|
830 | User user = users.next(); |
---|
831 | Set<Permission> permissions = mp.getPermissions(user).values().iterator().next(); |
---|
832 | %> |
---|
833 | <tbl:row> |
---|
834 | <tbl:cell column="itemType"><%=user.getType()%></tbl:cell> |
---|
835 | <tbl:cell column="name"><base:icon |
---|
836 | image="deleted.gif" |
---|
837 | tooltip="This item has been scheduled for deletion" |
---|
838 | visible="<%=user.isRemoved()%>" |
---|
839 | /><%=Base.getLinkedName(ID, user, false, true)%></tbl:cell> |
---|
840 | <tbl:cell column="permissions"> |
---|
841 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
842 | </tbl:cell> |
---|
843 | </tbl:row> |
---|
844 | <% |
---|
845 | } |
---|
846 | %> |
---|
847 | </tbl:rows> |
---|
848 | </tbl:data> |
---|
849 | </tbl:table> |
---|
850 | </base:section> |
---|
851 | <% |
---|
852 | } |
---|
853 | else |
---|
854 | { |
---|
855 | %> |
---|
856 | <h4>Shared to</h4> |
---|
857 | This experiment is not shared |
---|
858 | (or, you don't have permission to view the ones it is shared to). |
---|
859 | <% |
---|
860 | } |
---|
861 | %> |
---|
862 | </div> |
---|
863 | |
---|
864 | <script language="JavaScript"> |
---|
865 | function initUsedFactorValues() |
---|
866 | { |
---|
867 | <% |
---|
868 | int numRawBioAssays = rawBioAssays.size(); |
---|
869 | for (Map.Entry<AnnotationType, Set<Object>> entry : usedFactorValues.entrySet()) |
---|
870 | { |
---|
871 | AnnotationType at = entry.getKey(); |
---|
872 | int numRawBioAssaysWithFactor = factorValuesCount.get(at); |
---|
873 | Type valueType = at.getValueType(); |
---|
874 | if (at.isEnumeration() || (valueType != Type.TEXT && valueType != Type.STRING)) |
---|
875 | { |
---|
876 | Set<Object> values = entry.getValue(); |
---|
877 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, valueType); |
---|
878 | Unit unit = at.getDefaultUnit(); |
---|
879 | if (unit != null) formatter = unit.getFormatter(formatter); |
---|
880 | String formattedValues = HTML.encodeTags(Values.getString(values, ", ", true, formatter)); |
---|
881 | %> |
---|
882 | setUsedFactorValue(<%=at.getId()%>, '<%=HTML.javaScriptEncode(formattedValues)%>'); |
---|
883 | <% |
---|
884 | } |
---|
885 | %> |
---|
886 | showStatus(<%=at.getId()%>, <%=numRawBioAssays%>, <%=numRawBioAssaysWithFactor%>); |
---|
887 | <% |
---|
888 | } |
---|
889 | %> |
---|
890 | } |
---|
891 | </script> |
---|
892 | </t:tab> |
---|
893 | |
---|
894 | <t:tab id="bioassaysets" title="Bioassay sets" /> |
---|
895 | <t:tab id="clonedreporters" |
---|
896 | title="Cloned reporters" |
---|
897 | visible="<%=virtualDb.hasClonedReporters() %>" |
---|
898 | tooltip="Show information about cloned reporters" |
---|
899 | /> |
---|
900 | <t:tab id="overview" title="Overview" |
---|
901 | tooltip="Display a tree overview of related items"> |
---|
902 | <% |
---|
903 | if ("overview".equals(tab)) |
---|
904 | { |
---|
905 | %> |
---|
906 | <jsp:include page="../../common/overview/overview.jsp"> |
---|
907 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
908 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
909 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
910 | </jsp:include> |
---|
911 | <% |
---|
912 | } |
---|
913 | %> |
---|
914 | </t:tab> |
---|
915 | <t:tab id="history" title="Change history" |
---|
916 | tooltip="Displays a log of all modifications made to this item" |
---|
917 | visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"> |
---|
918 | <% |
---|
919 | if ("history".equals(tab)) |
---|
920 | { |
---|
921 | %> |
---|
922 | <jsp:include page="../../common/history/frameset.jsp"> |
---|
923 | <jsp:param name="source_type" value="<%=itemType.name()%>" /> |
---|
924 | <jsp:param name="source_id" value="<%=itemId%>" /> |
---|
925 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
926 | </jsp:include> |
---|
927 | <% |
---|
928 | } |
---|
929 | %> |
---|
930 | </t:tab> |
---|
931 | </t:tabcontrol> |
---|
932 | |
---|
933 | </base:body> |
---|
934 | </base:page> |
---|
935 | <% |
---|
936 | } |
---|
937 | finally |
---|
938 | { |
---|
939 | if (dc != null) dc.close(); |
---|
940 | } |
---|
941 | |
---|
942 | %> |
---|