1 | <%-- $Id: analysis_tree.jsp 7914 2021-02-23 07:23:26Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 Johan Enell, Jari Häkkinen, 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.Item" |
---|
30 | import="net.sf.basedb.core.ItemContext" |
---|
31 | import="net.sf.basedb.core.BasicItem" |
---|
32 | import="net.sf.basedb.core.Experiment" |
---|
33 | import="net.sf.basedb.core.BioAssaySet" |
---|
34 | import="net.sf.basedb.core.Transformation" |
---|
35 | import="net.sf.basedb.core.ExtraValue" |
---|
36 | import="net.sf.basedb.core.ExtraValueType" |
---|
37 | import="net.sf.basedb.core.AnnotationSet" |
---|
38 | import="net.sf.basedb.core.AnnotationType" |
---|
39 | import="net.sf.basedb.core.Annotation" |
---|
40 | import="net.sf.basedb.core.Job" |
---|
41 | import="net.sf.basedb.core.ItemQuery" |
---|
42 | import="net.sf.basedb.core.Nameable" |
---|
43 | import="net.sf.basedb.core.ItemResultIterator" |
---|
44 | import="net.sf.basedb.core.ItemResultList" |
---|
45 | import="net.sf.basedb.core.Permission" |
---|
46 | import="net.sf.basedb.core.PluginDefinition" |
---|
47 | import="net.sf.basedb.core.PluginConfiguration" |
---|
48 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
49 | import="net.sf.basedb.core.query.Restrictions" |
---|
50 | import="net.sf.basedb.core.query.Expressions" |
---|
51 | import="net.sf.basedb.core.query.Orders" |
---|
52 | import="net.sf.basedb.core.query.Hql" |
---|
53 | import="net.sf.basedb.core.query.Restrictions" |
---|
54 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
55 | import="net.sf.basedb.core.plugin.Plugin" |
---|
56 | import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil" |
---|
57 | import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
---|
58 | import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
---|
59 | import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
---|
60 | import="net.sf.basedb.core.snapshot.SnapshotManager" |
---|
61 | import="net.sf.basedb.util.Tree" |
---|
62 | import="net.sf.basedb.util.Enumeration" |
---|
63 | import="net.sf.basedb.clients.web.Base" |
---|
64 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
65 | import="net.sf.basedb.clients.web.util.HTML" |
---|
66 | import="net.sf.basedb.util.Values" |
---|
67 | import="net.sf.basedb.util.formatter.Formatter" |
---|
68 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
69 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
70 | import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" |
---|
71 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
72 | import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
---|
73 | import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
---|
74 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
75 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
76 | import="net.sf.basedb.clients.web.util.ProjectSpecificInfoFilter" |
---|
77 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
78 | import="net.sf.basedb.util.extensions.Renderer" |
---|
79 | import="java.util.Date" |
---|
80 | import="java.util.List" |
---|
81 | import="java.util.ArrayList" |
---|
82 | import="java.util.LinkedList" |
---|
83 | import="java.util.Map" |
---|
84 | import="java.util.HashMap" |
---|
85 | import="java.util.Iterator" |
---|
86 | import="java.util.Collection" |
---|
87 | import="org.json.simple.JSONObject" |
---|
88 | import="org.json.simple.JSONArray" |
---|
89 | %> |
---|
90 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
91 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
92 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
93 | <%! |
---|
94 | private static final Item itemType = Item.BIOASSAYSET; |
---|
95 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
96 | %> |
---|
97 | <%! |
---|
98 | |
---|
99 | private static void addToTree(Tree<BasicItem> tree, BioAssaySet bas) |
---|
100 | { |
---|
101 | if (!tree.contains(bas)) |
---|
102 | { |
---|
103 | Transformation transformation = bas.getTransformation(); |
---|
104 | Tree.Entry<BasicItem> parent = tree.getEntry(transformation); |
---|
105 | if (parent == null) |
---|
106 | { |
---|
107 | addToTree(tree, transformation); |
---|
108 | parent = tree.getEntry(transformation); |
---|
109 | } |
---|
110 | Tree.Entry<BasicItem> basEntry = parent.addChild(bas); |
---|
111 | for (ExtraValue xv : bas.getExtraValues().list(bas.getDbControl())) |
---|
112 | { |
---|
113 | basEntry.addChild(xv); |
---|
114 | } |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | private static void addToTree(Tree<BasicItem> tree, Transformation transformation) |
---|
119 | { |
---|
120 | if (!tree.contains(transformation)) |
---|
121 | { |
---|
122 | BioAssaySet source = transformation.getSource(); |
---|
123 | Tree.Entry<BasicItem> parent = tree.getEntry(source); |
---|
124 | if (parent == null) |
---|
125 | { |
---|
126 | addToTree(tree, source); |
---|
127 | parent = tree.getEntry(source); |
---|
128 | } |
---|
129 | parent.addChild(transformation); |
---|
130 | } |
---|
131 | } |
---|
132 | |
---|
133 | private static Tree<BasicItem> getAnalysisTree(DbControl dc, ItemQuery<BioAssaySet> bioAssaySetQuery, ItemQuery<Transformation> transformationQuery) |
---|
134 | { |
---|
135 | Tree<BasicItem> tree = new Tree<BasicItem>(null); |
---|
136 | ItemResultList<BioAssaySet> allBioAssaySets = bioAssaySetQuery.list(dc); |
---|
137 | List<Integer> ids = new ArrayList<Integer>(allBioAssaySets.size()); |
---|
138 | |
---|
139 | for (BioAssaySet bas : allBioAssaySets) |
---|
140 | { |
---|
141 | addToTree(tree, bas); |
---|
142 | ids.add(bas.getId()); |
---|
143 | } |
---|
144 | |
---|
145 | transformationQuery.restrict( |
---|
146 | Restrictions.in( |
---|
147 | Hql.property("source.id"), |
---|
148 | Expressions.parameter("bioAssaySets", ids) |
---|
149 | ) |
---|
150 | ); |
---|
151 | ItemResultList<Transformation> allTransformations = transformationQuery.list(dc); |
---|
152 | for (Transformation t: allTransformations) |
---|
153 | { |
---|
154 | addToTree(tree, t); |
---|
155 | } |
---|
156 | return tree; |
---|
157 | } |
---|
158 | |
---|
159 | JSONArray generateSubTree(JSONObject jsonParent, BasicItem parent, Tree<BasicItem> tree, Collection<String> closed) |
---|
160 | { |
---|
161 | JSONArray json = new JSONArray(); |
---|
162 | |
---|
163 | Tree.Entry<BasicItem> parentEntry = tree.getEntry(parent); |
---|
164 | if (parentEntry == null) return json; |
---|
165 | |
---|
166 | if (jsonParent == null && parent != null) |
---|
167 | { |
---|
168 | Item parentType = parent.getType(); |
---|
169 | if (parentType == Item.BIOASSAYSET) |
---|
170 | { |
---|
171 | jsonParent = newJoustBioAssaySet(null, (BioAssaySet)parent, true); |
---|
172 | } |
---|
173 | else if (parentType == Item.TRANSFORMATION) |
---|
174 | { |
---|
175 | jsonParent = newJoustTransformation(null, (Transformation)parent, true); |
---|
176 | } |
---|
177 | if (jsonParent != null) |
---|
178 | { |
---|
179 | jsonParent.put("noOutlineIcon", 1); |
---|
180 | json.add(jsonParent); |
---|
181 | } |
---|
182 | } |
---|
183 | |
---|
184 | List<Tree.Entry<BasicItem>> children = parentEntry.getChildren(); |
---|
185 | if (children != null) |
---|
186 | { |
---|
187 | for (Tree.Entry<BasicItem> childEntry : children) |
---|
188 | { |
---|
189 | BasicItem child = childEntry.getNode(); |
---|
190 | Item childType = child.getType(); |
---|
191 | JSONObject jsonChild = null; |
---|
192 | String var = childType.name() + "_" + child.getId(); |
---|
193 | boolean isOpen = (closed == null || !closed.contains(var)) && childEntry.getNumChildren() > 0; |
---|
194 | if (childType == Item.BIOASSAYSET) |
---|
195 | { |
---|
196 | jsonChild = newJoustBioAssaySet(jsonParent, (BioAssaySet)child, isOpen); |
---|
197 | } |
---|
198 | else if (childType == Item.TRANSFORMATION) |
---|
199 | { |
---|
200 | jsonChild = newJoustTransformation(jsonParent, (Transformation)child, isOpen); |
---|
201 | } |
---|
202 | else if (childType == Item.EXTRAVALUE) |
---|
203 | { |
---|
204 | jsonChild = newJoustExtraValue(jsonParent, (ExtraValue)child, isOpen); |
---|
205 | } |
---|
206 | if (jsonParent == null) json.add(jsonChild); |
---|
207 | generateSubTree(jsonChild, child, tree, closed); |
---|
208 | } |
---|
209 | } |
---|
210 | return json; |
---|
211 | } |
---|
212 | |
---|
213 | |
---|
214 | JSONObject newJoustBioAssaySet(JSONObject jsonParent, BioAssaySet bas, boolean open) |
---|
215 | { |
---|
216 | String id = "BIOASSAYSET_"+bas.getId(); |
---|
217 | String name = bas.getName(); |
---|
218 | String icon = "BioAssaySet"; |
---|
219 | |
---|
220 | JSONObject json = newJoustEntry(jsonParent, icon, HTML.encodeTags(name), id); |
---|
221 | json.put("type", "bioassayset"); |
---|
222 | json.put("isOpen", open ? 1 : 0); |
---|
223 | return json; |
---|
224 | } |
---|
225 | |
---|
226 | JSONObject newJoustTransformation(JSONObject jsonParent, Transformation t, boolean open) |
---|
227 | { |
---|
228 | String id = "TRANSFORMATION_"+t.getId(); |
---|
229 | String name = t.getName(); |
---|
230 | String icon = "Transformation"; |
---|
231 | try |
---|
232 | { |
---|
233 | if (t.getJob().getPluginDefinition().supports("net.sf.basedb.core.plugin.AnalysisFilterPlugin")) |
---|
234 | { |
---|
235 | icon = "Filter"; |
---|
236 | } |
---|
237 | } |
---|
238 | catch (Throwable tt) |
---|
239 | {} |
---|
240 | |
---|
241 | JSONObject json = newJoustEntry(jsonParent, icon, HTML.encodeTags(name), id); |
---|
242 | json.put("type", "transformation"); |
---|
243 | json.put("isOpen", open ? 1 : 0); |
---|
244 | return json; |
---|
245 | } |
---|
246 | |
---|
247 | JSONObject newJoustExtraValue(JSONObject jsonParent, ExtraValue ev, boolean open) |
---|
248 | { |
---|
249 | String id = "EXTRAVALUE_"+ev.getId(); |
---|
250 | String name = ev.getValueType().toString(); |
---|
251 | String icon = "ExtraValue"; |
---|
252 | |
---|
253 | try |
---|
254 | { |
---|
255 | name = ev.getExtraValueType().getName(); |
---|
256 | } |
---|
257 | catch (PermissionDeniedException ex) |
---|
258 | {} |
---|
259 | |
---|
260 | JSONObject json = newJoustEntry(jsonParent, icon, HTML.encodeTags(name), id); |
---|
261 | json.put("type", "extra-value"); |
---|
262 | json.put("isOpen", open ? 1 : 0); |
---|
263 | return json; |
---|
264 | } |
---|
265 | |
---|
266 | JSONObject newJoustEntry(JSONObject jsonParent, String icon, String text, String id) |
---|
267 | { |
---|
268 | JSONObject jsonJoust = new JSONObject(); |
---|
269 | jsonJoust.put("icon", icon); |
---|
270 | jsonJoust.put("text", text); |
---|
271 | jsonJoust.put("id", id); |
---|
272 | if (jsonParent != null) |
---|
273 | { |
---|
274 | JSONArray jsonChildren = (JSONArray)jsonParent.get("children"); |
---|
275 | if (jsonChildren == null) |
---|
276 | { |
---|
277 | jsonChildren = new JSONArray(); |
---|
278 | jsonParent.put("children", jsonChildren); |
---|
279 | jsonParent.remove("isLazy"); |
---|
280 | } |
---|
281 | jsonChildren.add(jsonJoust); |
---|
282 | } |
---|
283 | return jsonJoust; |
---|
284 | } |
---|
285 | %> |
---|
286 | <% |
---|
287 | final int experimentId = Values.getInt(request.getParameter("experiment_id")); |
---|
288 | final int bioAssaySetId = Values.getInt(request.getParameter("item_id")); |
---|
289 | final int transformationId = Values.getInt(request.getParameter("transformation_id")); |
---|
290 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
291 | final String ID = sc.getId(); |
---|
292 | final String rootPath = request.getContextPath()+"/"; |
---|
293 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
294 | final ItemContext tc = sc.getCurrentContext(Item.TRANSFORMATION); |
---|
295 | final ItemContext xvc = sc.getCurrentContext(Item.EXTRAVALUE); |
---|
296 | |
---|
297 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
298 | final String callback = request.getParameter("callback"); |
---|
299 | final String title = mode.generateTitle("bioassay set", "bioassay sets"); |
---|
300 | final DbControl dc = sc.newDbControl(); |
---|
301 | Tree<BasicItem> analysisTree = null; |
---|
302 | List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>(); |
---|
303 | try |
---|
304 | { |
---|
305 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
306 | final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); |
---|
307 | SnapshotManager manager = new SnapshotManager(); |
---|
308 | ProjectSpecificInfoFilter psInfo = new ProjectSpecificInfoFilter(); |
---|
309 | for (AnnotationType at : annotationTypeQuery.list(dc)) |
---|
310 | { |
---|
311 | annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at)); |
---|
312 | } |
---|
313 | final Experiment experiment = Experiment.getById(dc, experimentId); |
---|
314 | final BasicItem root = transformationId == 0 ? |
---|
315 | (bioAssaySetId == 0 ? null : BioAssaySet.getById(dc, bioAssaySetId)) |
---|
316 | : Transformation.getById(dc, transformationId); |
---|
317 | final boolean createPermission = experiment.hasPermission(Permission.USE); |
---|
318 | final boolean deletePermission = createPermission; |
---|
319 | final boolean writePermission = createPermission; |
---|
320 | |
---|
321 | final ItemQuery<Transformation> transformationQuery = experiment.getTransformations(); |
---|
322 | transformationQuery.include(cc.getInclude()); |
---|
323 | transformationQuery.setFirstResult(0); |
---|
324 | transformationQuery.setMaxResults(-1); |
---|
325 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
326 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, |
---|
327 | guiContext, root == null ? experiment : root); |
---|
328 | try |
---|
329 | { |
---|
330 | final ItemQuery<BioAssaySet> query = Base.getConfiguredQuery(dc, cc, jspContext, true, experiment.getBioAssaySets(), mode); |
---|
331 | query.setFirstResult(0); |
---|
332 | query.setMaxResults(-1); |
---|
333 | analysisTree = getAnalysisTree(dc, query, transformationQuery); |
---|
334 | } |
---|
335 | catch (Throwable t) |
---|
336 | { |
---|
337 | cc.setMessage(t.getMessage()); |
---|
338 | t.printStackTrace(); |
---|
339 | } |
---|
340 | // Contains the ID:s of the bioassaysets that are closed in the tree |
---|
341 | Collection<String> closed = cc.getObject("closed"); |
---|
342 | int numListed = 0; |
---|
343 | |
---|
344 | ExtensionsInvoker<ButtonAction> toolsInvoker = ExtensionsControl.useExtensions(jspContext, |
---|
345 | "net.sf.basedb.clients.web.bioassayset.list.tools"); |
---|
346 | ExtensionsInvoker<ButtonAction> toolbarInvoker = ToolbarUtil.useExtensions(jspContext); |
---|
347 | ExtensionsInvoker<ListColumnAction<BioAssaySet,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
348 | |
---|
349 | JSONArray json = generateSubTree(null, root, analysisTree, closed); |
---|
350 | %> |
---|
351 | <base:page type="include"> |
---|
352 | <base:head scripts="joust-2.js,/views/experiments/bioassaysets/analysis_tree.js" /> |
---|
353 | <base:body> |
---|
354 | <ext:scripts context="<%=jspContext%>" /> |
---|
355 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
356 | |
---|
357 | <div id="tree-data" class="datacontainer" |
---|
358 | data-experiment-id="<%=experimentId%>" |
---|
359 | data-bioassayset-id="<%=bioAssaySetId%>" |
---|
360 | data-transformation-id="<%=transformationId %>" |
---|
361 | data-joust-tree="<%=HTML.encodeTags(json.toJSONString()) %>" |
---|
362 | ></div> |
---|
363 | |
---|
364 | <tbl:table |
---|
365 | id="bioAssaySets" |
---|
366 | columns="<%=cc.getSetting("columns")%>" |
---|
367 | sortby="<%=cc.getSortProperty()%>" |
---|
368 | direction="<%=cc.getSortDirection()%>" |
---|
369 | action="<%=transformationId != 0 ? "../bioassaysets/index.jsp" : "index.jsp"%>" |
---|
370 | sc="<%=sc%>" |
---|
371 | item="<%=itemType%>" |
---|
372 | filterrows="<%=cc.getFilterRows()%>" |
---|
373 | subclass="<%=root == null ? "fulltable" : "" %>" |
---|
374 | > |
---|
375 | <tbl:hidden |
---|
376 | name="mode" |
---|
377 | value="<%=mode.getName()%>" |
---|
378 | /> |
---|
379 | <tbl:hidden |
---|
380 | name="experiment_id" |
---|
381 | value="<%=String.valueOf(experimentId)%>" |
---|
382 | /> |
---|
383 | <tbl:hidden |
---|
384 | name="item_id" |
---|
385 | value="<%=String.valueOf(bioAssaySetId)%>" |
---|
386 | skip="<%=bioAssaySetId == 0%>" |
---|
387 | /> |
---|
388 | <tbl:hidden |
---|
389 | name="transformation_id" |
---|
390 | value="<%=String.valueOf(transformationId)%>" |
---|
391 | skip="<%=transformationId == 0%>" |
---|
392 | /> |
---|
393 | <tbl:hidden |
---|
394 | name="callback" |
---|
395 | value="<%=callback%>" |
---|
396 | skip="<%=callback == null%>" |
---|
397 | /> |
---|
398 | <tbl:hidden |
---|
399 | name="closed" |
---|
400 | value="<%=closed == null ? "," : ","+Values.getString(closed, ",", true)+","%>" |
---|
401 | /> |
---|
402 | <tbl:columndef |
---|
403 | id="name" |
---|
404 | property="name" |
---|
405 | datatype="string" |
---|
406 | title="Name" |
---|
407 | sortable="true" |
---|
408 | filterable="true" |
---|
409 | exportable="true" |
---|
410 | show="always" |
---|
411 | /> |
---|
412 | <tbl:columndef |
---|
413 | id="spots" |
---|
414 | property="numSpots" |
---|
415 | datatype="int" |
---|
416 | title="Spots/Values in db" |
---|
417 | sortable="true" |
---|
418 | filterable="true" |
---|
419 | exportable="true" |
---|
420 | /> |
---|
421 | <tbl:columndef |
---|
422 | id="reporters" |
---|
423 | property="numReporters" |
---|
424 | datatype="int" |
---|
425 | title="Reporters in db" |
---|
426 | sortable="true" |
---|
427 | filterable="true" |
---|
428 | exportable="true" |
---|
429 | /> |
---|
430 | <tbl:columndef |
---|
431 | id="fileSpots" |
---|
432 | property="numFileSpots" |
---|
433 | datatype="int" |
---|
434 | title="Spots/Values in file" |
---|
435 | sortable="true" |
---|
436 | filterable="true" |
---|
437 | exportable="true" |
---|
438 | /> |
---|
439 | <tbl:columndef |
---|
440 | id="fileReporters" |
---|
441 | property="numFileReporters" |
---|
442 | datatype="int" |
---|
443 | title="Reporters in file" |
---|
444 | sortable="true" |
---|
445 | filterable="true" |
---|
446 | exportable="true" |
---|
447 | /> |
---|
448 | <tbl:columndef |
---|
449 | id="date" |
---|
450 | property="transformation.job.ended" |
---|
451 | datatype="timestamp" |
---|
452 | title="Date" |
---|
453 | sortable="true" |
---|
454 | filterable="true" |
---|
455 | exportable="true" |
---|
456 | /> |
---|
457 | <tbl:columndef |
---|
458 | id="plugin" |
---|
459 | property="transformation.job.pluginDefinition.name" |
---|
460 | datatype="string" |
---|
461 | title="Plugin" |
---|
462 | sortable="true" |
---|
463 | filterable="true" |
---|
464 | exportable="true" |
---|
465 | /> |
---|
466 | <tbl:columndef |
---|
467 | id="description" |
---|
468 | property="description" |
---|
469 | datatype="string" |
---|
470 | title="Description" |
---|
471 | sortable="true" |
---|
472 | filterable="true" |
---|
473 | exportable="true" |
---|
474 | /> |
---|
475 | <% |
---|
476 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
477 | { |
---|
478 | AnnotationType at = loader.getAnnotationType(); |
---|
479 | Enumeration<String, String> annotationEnum = null; |
---|
480 | Formatter<Object> formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
---|
481 | if (at.isEnumeration()) |
---|
482 | { |
---|
483 | annotationEnum = new Enumeration<String, String>(); |
---|
484 | if (!at.getDisplayAsList()) annotationEnum.add("", "-none-"); |
---|
485 | List<?> values = at.getValues(); |
---|
486 | for (Object value : values) |
---|
487 | { |
---|
488 | String encoded = formatter.format(value); |
---|
489 | annotationEnum.add(encoded, encoded); |
---|
490 | } |
---|
491 | } |
---|
492 | %> |
---|
493 | <tbl:columndef |
---|
494 | id="<%="at"+at.getId()%>" |
---|
495 | title="<%=HTML.encodeTags(at.getName())+" [A]"%>" |
---|
496 | property="<%="#"+at.getId()%>" |
---|
497 | annotation="true" |
---|
498 | datatype="<%=at.getValueType().getStringValue()%>" |
---|
499 | enumeration="<%=annotationEnum%>" |
---|
500 | smartenum="<%=at.getDisplayAsList() %>" |
---|
501 | sortable="<%=at.getMultiplicity() == 1%>" |
---|
502 | filterable="true" |
---|
503 | exportable="true" |
---|
504 | formatter="<%=formatter%>" |
---|
505 | unit="<%=at.getDefaultUnit()%>" |
---|
506 | /> |
---|
507 | <% |
---|
508 | } |
---|
509 | %> |
---|
510 | <tbl:columndef |
---|
511 | id="tools" |
---|
512 | title="Tools" |
---|
513 | /> |
---|
514 | <tbl:columndef |
---|
515 | id="xt-columns" |
---|
516 | extensions="<%=columnsInvoker%>" |
---|
517 | jspcontext="<%=jspContext%>" |
---|
518 | /> |
---|
519 | |
---|
520 | <div class="panelgroup"> |
---|
521 | <tbl:toolbar |
---|
522 | visible="<%=mode.hasToolbar()%>" |
---|
523 | subclass="<%=root == null ? "bottomborder bg-filled-50" : "topborder leftborder rightborder bg-filled-50" %>" |
---|
524 | > |
---|
525 | <tbl:button |
---|
526 | id="btnNewRootBioAssaySet" |
---|
527 | disabled="<%=!createPermission%>" |
---|
528 | image="new.png" |
---|
529 | title="New root bioassay set…" |
---|
530 | tooltip="<%=createPermission ? "Create a new root bioassay set" : "You do not have permission to create bioassay sets"%>" |
---|
531 | visible="<%=root == null && pluginCount.containsKey(Plugin.MainType.INTENSITY)%>" |
---|
532 | /> |
---|
533 | <tbl:button |
---|
534 | id="btnDeleteTreeItems" |
---|
535 | disabled="<%=!deletePermission%>" |
---|
536 | image="delete.png" |
---|
537 | title="Delete" |
---|
538 | tooltip="<%=deletePermission ? "Delete the selected items" : "You do not have permission to delete items"%>" |
---|
539 | /> |
---|
540 | <tbl:button |
---|
541 | id="btnRestoreTreeItems" |
---|
542 | disabled="<%=!writePermission%>" |
---|
543 | image="restore.png" |
---|
544 | title="Restore" |
---|
545 | tooltip="<%=writePermission ? "Restore the selected (deleted) items" : "You do not have permission to restore items"%>" |
---|
546 | /> |
---|
547 | <tbl:button |
---|
548 | id="btnTreeColumns" |
---|
549 | image="columns.png" |
---|
550 | title="Columns…" |
---|
551 | tooltip="Show, hide and re-order columns" |
---|
552 | /> |
---|
553 | <tbl:button |
---|
554 | id="btnTreeImport" |
---|
555 | data-plugin-type="IMPORT" |
---|
556 | image="import.png" |
---|
557 | title="Import…" |
---|
558 | tooltip="Import data" |
---|
559 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
560 | /> |
---|
561 | <tbl:button |
---|
562 | id="btnTreeExport" |
---|
563 | data-plugin-type="EXPORT" |
---|
564 | image="export.png" |
---|
565 | title="Export…" |
---|
566 | tooltip="Export data" |
---|
567 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
568 | /> |
---|
569 | <tbl:button |
---|
570 | id="btnTreeRunPlugin" |
---|
571 | data-plugin-type="OTHER" |
---|
572 | image="runplugin.png" |
---|
573 | title="Run plugin…" |
---|
574 | tooltip="Run a plugin" |
---|
575 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
576 | /> |
---|
577 | <ext:render extensions="<%=toolbarInvoker%>" context="<%=jspContext%>" |
---|
578 | wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
---|
579 | </tbl:toolbar> |
---|
580 | </div> |
---|
581 | <tbl:data style="<%=root == null ? "top: 1.75em;" : "" %>"> |
---|
582 | <tbl:headers> |
---|
583 | <tbl:headerrow> |
---|
584 | <tbl:header colspan="3"> |
---|
585 | <tbl:presetselector |
---|
586 | style="border-right: 0px;" |
---|
587 | /> |
---|
588 | </tbl:header> |
---|
589 | <tbl:columnheaders /> |
---|
590 | </tbl:headerrow> |
---|
591 | <% |
---|
592 | int numFilters = cc.getNumPropertyFilters(); |
---|
593 | int numRows = cc.getFilterRows(); |
---|
594 | for (int filterNo = 0; filterNo < numRows; filterNo++) |
---|
595 | { |
---|
596 | boolean lastRow = filterNo == numRows-1; |
---|
597 | %> |
---|
598 | <tbl:headerrow> |
---|
599 | <tbl:header subclass="index" /> |
---|
600 | <tbl:header |
---|
601 | subclass="check" |
---|
602 | visible="<%=mode.hasCheck()%>" |
---|
603 | ><base:icon |
---|
604 | subclass="link table-check" |
---|
605 | image="check_uncheck.png" |
---|
606 | tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" |
---|
607 | visible="<%=lastRow%>" |
---|
608 | /></tbl:header> |
---|
609 | <tbl:header |
---|
610 | subclass="check" |
---|
611 | visible="<%=mode.hasRadio()%>" |
---|
612 | /> |
---|
613 | <tbl:header |
---|
614 | subclass="icons" |
---|
615 | visible="<%=mode.hasIcons()%>" |
---|
616 | > |
---|
617 | <base:icon |
---|
618 | subclass="link table-filter-row-action" |
---|
619 | image="add.png" |
---|
620 | tooltip="Add extra filter row" |
---|
621 | visible="<%=lastRow%>" |
---|
622 | /><base:icon |
---|
623 | subclass="link table-filter-row-action" |
---|
624 | image="remove.png" |
---|
625 | tooltip="Remove this filter row" |
---|
626 | visible="<%=numRows > 1 || numFilters > 0 %>" |
---|
627 | data-remove-row="<%=filterNo%>" |
---|
628 | /> |
---|
629 | </tbl:header> |
---|
630 | <tbl:propertyfilter row="<%=filterNo%>" /> |
---|
631 | </tbl:headerrow> |
---|
632 | <% |
---|
633 | } |
---|
634 | %> |
---|
635 | <tbl:columnsubtitles /> |
---|
636 | </tbl:headers> |
---|
637 | <tbl:rows> |
---|
638 | <% |
---|
639 | if (cc.getMessage() != null) |
---|
640 | { |
---|
641 | %> |
---|
642 | <tbl:panel subclass="bg-filled-50"> |
---|
643 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
644 | </tbl:panel> |
---|
645 | <% |
---|
646 | cc.setMessage(null); |
---|
647 | } |
---|
648 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
649 | int selectedItemId = cc.getId(); |
---|
650 | if (analysisTree != null) |
---|
651 | { |
---|
652 | Iterator<Tree.Entry<BasicItem>> baas = analysisTree.entryIterator(root); |
---|
653 | while (baas.hasNext()) |
---|
654 | { |
---|
655 | Tree.Entry<BasicItem> entry = baas.next(); |
---|
656 | BasicItem item = entry.getNode(); |
---|
657 | if (item != null) |
---|
658 | { |
---|
659 | int level = entry.getDepth() - 1; |
---|
660 | int itemId = item.getId(); |
---|
661 | String joustId = item.getType().name() + "_" + itemId; |
---|
662 | |
---|
663 | boolean isVisible = true; |
---|
664 | BasicItem parent = entry.getParent().getNode(); |
---|
665 | if (parent != null && closed != null) |
---|
666 | { |
---|
667 | String parentId = parent.getType().name()+"_"+parent.getId(); |
---|
668 | isVisible = !closed.contains(parentId); |
---|
669 | if (!isVisible) closed.add(joustId); |
---|
670 | } |
---|
671 | String name = ""; |
---|
672 | String description = ""; |
---|
673 | String tooltip = mode.isSelectionMode() ? |
---|
674 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
675 | boolean removed = false; |
---|
676 | Transformation t = null; |
---|
677 | BioAssaySet bas = null; |
---|
678 | ExtraValue xv = null; |
---|
679 | PluginDefinition plugin = null; |
---|
680 | Job job = null; |
---|
681 | String prefix = ""; |
---|
682 | ItemContext ccc = null; |
---|
683 | Item itemType = item.getType(); |
---|
684 | if (itemType == Item.TRANSFORMATION) |
---|
685 | { |
---|
686 | t = (Transformation)item; |
---|
687 | removed = t.isRemoved(); |
---|
688 | prefix = "T:"; |
---|
689 | ccc = tc; |
---|
690 | name = HTML.encodeTags(t.getName()); |
---|
691 | description = HTML.encodeTags(t.getDescription()); |
---|
692 | try |
---|
693 | { |
---|
694 | job = t.getJob(); |
---|
695 | plugin = job.getPluginDefinition(); |
---|
696 | } |
---|
697 | catch (Throwable ex) |
---|
698 | {} |
---|
699 | } |
---|
700 | else if (itemType == Item.BIOASSAYSET) |
---|
701 | { |
---|
702 | bas = (BioAssaySet)item; |
---|
703 | removed = bas.isRemoved(); |
---|
704 | ccc = cc; |
---|
705 | name = HTML.encodeTags(bas.getName()); |
---|
706 | description = HTML.encodeTags(bas.getDescription()); |
---|
707 | } |
---|
708 | else if (itemType == Item.EXTRAVALUE) |
---|
709 | { |
---|
710 | xv = (ExtraValue)item; |
---|
711 | prefix = "X:"; |
---|
712 | removed = false; |
---|
713 | ccc = xvc; |
---|
714 | try |
---|
715 | { |
---|
716 | ExtraValueType xvType = xv.getExtraValueType(); |
---|
717 | name = HTML.encodeTags(xvType.getName()); |
---|
718 | description = HTML.encodeTags(xvType.getDescription()); |
---|
719 | } |
---|
720 | catch (PermissionDeniedException ex) |
---|
721 | { |
---|
722 | name = xv.getValueType().toString(); |
---|
723 | description = ""; |
---|
724 | } |
---|
725 | try |
---|
726 | { |
---|
727 | job = xv.getJob(); |
---|
728 | plugin = job.getPluginDefinition(); |
---|
729 | } |
---|
730 | catch (Throwable ex) |
---|
731 | {} |
---|
732 | } |
---|
733 | |
---|
734 | index++; |
---|
735 | numListed++; |
---|
736 | %> |
---|
737 | <tbl:row |
---|
738 | id="<%="row."+joustId%>" |
---|
739 | style="<%=isVisible ? "" : "display: none;" %>" |
---|
740 | > |
---|
741 | <tbl:header |
---|
742 | clazz="index" |
---|
743 | ><%=index%></tbl:header> |
---|
744 | <tbl:header |
---|
745 | clazz="check" |
---|
746 | visible="<%=mode.hasCheck()%>" |
---|
747 | ><input |
---|
748 | type="checkbox" |
---|
749 | name="<%=prefix+itemId%>" |
---|
750 | value="<%=itemId%>" |
---|
751 | title="<%=name%>" |
---|
752 | <%=ccc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
753 | ></tbl:header> |
---|
754 | <tbl:header |
---|
755 | clazz="check" |
---|
756 | visible="<%=mode.hasRadio()%>" |
---|
757 | ><input |
---|
758 | type="radio" |
---|
759 | name="item_id" |
---|
760 | value="<%=itemId%>" |
---|
761 | title="<%=name%>" |
---|
762 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
763 | ></tbl:header> |
---|
764 | <tbl:header |
---|
765 | clazz="icons" |
---|
766 | visible="<%=mode.hasIcons()%>" |
---|
767 | ><base:icon |
---|
768 | image="deleted.png" |
---|
769 | id="<%="delete."+itemId %>" |
---|
770 | subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>" |
---|
771 | data-item-type="<%=itemType.name() %>" |
---|
772 | data-item-id="<%=itemId%>" |
---|
773 | data-notify="reloadOnNotify" |
---|
774 | tooltip="This item has been scheduled for deletion" |
---|
775 | visible="<%=removed%>" |
---|
776 | /> </tbl:header> |
---|
777 | |
---|
778 | <tbl:cell clazz="cell joust" column="name"> |
---|
779 | <div id="<%=joustId%>" class="link auto-init" |
---|
780 | data-auto-init="item-link" |
---|
781 | data-item-type="<%=itemType.name() %>" |
---|
782 | data-item-id="<%=itemId %>" |
---|
783 | data-no-edit="<%=writePermission ? 0 : 1 %>" |
---|
784 | tabindex="0" |
---|
785 | title="<%=tooltip%>"><%=name%></div> |
---|
786 | </tbl:cell> |
---|
787 | <% |
---|
788 | if (t != null) |
---|
789 | { |
---|
790 | %> |
---|
791 | <tbl:cell column="spots"> </tbl:cell> |
---|
792 | <tbl:cell column="reporters"> </tbl:cell> |
---|
793 | <tbl:cell column="fileSpots"> </tbl:cell> |
---|
794 | <tbl:cell column="fileReporters"> </tbl:cell> |
---|
795 | <tbl:cell column="tools" style="white-space: nowrap;"> |
---|
796 | <% |
---|
797 | if (createPermission && job != null && plugin != null && plugin.isInteractive() && plugin.hasPermission(Permission.USE)) |
---|
798 | { |
---|
799 | // User may not have permission to read plug-in configuration for job |
---|
800 | boolean copyTransformationAllowed = false; |
---|
801 | try |
---|
802 | { |
---|
803 | PluginConfiguration pluginConfig = job.getPluginConfiguration(); |
---|
804 | if (pluginConfig == null || pluginConfig.hasPermission(Permission.USE)) |
---|
805 | { |
---|
806 | copyTransformationAllowed = true; |
---|
807 | } |
---|
808 | } |
---|
809 | catch (Exception e) |
---|
810 | {} |
---|
811 | if (copyTransformationAllowed) |
---|
812 | { |
---|
813 | %> |
---|
814 | <base:icon |
---|
815 | subclass="link auto-init" |
---|
816 | data-auto-init="copy-job" |
---|
817 | data-job-id="<%=job.getId() %>" |
---|
818 | image="copy.png" |
---|
819 | tooltip="Copy this transformation" |
---|
820 | /> |
---|
821 | <% |
---|
822 | } |
---|
823 | } |
---|
824 | %> |
---|
825 | <ext:render extensions="<%=toolsInvoker%>" context="<%=jspContext%>" item="<%=item%>" /> |
---|
826 | </tbl:cell> |
---|
827 | <% |
---|
828 | } |
---|
829 | if (bas != null) |
---|
830 | { |
---|
831 | %> |
---|
832 | <tbl:cell column="spots"><%=bas.getNumSpots()%></tbl:cell> |
---|
833 | <tbl:cell column="reporters"><%=bas.getNumReporters()%></tbl:cell> |
---|
834 | <tbl:cell column="fileSpots"><%=bas.getNumFileSpots()%></tbl:cell> |
---|
835 | <tbl:cell column="fileReporters"><%=bas.getNumFileReporters()%></tbl:cell> |
---|
836 | <tbl:cell column="date"> </tbl:cell> |
---|
837 | <tbl:cell column="plugin"> </tbl:cell> |
---|
838 | <% |
---|
839 | if (bas.isAnnotated()) |
---|
840 | { |
---|
841 | AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, bas.getAnnotationSet().getId()); |
---|
842 | for (AnnotationLoaderUtil loader : annotationLoaders) |
---|
843 | { |
---|
844 | %> |
---|
845 | <tbl:cell |
---|
846 | column="<%="at"+loader.getId()%>" |
---|
847 | ><% |
---|
848 | if (loader.find(snapshot, psInfo.reset())) |
---|
849 | { |
---|
850 | %><tbl:cellvalue |
---|
851 | list="<%=loader.getValues()%>" |
---|
852 | suffix="<%=loader.getUnitSymbol()%>" |
---|
853 | clazz="<%=psInfo.overridesDefaultAnnotation() ? "ps-annotation" : null%>" |
---|
854 | /><% |
---|
855 | } |
---|
856 | %></tbl:cell> |
---|
857 | <% |
---|
858 | } |
---|
859 | } |
---|
860 | %> |
---|
861 | <tbl:cell column="tools" style="white-space: nowrap;"> |
---|
862 | <% |
---|
863 | if (bas.getNumSpots() > 0) |
---|
864 | { |
---|
865 | %> |
---|
866 | <base:icon |
---|
867 | subclass="link auto-init" |
---|
868 | data-auto-init="bioassayset-plotter" |
---|
869 | data-item-id="<%=itemId %>" |
---|
870 | image="plotter.png" |
---|
871 | tooltip="A simple plot tool" |
---|
872 | /> |
---|
873 | <base:icon |
---|
874 | subclass="link auto-init" |
---|
875 | data-auto-init="experiment-explorer" |
---|
876 | data-item-id="<%=itemId %>" |
---|
877 | image="explorer.png" |
---|
878 | tooltip="Experiment explorer" |
---|
879 | /> |
---|
880 | <% |
---|
881 | } |
---|
882 | %> |
---|
883 | <base:icon |
---|
884 | subclass="link auto-init" |
---|
885 | data-auto-init="bioassayset-plugin" |
---|
886 | data-plugin-type="EXPORT" |
---|
887 | data-item-id="<%=itemId %>" |
---|
888 | image="export.png" |
---|
889 | tooltip="Export data" |
---|
890 | /> |
---|
891 | <% |
---|
892 | if (createPermission) |
---|
893 | { |
---|
894 | %> |
---|
895 | <base:icon |
---|
896 | subclass="link auto-init" |
---|
897 | data-auto-init="bioassayset-plugin" |
---|
898 | data-plugin-type="ANALYZE" |
---|
899 | data-cmd="NewFilteredBioAssaySet" |
---|
900 | data-item-id="<%=itemId %>" |
---|
901 | image="filter.png" |
---|
902 | tooltip="Create a filtered bioassay set" |
---|
903 | /> |
---|
904 | <base:icon |
---|
905 | subclass="link auto-init" |
---|
906 | data-auto-init="bioassayset-plugin" |
---|
907 | data-plugin-type="ANALYZE" |
---|
908 | data-item-id="<%=itemId %>" |
---|
909 | image="runplugin.png" |
---|
910 | tooltip="Run an analysis plugin" |
---|
911 | /> |
---|
912 | <% |
---|
913 | } |
---|
914 | %> |
---|
915 | <ext:render extensions="<%=toolsInvoker%>" context="<%=jspContext%>" item="<%=item%>" /> |
---|
916 | </tbl:cell> |
---|
917 | <% |
---|
918 | } |
---|
919 | if (xv != null) |
---|
920 | { |
---|
921 | %> |
---|
922 | <tbl:cell column="spots"><%=xv.getNumValues()%></tbl:cell> |
---|
923 | <tbl:cell column="reporters"> </tbl:cell> |
---|
924 | <tbl:cell column="fileSpots"><%=xv.getNumFileValues()%></tbl:cell> |
---|
925 | <tbl:cell column="fileReporters"> </tbl:cell> |
---|
926 | <tbl:cell column="tools" style="white-space: nowrap;"> |
---|
927 | <% |
---|
928 | if (createPermission && job != null && plugin != null && plugin.isInteractive() && plugin.hasPermission(Permission.USE)) |
---|
929 | { |
---|
930 | // User may not have permission to read plug-in configuration for job |
---|
931 | boolean copyTransformationAllowed = false; |
---|
932 | try |
---|
933 | { |
---|
934 | PluginConfiguration pluginConfig = job.getPluginConfiguration(); |
---|
935 | if (pluginConfig == null || pluginConfig.hasPermission(Permission.USE)) |
---|
936 | { |
---|
937 | copyTransformationAllowed = true; |
---|
938 | } |
---|
939 | } |
---|
940 | catch (Exception e) |
---|
941 | {} |
---|
942 | if (copyTransformationAllowed) |
---|
943 | { |
---|
944 | %> |
---|
945 | <base:icon |
---|
946 | subclass="link auto-init" |
---|
947 | data-auto-init="copy-job" |
---|
948 | data-job-id="<%=job.getId() %>" |
---|
949 | image="copy.png" |
---|
950 | tooltip="Copy this extra value" |
---|
951 | /> |
---|
952 | <% |
---|
953 | } |
---|
954 | } |
---|
955 | %> |
---|
956 | <ext:render extensions="<%=toolsInvoker%>" context="<%=jspContext%>" item="<%=item%>" /> |
---|
957 | </tbl:cell> |
---|
958 | <% |
---|
959 | } |
---|
960 | %> |
---|
961 | <tbl:cell column="date"><%=job == null ? "" : dateTimeFormatter.format(job.getEnded())%></tbl:cell> |
---|
962 | <tbl:cell column="plugin"><%=plugin == null ? "" : Base.getLinkedName(ID, plugin, false, true)%></tbl:cell> |
---|
963 | <tbl:cell column="description"><%=description%></tbl:cell> |
---|
964 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
965 | <tbl:cell column="xt-columns" /> |
---|
966 | </tbl:xt-cells> |
---|
967 | </tbl:row> |
---|
968 | <% |
---|
969 | } |
---|
970 | } |
---|
971 | } |
---|
972 | if (numListed == 0) |
---|
973 | { |
---|
974 | %> |
---|
975 | <tbl:panel subclass="bg-filled-50"> |
---|
976 | <div class="messagecontainer note"> |
---|
977 | No bioassay sets or transformations were found. |
---|
978 | </div> |
---|
979 | </tbl:panel> |
---|
980 | <% |
---|
981 | } |
---|
982 | %> |
---|
983 | </tbl:rows> |
---|
984 | </tbl:data> |
---|
985 | </tbl:table> |
---|
986 | |
---|
987 | <div id="reloadOnNotify"></div> |
---|
988 | </base:body> |
---|
989 | </base:page> |
---|
990 | <% |
---|
991 | } |
---|
992 | finally |
---|
993 | { |
---|
994 | if (dc != null) dc.close(); |
---|
995 | } |
---|
996 | %> |
---|