1 | <%-- $Id: view_experiment.jsp 6963 2015-10-02 06:20:12Z 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 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.Item" |
---|
30 | import="net.sf.basedb.core.ItemContext" |
---|
31 | import="net.sf.basedb.core.Permission" |
---|
32 | import="net.sf.basedb.core.Experiment" |
---|
33 | import="net.sf.basedb.core.VirtualDb" |
---|
34 | import="net.sf.basedb.core.RawBioAssay" |
---|
35 | import="net.sf.basedb.core.RootRawBioAssay" |
---|
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.VirtualTable" |
---|
45 | import="net.sf.basedb.core.ItemQuery" |
---|
46 | import="net.sf.basedb.core.ItemResultList" |
---|
47 | import="net.sf.basedb.core.ItemResultIterator" |
---|
48 | import="net.sf.basedb.core.Include" |
---|
49 | import="net.sf.basedb.core.MultiPermissions" |
---|
50 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
51 | import="net.sf.basedb.core.PluginDefinition" |
---|
52 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
53 | import="net.sf.basedb.core.plugin.Plugin" |
---|
54 | import="net.sf.basedb.core.Project" |
---|
55 | import="net.sf.basedb.core.query.Orders" |
---|
56 | import="net.sf.basedb.core.query.Hql" |
---|
57 | import="net.sf.basedb.clients.web.Base" |
---|
58 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
59 | import="net.sf.basedb.clients.web.ChangeHistoryUtil" |
---|
60 | import="net.sf.basedb.clients.web.util.HTML" |
---|
61 | import="net.sf.basedb.util.Values" |
---|
62 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
63 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
64 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
65 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
66 | import="net.sf.basedb.util.formatter.Formatter" |
---|
67 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
68 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
69 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
70 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
71 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
72 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
73 | import="java.util.Collections" |
---|
74 | import="java.util.Date" |
---|
75 | import="java.util.Map" |
---|
76 | import="java.util.HashMap" |
---|
77 | import="java.util.Set" |
---|
78 | import="java.util.HashSet" |
---|
79 | import="java.util.List" |
---|
80 | import="java.util.LinkedList" |
---|
81 | import="java.util.Date" |
---|
82 | import="org.json.simple.JSONObject" |
---|
83 | import="org.json.simple.JSONArray" |
---|
84 | %> |
---|
85 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
86 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
87 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
88 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
89 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
90 | <%! |
---|
91 | private static final Item itemType = Item.EXPERIMENT; |
---|
92 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
93 | %> |
---|
94 | <% |
---|
95 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
96 | final String ID = sc.getId(); |
---|
97 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
98 | final int itemId = cc.getId(); |
---|
99 | final String tab = Values.getString(request.getParameter("tab"), "properties"); |
---|
100 | final float scale = Base.getScale(sc); |
---|
101 | final String root = request.getContextPath(); |
---|
102 | final DbControl dc = sc.newDbControl(); |
---|
103 | try |
---|
104 | { |
---|
105 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
106 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
107 | |
---|
108 | String title = null; |
---|
109 | Experiment experiment = Experiment.getById(dc, itemId); |
---|
110 | VirtualDb virtualDb = experiment.getVirtualDb(); |
---|
111 | |
---|
112 | final boolean writePermission = experiment.hasPermission(Permission.WRITE); |
---|
113 | final boolean deletePermission = experiment.hasPermission(Permission.DELETE); |
---|
114 | final boolean sharePermission = experiment.hasPermission(Permission.SET_PERMISSION); |
---|
115 | final boolean setOwnerPermission = experiment.hasPermission(Permission.SET_OWNER); |
---|
116 | final boolean isOwner = experiment.isOwner(); |
---|
117 | final boolean isRemoved = experiment.isRemoved(); |
---|
118 | final boolean isUsed = isRemoved && experiment.isUsed(); |
---|
119 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
120 | |
---|
121 | Map<AnnotationType, Set<Object>> usedFactorValues = |
---|
122 | new HashMap<AnnotationType, Set<Object>>(); |
---|
123 | Map<AnnotationType, Integer> factorValuesCount = new HashMap<AnnotationType, Integer>(); |
---|
124 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, experiment); |
---|
125 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
126 | %> |
---|
127 | <base:page title="<%=title%>" id="view-page"> |
---|
128 | <base:head scripts="table.js,tabcontrol-2.js,~experiments.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> |
---|
129 | <ext:scripts context="<%=jspContext%>" /> |
---|
130 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
131 | </base:head> |
---|
132 | <base:body> |
---|
133 | <p:path><p:pathelement |
---|
134 | title="Experiments" href="<%="index.jsp?ID="+ID%>" |
---|
135 | /><p:pathelement title="<%=HTML.encodeTags(experiment.getName())%>" |
---|
136 | /></p:path> |
---|
137 | <div id="page-data" data-item-id="<%=itemId%>"></div> |
---|
138 | |
---|
139 | <t:tabcontrol |
---|
140 | id="main" |
---|
141 | subclass="content mastertabcontrol" |
---|
142 | active="<%=tab%>" remember="false"> |
---|
143 | <t:tab id="properties" title="Properties"> |
---|
144 | <div> |
---|
145 | <table class="fullform"> |
---|
146 | <tr> |
---|
147 | <th class="itemstatus"> |
---|
148 | <base:icon |
---|
149 | image="shared.png" |
---|
150 | visible="<%=experiment.isShared()%>" |
---|
151 | tooltip="This item is shared to other users, groups and/or projects" |
---|
152 | /> |
---|
153 | <base:icon |
---|
154 | id="btnDeletePermanently" |
---|
155 | image="deleted.png" |
---|
156 | tooltip="This item has been flagged for deletion. Click to delete it now." |
---|
157 | enabled="<%=deletePermanentlyPermission %>" |
---|
158 | visible="<%=isRemoved%>" |
---|
159 | /> |
---|
160 | <base:icon |
---|
161 | id="btnUsingItems" |
---|
162 | image="used.png" |
---|
163 | tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" |
---|
164 | visible="<%=isRemoved && isUsed%>" /> |
---|
165 | </th> |
---|
166 | <td style="padding: 0px;"> |
---|
167 | <tbl:toolbar subclass="bottomborder bg-filled-50"> |
---|
168 | <tbl:button |
---|
169 | id="btnEdit" |
---|
170 | disabled="<%=!writePermission%>" |
---|
171 | image="edit.png" |
---|
172 | title="Edit…" |
---|
173 | tooltip="<%=writePermission ? "Edit this experiment" : "You do not have permission to edit this experiment"%>" |
---|
174 | /> |
---|
175 | <tbl:button |
---|
176 | id="btnDelete" |
---|
177 | disabled="<%=!deletePermission%>" |
---|
178 | image="delete.png" |
---|
179 | title="Delete" |
---|
180 | visible="<%=!experiment.isRemoved()%>" |
---|
181 | tooltip="<%=deletePermission ? "Delete this experiment" : "You do not have permission to delete this experiment"%>" |
---|
182 | /> |
---|
183 | <tbl:button |
---|
184 | id="btnRestore" |
---|
185 | disabled="<%=!writePermission%>" |
---|
186 | image="restore.png" |
---|
187 | title="Restore" |
---|
188 | visible="<%=experiment.isRemoved()%>" |
---|
189 | tooltip="<%=writePermission ? "Restore this experiment" : "You do not have permission to restore this experiment"%>" |
---|
190 | /> |
---|
191 | <tbl:button |
---|
192 | id="btnShare" |
---|
193 | disabled="<%=!sharePermission%>" |
---|
194 | image="share.png" |
---|
195 | title="Share…" |
---|
196 | tooltip="<%=sharePermission ? "Share this experiment to other user, groups and projects" : "You do not have permission to share this experiment"%>" |
---|
197 | /> |
---|
198 | <tbl:button |
---|
199 | id="btnSetOwner" |
---|
200 | disabled="<%=!setOwnerPermission%>" |
---|
201 | image="take_ownership.png" |
---|
202 | title="Set owner…" |
---|
203 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
204 | /> |
---|
205 | <tbl:button |
---|
206 | id="btnCloneReporters" |
---|
207 | visible="<%=writePermission && (virtualDb.hasTable(VirtualTable.POSITION) || experiment.getRawDataType().isStoredInDb()) %>" |
---|
208 | image="copy.png" |
---|
209 | title="Clone reporters…" |
---|
210 | tooltip="Clone reporter annotations for all reporters that are used in this experiment" |
---|
211 | /> |
---|
212 | <tbl:button |
---|
213 | id="btnRemoveClonedReporters" |
---|
214 | visible="<%=writePermission && virtualDb.hasClonedReporters() %>" |
---|
215 | image="delete_permanently.png" |
---|
216 | title="Remove cloned reporters…" |
---|
217 | tooltip="Remove all cloned reporter annotations" |
---|
218 | /> |
---|
219 | <tbl:button |
---|
220 | id="btnImport" |
---|
221 | image="import.png" |
---|
222 | data-plugin-type="IMPORT" |
---|
223 | title="Import…" |
---|
224 | tooltip="Import data" |
---|
225 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
226 | /> |
---|
227 | <tbl:button |
---|
228 | id="btnExport" |
---|
229 | image="export.png" |
---|
230 | data-plugin-type="EXPORT" |
---|
231 | title="Export…" |
---|
232 | tooltip="Export data" |
---|
233 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
234 | /> |
---|
235 | <tbl:button |
---|
236 | id="btnRunPlugin" |
---|
237 | image="runplugin.png" |
---|
238 | data-plugin-type="OTHER" |
---|
239 | title="Run plugin…" |
---|
240 | tooltip="Run a plugin" |
---|
241 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
242 | /> |
---|
243 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
244 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
245 | <tbl:button |
---|
246 | image="help.png" |
---|
247 | subclass="auto-init" |
---|
248 | data-auto-init="help" |
---|
249 | data-help-id="experiment.view.properties" |
---|
250 | title="Help…" |
---|
251 | tooltip="Get help about this page" |
---|
252 | /> |
---|
253 | </tbl:toolbar> |
---|
254 | </td> |
---|
255 | </tr> |
---|
256 | </table> |
---|
257 | <table style="width: 100%; height: 16em;" class="bottomborder"> |
---|
258 | <tr> |
---|
259 | <td style="width: 50%; height: 100%;"> |
---|
260 | <table class="fullform" > |
---|
261 | <tr> |
---|
262 | <th>Name</th> |
---|
263 | <td><%=HTML.encodeTags(experiment.getName())%></td> |
---|
264 | </tr> |
---|
265 | <tr> |
---|
266 | <th>Registered</th> |
---|
267 | <td><%=dateFormatter.format(experiment.getEntryDate())%></td> |
---|
268 | </tr> |
---|
269 | <tr> |
---|
270 | <th>Raw data type</th> |
---|
271 | <td><base:catch><%=HTML.encodeTags(experiment.getRawDataType().getName())%></base:catch></td> |
---|
272 | </tr> |
---|
273 | <tr> |
---|
274 | <th>Directory</th> |
---|
275 | <td><base:propertyvalue item="<%=experiment%>" property="directory" /></td> |
---|
276 | </tr> |
---|
277 | <tr> |
---|
278 | <th>Reporter clone template</th> |
---|
279 | <td><base:propertyvalue item="<%=experiment%>" property="virtualDb.reporterCloneTemplate" nulltext="<i>- no cloned reporters -</i>" /></td> |
---|
280 | </tr> |
---|
281 | <tr> |
---|
282 | <th>Bytes</th> |
---|
283 | <td><%=Values.formatBytes(experiment.getBytes())%></td> |
---|
284 | </tr> |
---|
285 | <tr> |
---|
286 | <th>Owner</th> |
---|
287 | <td><base:propertyvalue item="<%=experiment%>" property="owner" /></td> |
---|
288 | </tr> |
---|
289 | <tr> |
---|
290 | <th>Permissions</th> |
---|
291 | <td><%=PermissionUtil.getFullPermissionNames(experiment)%></td> |
---|
292 | </tr> |
---|
293 | <tr class="dynamic"> |
---|
294 | <th>Description</th> |
---|
295 | <td><%=HTML.niceFormat(experiment.getDescription())%></td> |
---|
296 | </tr> |
---|
297 | </table> |
---|
298 | </td> |
---|
299 | <td style="width: 50%; height: 100%;" class="leftborder"> |
---|
300 | <table class="fullform"> |
---|
301 | <tr> |
---|
302 | <th>PubMed ID</th> |
---|
303 | <td> |
---|
304 | <%=HTML.encodeTags(experiment.getPubMedId())%> |
---|
305 | <% |
---|
306 | int pubMedId = Values.getInt(experiment.getPubMedId(), -1); |
---|
307 | if (pubMedId != -1) |
---|
308 | { |
---|
309 | %> |
---|
310 | <b>Link to:</b> |
---|
311 | <a href="http://www.ebi.ac.uk/citexplore/citationDetails.do?externalId=<%=pubMedId%>&dataSource=MED" |
---|
312 | target="_blank" title="External link to EBI Citation database" |
---|
313 | >EBI Citation database</a>, |
---|
314 | <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=PureSearch&db=pubmed&details_term=<%=pubMedId%>" |
---|
315 | target="_blank" title="External link to NCBI Entrez PubMed">NCBI Entrez PubMed</a> |
---|
316 | <% |
---|
317 | } |
---|
318 | %> |
---|
319 | </td> |
---|
320 | </tr> |
---|
321 | <tr> |
---|
322 | <th>Title</th> |
---|
323 | <td><%=HTML.niceFormat(experiment.getTitle())%></td> |
---|
324 | </tr> |
---|
325 | <tr> |
---|
326 | <th>Publication date</th> |
---|
327 | <td><%=dateFormatter.format(experiment.getPublicationDate())%></td> |
---|
328 | </tr> |
---|
329 | <tr> |
---|
330 | <th>Abstract</th> |
---|
331 | <td><%=HTML.niceFormat(experiment.getAbstract())%></td> |
---|
332 | </tr> |
---|
333 | <tr> |
---|
334 | <th>Experiment design</th> |
---|
335 | <td><%=HTML.niceFormat(experiment.getExperimentDesign())%></td> |
---|
336 | </tr> |
---|
337 | <tr> |
---|
338 | <th>Experiment type</th> |
---|
339 | <td><%=HTML.niceFormat(experiment.getExperimentType())%></td> |
---|
340 | </tr> |
---|
341 | <tr> |
---|
342 | <th>Affiliations</th> |
---|
343 | <td><%=HTML.niceFormat(experiment.getAffiliations())%></td> |
---|
344 | </tr> |
---|
345 | <tr> |
---|
346 | <th>Authors</th> |
---|
347 | <td><%=HTML.niceFormat(experiment.getAuthors())%></td> |
---|
348 | </tr> |
---|
349 | <tr class="dynamic"> |
---|
350 | <th>Publication</th> |
---|
351 | <td><%=HTML.niceFormat(experiment.getPublication())%></td> |
---|
352 | </tr> |
---|
353 | </table> |
---|
354 | </td> |
---|
355 | </tr> |
---|
356 | </table> |
---|
357 | </div> |
---|
358 | |
---|
359 | <% |
---|
360 | ItemQuery<AnnotationType> efQuery = experiment.getExperimentalFactors(); |
---|
361 | efQuery.include(Include.ALL); |
---|
362 | efQuery.order(Orders.asc(Hql.property("name"))); |
---|
363 | ItemResultList<AnnotationType> experimentalFactors = efQuery.list(dc); |
---|
364 | %> |
---|
365 | <base:section |
---|
366 | id="experimentalFactors" |
---|
367 | title="<%="Experimental factors (" + experimentalFactors.size() +")"%>" |
---|
368 | context="<%=cc%>" |
---|
369 | > |
---|
370 | <% |
---|
371 | if (experimentalFactors.size() == 0) |
---|
372 | { |
---|
373 | %> |
---|
374 | <div class="messagecontainer note"> |
---|
375 | No experimental factors has been added to this experiment |
---|
376 | (or, you don't have permission to view them). |
---|
377 | </div> |
---|
378 | <% |
---|
379 | } |
---|
380 | else |
---|
381 | { |
---|
382 | %> |
---|
383 | |
---|
384 | <tbl:table |
---|
385 | id="tbl.experimentalFactors" |
---|
386 | columns="all" |
---|
387 | action="index.jsp" |
---|
388 | > |
---|
389 | <tbl:hidden name="item_id" value="<%=Integer.toString(itemId)%>" /> |
---|
390 | <tbl:columndef |
---|
391 | id="name" |
---|
392 | title="Name" |
---|
393 | /> |
---|
394 | <tbl:columndef |
---|
395 | id="type" |
---|
396 | title="Value type" |
---|
397 | /> |
---|
398 | <tbl:columndef |
---|
399 | id="values" |
---|
400 | title="Used values" |
---|
401 | /> |
---|
402 | <tbl:columndef |
---|
403 | id="description" |
---|
404 | title="Description" |
---|
405 | /> |
---|
406 | <tbl:columndef |
---|
407 | id="status" |
---|
408 | title="Status" |
---|
409 | /> |
---|
410 | <tbl:data> |
---|
411 | <tbl:headers> |
---|
412 | <tbl:headerrow> |
---|
413 | <tbl:columnheaders /> |
---|
414 | </tbl:headerrow> |
---|
415 | </tbl:headers> |
---|
416 | <tbl:rows> |
---|
417 | <% |
---|
418 | for (AnnotationType item : experimentalFactors) |
---|
419 | { |
---|
420 | Type valueType = item.getValueType(); |
---|
421 | usedFactorValues.put(item, new HashSet<Object>()); |
---|
422 | factorValuesCount.put(item, 0); |
---|
423 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, valueType); |
---|
424 | %> |
---|
425 | <tbl:row> |
---|
426 | <tbl:cell column="name"><base:icon |
---|
427 | image="deleted.png" |
---|
428 | tooltip="This item has been scheduled for deletion" |
---|
429 | visible="<%=item.isRemoved()%>" |
---|
430 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
431 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
432 | <tbl:cell column="type"> |
---|
433 | <%=valueType%> |
---|
434 | <%=item.isEnumeration() ? "(enumeration)" : ""%> |
---|
435 | </tbl:cell> |
---|
436 | <tbl:cell column="values"> |
---|
437 | <% |
---|
438 | if (!item.isEnumeration() && (valueType == Type.TEXT || valueType == Type.STRING)) |
---|
439 | { |
---|
440 | %> |
---|
441 | N/A |
---|
442 | <% |
---|
443 | } |
---|
444 | else |
---|
445 | { |
---|
446 | %> |
---|
447 | <div id="usedvalues.<%=item.getId()%>">Loading...</div> |
---|
448 | <% |
---|
449 | } |
---|
450 | %> |
---|
451 | </tbl:cell> |
---|
452 | <tbl:cell column="status" id="<%="status." + item.getId()%>"> |
---|
453 | </tbl:cell> |
---|
454 | </tbl:row> |
---|
455 | <% |
---|
456 | } |
---|
457 | %> |
---|
458 | </tbl:rows> |
---|
459 | </tbl:data> |
---|
460 | </tbl:table> |
---|
461 | <div id="warning.missing" style="display: none; text-align: right;"> |
---|
462 | <base:icon image="warning.png" /> = Some raw bioassays are missing this factor value |
---|
463 | </div> |
---|
464 | <% |
---|
465 | } |
---|
466 | %> |
---|
467 | </base:section> |
---|
468 | <% |
---|
469 | ItemQuery<RootRawBioAssay> rbaQuery = experiment.getRootRawBioAssays(); |
---|
470 | rbaQuery.include(Include.ALL); |
---|
471 | rbaQuery.order(Orders.asc(Hql.property("rawBioAssay.name"))); |
---|
472 | ItemResultList<RootRawBioAssay> rawBioAssays = rbaQuery.list(dc); |
---|
473 | %> |
---|
474 | <base:section |
---|
475 | id="rawbioassays" |
---|
476 | title="<%="Root raw bioassays (" + rawBioAssays.size() +")"%>" |
---|
477 | context="<%=cc%>"> |
---|
478 | <% |
---|
479 | if (rawBioAssays.size() == 0) |
---|
480 | { |
---|
481 | %> |
---|
482 | <div class="messagecontainer note"> |
---|
483 | No raw bioassays has been added to this experiment |
---|
484 | (or, you don't have permission to view them). |
---|
485 | </div> |
---|
486 | <% |
---|
487 | } |
---|
488 | else |
---|
489 | { |
---|
490 | %> |
---|
491 | <tbl:table |
---|
492 | id="tbl.rawbioassays" |
---|
493 | columns="all" |
---|
494 | > |
---|
495 | <tbl:columndef |
---|
496 | id="name" |
---|
497 | title="Name" |
---|
498 | /> |
---|
499 | <tbl:columndef |
---|
500 | id="description" |
---|
501 | title="Description" |
---|
502 | /> |
---|
503 | <% |
---|
504 | for (AnnotationType at : experimentalFactors) |
---|
505 | { |
---|
506 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
507 | %> |
---|
508 | <tbl:columndef |
---|
509 | id="<%="at"+at.getId()%>" |
---|
510 | title="<%=HTML.encodeTags(at.getName())%>" |
---|
511 | formatter="<%=formatter%>" |
---|
512 | /> |
---|
513 | <% |
---|
514 | } |
---|
515 | %> |
---|
516 | <tbl:data> |
---|
517 | <tbl:headers> |
---|
518 | <tbl:headerrow> |
---|
519 | <tbl:columnheaders /> |
---|
520 | </tbl:headerrow> |
---|
521 | </tbl:headers> |
---|
522 | <tbl:rows> |
---|
523 | <% |
---|
524 | SnapshotManager manager = new SnapshotManager(); |
---|
525 | AnnotationTypeFilter annotationTypeFilter = new AnnotationTypeFilter(); |
---|
526 | for (RootRawBioAssay item : rawBioAssays) |
---|
527 | { |
---|
528 | RawBioAssay rba = item.getRawBioAssay(); |
---|
529 | AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; |
---|
530 | AnnotationSetSnapshot snapshot = as == null ? null : manager.getSnapshot(dc, as.getId()); |
---|
531 | %> |
---|
532 | <tbl:row> |
---|
533 | <tbl:cell column="name"><base:icon |
---|
534 | image="deleted.png" |
---|
535 | tooltip="This item has been scheduled for deletion" |
---|
536 | visible="<%=rba.isRemoved()%>" |
---|
537 | /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> |
---|
538 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
539 | <% |
---|
540 | for (AnnotationType at : experimentalFactors) |
---|
541 | { |
---|
542 | Unit unit = at.getDefaultUnit(); |
---|
543 | String unitSymbol = unit == null ? "" : " " + unit.getDisplaySymbol(); |
---|
544 | |
---|
545 | annotationTypeFilter.setAnnotationType(at); |
---|
546 | List<AnnotationSnapshot> all = snapshot == null ? |
---|
547 | null : manager.findAnnotations(dc, snapshot, annotationTypeFilter, true); |
---|
548 | %> |
---|
549 | <tbl:cell column="<%="at"+at.getId()%>"> |
---|
550 | <% |
---|
551 | if (all != null && all.size() > 0) |
---|
552 | { |
---|
553 | for (AnnotationSnapshot a : all) |
---|
554 | { |
---|
555 | factorValuesCount.put(at, factorValuesCount.get(at)+1); |
---|
556 | List values = a.getActualValues(); |
---|
557 | boolean isUpToDate = a.isUpToDate(); |
---|
558 | usedFactorValues.get(at).addAll(values); |
---|
559 | %> |
---|
560 | <tbl:cellvalue list="<%=values%>" suffix="<%=unitSymbol%>"/> |
---|
561 | <base:icon |
---|
562 | subclass="link auto-init" |
---|
563 | data-auto-init="edit-experimental-factor" |
---|
564 | data-item-type="<%=a.getThisItemType().name()%>" |
---|
565 | data-item-id="<%=a.getThisItemId() %>" |
---|
566 | data-annotation-type="<%=at.getId() %>" |
---|
567 | data-annotation="<%=a.getThisAnnotationId()%>" |
---|
568 | visible="<%=writePermission%>" |
---|
569 | image="<%=isUpToDate ? "edit.png" : "edit-outofsync.png"%>" |
---|
570 | tooltip="Modify the values of this experimental factor" |
---|
571 | /> |
---|
572 | <% |
---|
573 | } |
---|
574 | } |
---|
575 | %> |
---|
576 | </tbl:cell> |
---|
577 | <% |
---|
578 | } |
---|
579 | %> |
---|
580 | </tbl:row> |
---|
581 | <% |
---|
582 | } |
---|
583 | %> |
---|
584 | </tbl:rows> |
---|
585 | </tbl:data> |
---|
586 | </tbl:table> |
---|
587 | <% |
---|
588 | } |
---|
589 | %> |
---|
590 | </base:section> |
---|
591 | <jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
---|
592 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
593 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
594 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
595 | <jsp:param name="title" value="Other items related to this experiment" /> |
---|
596 | </jsp:include> |
---|
597 | <jsp:include page="../../common/share/list_share.jsp"> |
---|
598 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
599 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
600 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
601 | <jsp:param name="title" value="Shared to" /> |
---|
602 | </jsp:include> |
---|
603 | |
---|
604 | <% |
---|
605 | JSONArray jsonFactorValues = new JSONArray(); |
---|
606 | for (Map.Entry<AnnotationType, Set<Object>> entry : usedFactorValues.entrySet()) |
---|
607 | { |
---|
608 | AnnotationType at = entry.getKey(); |
---|
609 | |
---|
610 | JSONObject jsonAt = new JSONObject(); |
---|
611 | jsonAt.put("id", at.getId()); |
---|
612 | jsonAt.put("disableInheritance", at.getDisableInheritance() ? 1 : 0); |
---|
613 | jsonAt.put("numRawBioAssaysWithFactor", factorValuesCount.get(at)); |
---|
614 | |
---|
615 | Type valueType = at.getValueType(); |
---|
616 | if (at.isEnumeration() || (valueType != Type.TEXT && valueType != Type.STRING)) |
---|
617 | { |
---|
618 | Set<Object> values = entry.getValue(); |
---|
619 | Formatter formatter = FormatterFactory.getTypeFormatter(sc, valueType); |
---|
620 | Unit unit = at.getDefaultUnit(); |
---|
621 | if (unit != null) formatter = unit.getFormatter(formatter); |
---|
622 | String formattedValues = HTML.encodeTags(Values.getString(values, ", ", true, formatter)); |
---|
623 | jsonAt.put("usedValues", formattedValues); |
---|
624 | } |
---|
625 | |
---|
626 | jsonFactorValues.add(jsonAt); |
---|
627 | } |
---|
628 | %> |
---|
629 | <div id="factor-values" class="datacontainer" |
---|
630 | data-num-raw-bioassays="<%=rawBioAssays.size() %>" |
---|
631 | data-factor-values="<%=HTML.encodeTags(jsonFactorValues.toJSONString()) %>" |
---|
632 | ></div> |
---|
633 | |
---|
634 | </t:tab> |
---|
635 | <t:tab id="annotations" title="Annotations" |
---|
636 | tooltip="View annotation values" clazz="white"> |
---|
637 | <jsp:include page="../../common/annotations/list_frameset.jsp"> |
---|
638 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
639 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
640 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
641 | </jsp:include> |
---|
642 | </t:tab> |
---|
643 | |
---|
644 | <t:tab id="bioassaysets" title="Bioassay sets" /> |
---|
645 | <t:tab id="clonedreporters" |
---|
646 | title="Cloned reporters" |
---|
647 | visible="<%=virtualDb.hasClonedReporters() %>" |
---|
648 | tooltip="Show information about cloned reporters" |
---|
649 | /> |
---|
650 | <t:tab id="overview" title="Overview" |
---|
651 | tooltip="Display a tree overview of related items"> |
---|
652 | <jsp:include page="../../common/overview/overview.jsp"> |
---|
653 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
654 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
655 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
656 | </jsp:include> |
---|
657 | </t:tab> |
---|
658 | <t:tab id="history" title="Change history" |
---|
659 | tooltip="Displays a log of all modifications made to this item" |
---|
660 | visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"> |
---|
661 | <jsp:include page="../../common/history/frameset.jsp"> |
---|
662 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
663 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
664 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
665 | </jsp:include> |
---|
666 | </t:tab> |
---|
667 | </t:tabcontrol> |
---|
668 | |
---|
669 | </base:body> |
---|
670 | </base:page> |
---|
671 | <% |
---|
672 | } |
---|
673 | finally |
---|
674 | { |
---|
675 | if (dc != null) dc.close(); |
---|
676 | } |
---|
677 | |
---|
678 | %> |
---|