Changeset 2490
- Timestamp:
- Aug 8, 2006, 9:29:35 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java
r2487 r2490 115 115 116 116 // TODO - fix for use with table listings 117 public static void addFormulaColumns(List<TableColumn> columns, DbControl dc, RawDataType rawDataType, Formula.Type type )117 public static void addFormulaColumns(List<TableColumn> columns, DbControl dc, RawDataType rawDataType, Formula.Type type, String idPrefix, String titlePrefix) 118 118 { 119 119 ItemQuery<Formula> query = Formula.getQuery(type, rawDataType); … … 124 124 { 125 125 Formula f = result.next(); 126 TableColumn tc = new TableColumn(null, null, f.getFormula(0), Type.FLOAT, f.getName(), f.getDescription()); 126 String jepExpression = f.getFormula(0); 127 TableColumn tc = new TableColumn(idPrefix+f.getId(), "="+jepExpression, jepExpression, Type.FLOAT, 128 titlePrefix + f.getName(), f.getDescription()); 127 129 columns.add(tc); 128 130 } -
trunk/src/clients/web/net/sf/basedb/clients/web/ExperimentExplorer.java
r2487 r2490 70 70 public static final int SPOT_AVG = -2; 71 71 72 private static final Map<RawDataType, ItemContext> defaultContexts = 72 private static final ItemContext defaultReporterContext = 73 Base.createDefaultContext("@externalId", "name,externalId"); 74 75 private static final Map<RawDataType, ItemContext> defaultSpotContexts = 73 76 new HashMap<RawDataType, ItemContext>(); 74 77 … … 78 81 { 79 82 // Default visible columns are: position, ch1, ch2, ... 80 StringBuilder columns = new StringBuilder(" POSITION");83 StringBuilder columns = new StringBuilder("bioassay,position"); 81 84 for (int ch = 1; ch <= rdt.getChannels(); ++ch) 82 85 { 83 86 columns.append(",ch").append(ch); 84 87 } 85 default Contexts.put(rdt,88 defaultSpotContexts.put(rdt, 86 89 Base.createDefaultContext("POSITION", columns.toString())); 87 90 } … … 101 104 } 102 105 103 private static final int CACHE_SIZE = 10;106 private static final int DEFAULT_CACHE_SIZE = 100; 104 107 105 108 private final BioAssaySet bioAssaySet; 106 109 private final Map<Short, Integer> bioAssays; 107 110 private int[] reporterIds; 111 private int cacheSize; 108 112 private int firstCachedIndex = 0; 109 113 private int lastCachedIndex = -1; 110 114 private int reporterIndex = 0; 111 115 private int positionIndex = 0; 116 private int matchingReporters = -1; 117 private int annotationTypeId = 0; 112 118 113 119 private ExperimentExplorer(BioAssaySet bioAssaySet) … … 115 121 this.bioAssaySet = bioAssaySet; 116 122 this.bioAssays = new HashMap<Short, Integer>(); 123 this.cacheSize = DEFAULT_CACHE_SIZE; 117 124 for (BioAssay ba : bioAssaySet.getBioAssays().list(bioAssaySet.getDbControl())) 118 125 { … … 121 128 } 122 129 130 public int getCacheSize() 131 { 132 return cacheSize; 133 } 134 135 public void setCacheSize(int cacheSize) 136 { 137 this.cacheSize = cacheSize; 138 } 139 123 140 /** 124 141 Get the bioassay set that is currently beeing explored. … … 176 193 } 177 194 178 public ItemContext getDefaultContext() 179 { 180 return defaultContexts.get(bioAssaySet.getRawDataType()); 195 public ItemContext getDefaultSpotContext() 196 { 197 return defaultSpotContexts.get(bioAssaySet.getRawDataType()); 198 } 199 200 public ItemContext getDefaultReporterContext() 201 { 202 return defaultReporterContext; 181 203 } 182 204 183 205 public ItemContext getAndSetSpotContext(SessionControl sc, PageContext pageContext) 184 206 { 185 ItemContext cc = Base.getAndSetCurrentContext(sc, Item.SPOTDATA, getSubContext(), pageContext, getDefault Context());207 ItemContext cc = Base.getAndSetCurrentContext(sc, Item.SPOTDATA, getSubContext(), pageContext, getDefaultSpotContext()); 186 208 if (pageContext != null) 187 209 { … … 192 214 } 193 215 194 public ItemContext getAndSetReporterContext(SessionControl sc, PageContext pageContext, ItemContext defaultContext) 195 { 196 ItemContext cc = Base.getAndSetCurrentContext(sc, Item.REPORTER, getSubContext(), pageContext, defaultContext); 216 public ItemContext getAndSetReporterContext(SessionControl sc, PageContext pageContext) 217 { 218 ItemContext cc = Base.getAndSetCurrentContext(sc, Item.REPORTER, getSubContext(), pageContext, getDefaultReporterContext()); 219 if (pageContext != null) 220 { 221 // Settings may have changes, clear cache 222 firstCachedIndex = 0; 223 lastCachedIndex = -1; 224 matchingReporters = -1; 225 } 197 226 return cc; 198 227 } … … 204 233 public int getMatchingReporters(DbControl dc) 205 234 { 206 return (int)getReporterQuery(dc, null).count(dc); 235 if (matchingReporters == -1) 236 { 237 matchingReporters = (int)getReporterQuery(dc, null).count(dc); 238 } 239 return matchingReporters; 240 } 241 242 public int getAnnotationTypeId() 243 { 244 return annotationTypeId; 245 } 246 247 public void setAnnotationTypeId(int annotationTypeId) 248 { 249 this.annotationTypeId = annotationTypeId; 207 250 } 208 251 … … 218 261 /** 219 262 Set the index of the currently viewed reporter. If the index is below 220 zero or greater than or equal to {@link #getMatchingReporters( )} it is set263 zero or greater than or equal to {@link #getMatchingReporters(DbControl)} it is set 221 264 to the nearest index. 222 265 @param reporterIndex The new index … … 224 267 public void setReporterIndex(int reporterIndex) 225 268 { 269 if (reporterIndex >= matchingReporters) reporterIndex = matchingReporters - 1; 226 270 if (reporterIndex < 0) reporterIndex = 0; 227 // if (reporterIndex >= getMatchingReporters()) reporterIndex = getMatchingReporters() - 1;228 271 this.reporterIndex = reporterIndex; 229 272 } … … 237 280 public ReporterData getReporter(DbControl dc, int index) 238 281 { 239 if (reporterIds == null )240 { 241 reporterIds = new int[ CACHE_SIZE];282 if (reporterIds == null || reporterIds.length != cacheSize) 283 { 284 reporterIds = new int[cacheSize]; 242 285 } 243 286 244 287 if (index < firstCachedIndex || index > lastCachedIndex) 245 288 { 246 // The index is outside the cached range, reload another range: index +/- CACHE_SIZE / 2289 // The index is outside the cached range, reload another range: index +/- (cacheSize / 2) 247 290 BioAssaySet bas = getBioAssaySet(dc); 248 291 249 292 DynamicSpotQuery reporterQuery = getReporterQuery(dc, null); 250 293 251 this.firstCachedIndex = Math.max(0, index - CACHE_SIZE/ 2);294 this.firstCachedIndex = Math.max(0, index - cacheSize / 2); 252 295 reporterQuery.setFirstResult(firstCachedIndex); 253 reporterQuery.setMaxResults( CACHE_SIZE);296 reporterQuery.setMaxResults(cacheSize); 254 297 try 255 298 { … … 356 399 reporterQuery.joinReporters(JoinType.INNER); 357 400 reporterQuery.setDistinct(true); 358 reporterQuery.select( Dynamic.selectReporter("id"));359 401 reporterQuery.select(Selects.expression(Dynamic.reporter("id"), "id", true)); 402 360 403 ItemContext cc = dc.getSessionControl().getCurrentContext(Item.REPORTER, getSubContext(), null); 361 404 cc.configureQuery(reporterQuery, selectionList); -
trunk/src/core/net/sf/basedb/core/AbstractEntityQuery.java
r2474 r2490 153 153 this.requiredFilter = QueryRuntimeFilterFactory.getRequiredFilter(itemType); 154 154 this.optionalFilter = optionalFilter; 155 super.selectPermanent(Selects.expression(Hql.alias(itemType.getAlias()), null ));155 super.selectPermanent(Selects.expression(Hql.alias(itemType.getAlias()), null, true)); 156 156 this.includes = EnumSet.of(Include.NOT_REMOVED, Include.MINE, Include.IN_PROJECT); 157 157 this.permission = Permission.READ; -
trunk/src/core/net/sf/basedb/core/AbstractQuery.java
r2487 r2490 687 687 for (Select s : selects) 688 688 { 689 ql.append(deliminator); 690 ql.append(dc == null ? s.toString() : s.toQl(this, dc)); 691 appended++; 692 deliminator = ", "; 689 if (!isCounting || s.useInDistinctCount()) 690 { 691 ql.append(deliminator); 692 ql.append(dc == null ? s.toString() : s.toQl(this, dc)); 693 appended++; 694 deliminator = ", "; 695 } 693 696 } 694 697 return appended; -
trunk/src/core/net/sf/basedb/core/ItemContext.java
r2487 r2490 39 39 import net.sf.basedb.core.data.UserData; 40 40 import net.sf.basedb.core.data.ClientData; 41 import net.sf.basedb.util.jep.ChannelFunction; 42 import net.sf.basedb.util.jep.Jep; 43 import net.sf.basedb.util.jep.JepFunction; 44 import net.sf.basedb.util.jep.RawFunction; 41 45 42 46 import java.util.Collection; … … 148 152 public static final String DEFAULT_NAME = "- default -"; 149 153 154 // For parsing JEP expressions 155 private static final JepFunction ch = new ChannelFunction(); 156 private static final JepFunction raw = new RawFunction(); 157 150 158 private final String name; 151 159 private final Item itemType; … … 942 950 // TODO - implement extra values 943 951 } 952 else if (propertyDef.startsWith("=")) 953 { 954 // propertyDef is JEP expression 955 joins.joinRawData |= propertyDef.contains("raw("); 956 e = Jep.formulaToExpression(propertyDef.substring(1), ch, raw); 957 } 944 958 else 945 959 { -
trunk/src/core/net/sf/basedb/core/Operator.java
r2304 r2490 151 151 } 152 152 153 public String toString() 154 { 155 return symbol; 156 } 157 153 158 /** 154 159 Get the integer value that is used when storing an operator in the database. -
trunk/src/core/net/sf/basedb/core/PropertyFilter.java
r2304 r2490 98 98 return filter; 99 99 } 100 101 /* 102 From the Object class 103 ------------------------------------------- 104 */ 105 public String toString() 106 { 107 return property + " " + operator + " " + value; 108 } 109 // ------------------------------------------- 110 100 111 101 112 /** -
trunk/src/core/net/sf/basedb/core/RawDataType.java
r2392 r2490 27 27 import java.util.HashMap; 28 28 import java.util.Collections; 29 30 import net.sf.basedb.core.data.RawData; 29 31 30 32 /** … … 232 234 return name; 233 235 } 236 237 public RawData getRawDataById(DbControl dc, int id) 238 throws ItemNotFoundException, PermissionDeniedException, BaseException 239 { 240 if (!isStoredInDb()) 241 { 242 throw new BaseException("Raw data for raw data type '" + this + "' is not stored in the database."); 243 } 244 RawData rd = HibernateUtil.loadData(dc.getStatelessSession(), 245 RawData.class, getEntityName(), id); 246 if (rd == null) throw new ItemNotFoundException("RawData[id = " + id + "]"); 247 248 RawDataUtil.getRawBioAssay(dc, rd); // To check for read permission 249 return rd; 250 } 251 234 252 } -
trunk/src/core/net/sf/basedb/core/query/ExpressionSelect.java
r2487 r2490 46 46 private final Expression e1; 47 47 private final String alias; 48 private final boolean useInDistinctCount; 48 49 49 ExpressionSelect(Expression e1, String alias )50 ExpressionSelect(Expression e1, String alias, boolean useInDistinctCount) 50 51 { 51 52 this.e1 = e1; 52 53 this.alias = alias; 54 this.useInDistinctCount = useInDistinctCount; 53 55 } 54 56 … … 80 82 return e1; 81 83 } 84 public boolean useInDistinctCount() 85 { 86 return useInDistinctCount; 87 } 82 88 // ------------------------------------------- 83 89 /* -
trunk/src/core/net/sf/basedb/core/query/Select.java
r2304 r2490 55 55 */ 56 56 public Expression getExpression(); 57 58 /** 59 If this expression should be use in count distinct queries or not. 60 <pre class="code"> 61 SELECT COUNT(DISTINCT expression) 62 </pre> 63 @return TRUE or FALSE 64 */ 65 public boolean useInDistinctCount(); 57 66 58 67 } -
trunk/src/core/net/sf/basedb/core/query/Selects.java
r2304 r2490 45 45 46 46 /** 47 Create a selection from an expression, optionally giving it an alias. 48 The alias can be used when getting the result to find the column 49 index. See {@link SqlResultIterator#getIndex(String)}. 50 <p> 51 <pre class="code"> 52 SELECT <i><expression></i> AS <i><alias></i> 53 FROM ... 54 </pre> 55 <p> 56 TODO - more example code 57 58 @param e1 The expression to select 59 @param alias The alias to give the expression 60 @return A selection query element 61 @throws InvalidDataException If the expression is null or if the 62 alias contains invalid characters 47 Same as <code>expression(e1, alias, false)</code>. 48 @see #expression(Expression, String, boolean) 63 49 */ 64 50 public static final Select expression(Expression e1, String alias) … … 70 56 throw new InvalidDataException("Alias '"+alias+"' has one or more invalid characters. Only a-z, A-Z and 0-9 is allowed."); 71 57 } 72 return new ExpressionSelect(e1, alias); 58 return new ExpressionSelect(e1, alias, false); 59 } 60 61 /** 62 Create a selection from an expression, optionally giving it an alias. 63 The alias can be used when getting the result to find the column 64 index. See {@link SqlResultIterator#getIndex(String)}. 65 <p> 66 <pre class="code"> 67 SELECT <i><expression></i> AS <i><alias></i> 68 FROM ... 69 </pre> 70 <p> 71 The useInDistinctCount parameter affects the {@link Query#count(DbControl)} 72 method, if the {@link Query#setDistinct(boolean)} has been set to true. In this 73 case only expressions which has been created for use with the distinct function 74 are used in the selection list: 75 <pre class="code"> 76 SELECT COUNT(DISTINCT <i><expression></i>) 77 FROM ... 78 </pre> 79 <p> 80 81 TODO - more example code 82 83 @param e1 The expression to select 84 @param alias The alias to give the expression 85 @param useInDistinctCount If the expression should be used when counting distinct values 86 @return A selection query element 87 @throws InvalidDataException If the expression is null or if the 88 alias contains invalid characters 89 */ 90 public static final Select expression(Expression e1, String alias, boolean useInDistinctCount) 91 throws InvalidDataException 92 { 93 if (e1 == null) throw new InvalidUseOfNullException("e1"); 94 if (alias != null && !ALIAS_REGEXP.matcher(alias).matches()) 95 { 96 throw new InvalidDataException("Alias '"+alias+"' has one or more invalid characters. Only a-z, A-Z and 0-9 is allowed."); 97 } 98 return new ExpressionSelect(e1, alias, useInDistinctCount); 73 99 } 74 100 -
trunk/www/include/styles/main.css
r2487 r2490 173 173 a.disabled { 174 174 color: #666666; 175 xtext-decoration: none;176 175 cursor: default; 177 176 } … … 182 181 .form .prompt { 183 182 font-weight: bold; 184 padding: 2px 4px 2px 0px;183 padding: 2px 4px 2px 2px; 185 184 white-space: nowrap; 186 } 185 background: #E0E0E0; 186 } 187 188 .form tr { 189 vertical-align: top; 190 } 191 187 192 188 193 .error { -
trunk/www/views/experiments/bioassaysets/view_bioassayset.jsp
r2487 r2490 232 232 image="explorer.png" 233 233 onclick="<%="openExperimentExplorer(" + itemId + ")"%>" 234 title="Experiment explorer …"234 title="Experiment explorer" 235 235 tooltip="View the data reporter by reporter" 236 236 /> -
trunk/www/views/experiments/explorer/search/index.jsp
r2487 r2490 41 41 <%! 42 42 private static final Item itemType = Item.REPORTER; 43 private static final ItemContext defaultContext = 44 Base.createDefaultContext("@externalId", "name,externalId"); 43 45 44 %> 46 45 <% … … 66 65 if (cmd == null || "List".equals(cmd)) 67 66 { 68 ItemContext cc = explorer.getAndSetReporterContext(sc, null , defaultContext);67 ItemContext cc = explorer.getAndSetReporterContext(sc, null); 69 68 redirect = listPage; 70 69 } 71 70 else if ("UpdateContext".equals(cmd)) 72 71 { 73 ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext , defaultContext);72 ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext); 74 73 redirect = listPage; 75 // throw new WebException("popup", "Page", request.getParameter("page") + ":" + cc.getPage()+":"+request.getParameter("sortby")+":"+cc.getSortProperty());76 74 } 77 75 else -
trunk/www/views/experiments/explorer/search/list.jsp
r2487 r2490 84 84 85 85 final ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); 86 final ItemContext cc = explorer.getAndSetReporterContext(sc, null , null);86 final ItemContext cc = explorer.getAndSetReporterContext(sc, null); 87 87 final String subContext = cc.getSubContext(); 88 88 89 89 List<TableColumn> columns = new LinkedList<TableColumn>(); 90 //DynamicUtil.addSpotColumns(columns, rawDataType.getChannels());91 //DynamicUtil.addRawDataColumns(columns, rawDataType, "raw.", "$", "[Raw] ");92 90 DynamicUtil.addReporterColumns(columns, "", "@", ""); 93 91 … … 98 96 selectedIndex.put(selected.selectedIds.get(i), i+2); 99 97 } 100 /*101 final int matchingReporters = explorer.getMatchingReporters();102 final int reporterIndex = explorer.getReporterIndex();103 final int positionIndex = explorer.getPositionIndex();104 final ReporterData reporter = explorer.getReporter(dc, reporterIndex);105 final int matchingPositions = explorer.getNumPositions(dc, reporter);106 */107 98 108 99 DynamicSpotQuery reporterQuery = explorer.getReporterQuery(dc, selected.selectedProperties); -
trunk/www/views/experiments/explorer/view/index.jsp
r2487 r2490 62 62 BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); 63 63 ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); 64 if (cmd == null )64 if (cmd == null || "Explore".equals(cmd)) 65 65 { 66 explorer.setReporterIndex(0);67 explorer.setPositionIndex(0);66 //explorer.setReporterIndex(0); 67 //explorer.setPositionIndex(0); 68 68 redirect = viewPage; 69 69 } … … 81 81 { 82 82 explorer.setPositionIndex(Values.getInt(request.getParameter("spotIndex"))); 83 redirect = viewPage; 84 } 85 else if ("SetAnnotationType".equals(cmd)) 86 { 87 explorer.setAnnotationTypeId(Values.getInt(request.getParameter("annotationtype_id"))); 88 89 // Fix visible columns 90 ItemContext cc = explorer.getAndSetSpotContext(sc, null); 91 String columns = cc.getSetting("columns"); 92 if (explorer.getAnnotationTypeId() != 0) 93 { 94 if (!columns.contains("annotation")) columns = "annotation," + columns; 95 } 96 else 97 { 98 columns.replace("annotation", ""); 99 } 100 cc.setSetting("columns", columns); 83 101 redirect = viewPage; 84 102 } -
trunk/www/views/experiments/explorer/view/view.jsp
r2487 r2490 30 30 import="net.sf.basedb.core.Item" 31 31 import="net.sf.basedb.core.ItemContext" 32 import="net.sf.basedb.core.Include" 32 33 import="net.sf.basedb.core.BioAssaySet" 34 import="net.sf.basedb.core.BioAssay" 33 35 import="net.sf.basedb.core.Experiment" 34 36 import="net.sf.basedb.core.RawDataType" 37 import="net.sf.basedb.core.RawBioAssay" 38 import="net.sf.basedb.core.RawDataUtil" 35 39 import="net.sf.basedb.core.ExtendedProperties" 36 40 import="net.sf.basedb.core.ExtendedProperty" 41 import="net.sf.basedb.core.AnnotationType" 42 import="net.sf.basedb.core.Annotation" 43 import="net.sf.basedb.core.Formula" 44 import="net.sf.basedb.core.ItemQuery" 45 import="net.sf.basedb.core.ItemResultIterator" 37 46 import="net.sf.basedb.core.DynamicSpotQuery" 38 47 import="net.sf.basedb.core.DynamicResultIterator" 39 48 import="net.sf.basedb.core.VirtualColumn" 49 import="net.sf.basedb.core.Type" 40 50 import="net.sf.basedb.core.data.ReporterData" 51 import="net.sf.basedb.core.data.RawData" 41 52 import="net.sf.basedb.core.query.Restrictions" 42 53 import="net.sf.basedb.core.query.Expressions" … … 55 66 import="net.sf.basedb.clients.web.taglib.table.TableColumn" 56 67 import="java.util.Date" 68 import="java.util.Set" 69 import="java.util.HashSet" 57 70 import="java.util.List" 58 71 import="java.util.LinkedList" … … 83 96 final ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet); 84 97 final ItemContext cc = explorer.getAndSetSpotContext(sc, pageContext); 98 final ItemContext reporterContext = explorer.getAndSetReporterContext(sc, null); 85 99 final String subContext = cc.getSubContext(); 86 100 87 101 List<TableColumn> columns = new LinkedList<TableColumn>(); 88 102 DynamicUtil.addSpotColumns(columns, rawDataType.getChannels()); 103 DynamicUtil.addFormulaColumns(columns, dc, rawDataType, Formula.Type.COLUMN_EXPRESSION, "frm", ""); 89 104 DynamicUtil.addRawDataColumns(columns, rawDataType, "raw.", "$", "[Raw] "); 90 //DynamicUtil.addReporterColumns(columns, "rep.", "@", "[Rep] ");91 105 // TODO - DynamicUtil.addExtraColumns(columns); 92 // TODO - DynamicUtil.addFormulaColumns(columns);93 94 columns.remove(0); 106 columns.add(new TableColumn("raw.spotimage", "$id", "raw('id')", Type.INT, "[Raw] Spotimage", "", "auto", false, false, false)); 107 108 columns.remove(0); // The position column, it is added in another place 95 109 96 110 DynamicUtil.SelectedInfo selected = DynamicUtil.getSelectedColumns(cc, columns); 111 112 final int annotationTypeId = explorer.getAnnotationTypeId(); 113 final AnnotationType annotationType = annotationTypeId == 0 ? 114 null : AnnotationType.getById(dc, annotationTypeId); 97 115 98 116 final int matchingReporters = explorer.getMatchingReporters(dc); … … 145 163 Forms.createHidden(frm, 'spotIndex', spotIndex-1); 146 164 return true; 165 } 166 function annotationTypeOnChange() 167 { 168 var frm = document.forms['explorer']; 169 frm.cmd.value = 'SetAnnotationType'; 170 frm.submit(); 147 171 } 148 172 function viewSearch() … … 178 202 179 203 <t:tab id="view" title="Reporter view"> 180 181 204 <div class="boxed"> 182 205 … … 186 209 <input type="hidden" name="cmd" value=""> 187 210 188 211 212 <table width="100%" cellspacing="2" cellpadding="0" border="0"> 213 <tr valign="bottom"> 214 <td width="50%"> 215 189 216 <h4>Current reporter 190 217 <input name="newReporterIndex" type="text" class="text" value="<%=reporterIndex+1%>" … … 231 258 %> 232 259 </h4> 233 <p> 234 260 261 </td> 262 <td width="50%"> 263 <h4>Annotation</h4> 264 </td> 265 </tr> 266 267 <tr valign="top"> 268 <td> 269 235 270 <% 236 271 if (reporter != null) 237 272 { 238 273 %> 239 <table class="form" cellspacing=0 >274 <table class="form" cellspacing=0 width="100%"> 240 275 <tr> 241 <td class="prompt" >Name</td>276 <td class="prompt" >Name</td> 242 277 <td colspan="7"><%=Base.getLink(ID, reporter.getName(), Item.REPORTER, reporter.getId(), true)%></td> 243 278 </tr> … … 248 283 <td class="prompt">Type</td> 249 284 <td><base:propertyvalue dbcontrol="<%=dc%>" item="<%=reporter%>" property="reporterType" /></td> 250 <td> </td> 285 </tr> 286 <tr valign="top"> 251 287 <td class="prompt">Gene symbol</td> 252 288 <td><%=HTML.encodeTags(reporter.getSymbol())%></td> 289 <td> </td> 290 <td class="prompt">Description</td> 291 <td><%=HTML.niceFormat(reporter.getDescription())%></td> 253 292 </tr> 254 293 <tr valign="top"> 255 <td class="prompt">Description</td>256 <td><%=HTML.niceFormat(reporter.getDescription())%></td>257 <td> </td>258 294 <td class="prompt">Last update</td> 259 295 <td><%=Values.formatDate(reporter.getLastUpdate())%></td> 260 296 <td> </td> 261 297 <% 262 int column = 2;298 int column = 1; 263 299 for (ExtendedProperty ep : ExtendedProperties.getProperties("ReporterData")) 264 300 { … … 267 303 String link = ep.getUrl(value); 268 304 if (value instanceof Date) value = Values.formatDate((Date)value); 269 value = value == null ? " <i>- no value -</i>" : HTML.encodeTags(value.toString());305 value = value == null ? "" : HTML.encodeTags(value.toString()); 270 306 if (link != null) 271 307 { … … 277 313 <td><%=value%></td> 278 314 <td> </td> 279 <%=column == 2? "</tr>" : ""%>315 <%=column == 1 ? "</tr>" : ""%> 280 316 <% 281 317 column++; 282 if (column > 2) column = 0;318 if (column > 1) column = 0; 283 319 } 284 320 %> 285 <%=column < 2? "</tr>" : ""%>321 <%=column < 1 ? "</tr>" : ""%> 286 322 </table> 287 323 … … 349 385 } 350 386 %> 351 <a href="index.jsp?ID=<%=ID%>&cmd=SetSpotIndex&bioassayset_id=<%=bioAssaySetId%>&spotIndex=-1"387 [ <a href="index.jsp?ID=<%=ID%>&cmd=SetSpotIndex&bioassayset_id=<%=bioAssaySetId%>&spotIndex=-1" 352 388 title="Show all positions">all</a> 353 <a href="index.jsp?ID=<%=ID%>&cmd=SetSpotIndex&bioassayset_id=<%=bioAssaySetId%>&spotIndex=-2"389 | <a href="index.jsp?ID=<%=ID%>&cmd=SetSpotIndex&bioassayset_id=<%=bioAssaySetId%>&spotIndex=-2" 354 390 title="Calculate average values for each bioassay">avg</a> 391 ] 355 392 <% 356 393 } 357 394 %> 358 395 </h4> 396 397 </td> 398 <td> 399 <select name="annotationtype_id" onchange="annotationTypeOnChange()"> 400 <option value="0">- none - 401 <% 402 ItemQuery<AnnotationType> annotationTypeQuery = experiment.getExperimentalFactors(); 403 annotationTypeQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); 404 ItemResultIterator<AnnotationType> annotationTypes = annotationTypeQuery.iterate(dc); 405 while (annotationTypes.hasNext()) 406 { 407 AnnotationType at = annotationTypes.next(); 408 String isSelected = at.getId() == annotationTypeId ? "selected" : ""; 409 %> 410 <option value="<%=at.getId()%>" <%=isSelected%>><%=HTML.encodeTags(at.getName())%> 411 <% 412 } 413 %> 414 </select> 415 <p> 416 <% 417 if (annotationType != null) 418 { 419 %> 420 <b>Summary</b><br> 421 TODO 422 <% 423 } 424 %> 425 </td> 426 </tr> 427 </table> 428 359 429 </form> 360 430 … … 375 445 value="<%=String.valueOf(bioAssaySetId)%>" 376 446 /> 447 <% 448 if (annotationType != null) 449 { 450 %> 451 <tbl:columndef 452 id="annotation" 453 title="<%=HTML.encodeTags(annotationType.getName()) %>" 454 show="always" 455 /> 456 <% 457 } 458 %> 377 459 <tbl:columndef 378 460 id="bioassay" 461 property="COLUMN" 379 462 title="Bioassay" 380 463 show="always" 464 sortable="true" 381 465 /> 382 466 <tbl:columndef 383 467 id="position" 468 property="POSITION" 384 469 title="Position" 385 470 show="<%=positionIndex == ExperimentExplorer.SPOT_AVG ? "never" : "always" %>" 471 sortable="true" 386 472 /> 387 473 <tbl:columndef … … 417 503 </tbl:toolbar> 418 504 <tbl:data> 419 <tbl:columns> 420 </tbl:columns> 505 <tbl:columns /> 421 506 <tbl:rows> 422 423 507 <% 424 508 int index = 0; … … 430 514 %> 431 515 <tbl:row> 516 <% 517 if (annotationType != null) 518 { 519 BioAssay ba = explorer.getBioAssay(dc, item.getShort(1)); 520 ItemQuery<RawBioAssay> rbaQuery = ba.getRawBioAssays(); 521 rbaQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); 522 List<RawBioAssay> rba = rbaQuery.list(dc); 523 524 Set<Object> allValues = new HashSet<Object>(); 525 for (RawBioAssay rb : rba) 526 { 527 Annotation a = rb.isAnnotated() ? 528 rb.getAnnotationSet().findAnnotation(annotationType) : null; 529 allValues.addAll(a.getValues()); 530 } 531 %> 532 <tbl:cell column="annotation"> 533 <%=Values.getString(allValues, ", ", true)%> 534 </tbl:cell> 535 <% 536 } 537 %> 432 538 <tbl:cell column="bioassay"><%=Base.getLinkedName(ID, explorer.getBioAssay(dc, item.getShort(1)), false, true)%></tbl:cell> 433 539 <tbl:cell column="position"><%=item.getInt(2)%></tbl:cell> … … 435 541 <% 436 542 int i = 3; 543 int spotImageIndex = 0; 437 544 for (String columnId : selected.selectedIds) 438 545 { 439 Object value = item.getObject(i++); 440 %> 441 <tbl:cell column="<%=columnId%>"><%=value%></tbl:cell> 442 <% 546 if ("raw.spotimage".equals(columnId)) 547 { 548 RawData rd = rawDataType.getRawDataById(dc, item.getInt(i++)); 549 RawBioAssay rba = RawDataUtil.getRawBioAssay(dc, rd); 550 %> 551 <tbl:cell column="raw.spotimage"> 552 <% 553 if (rba.hasSpotImages()) 554 { 555 %> 556 <img src="../../../rawbioassays/rawdata/spotimage/<%=ID%>/<%=rba.getId()%>/<%=rd.getId()%>/spot<%=rd.getPosition()%>.png"> 557 <% 558 } 559 else 560 { 561 %> 562 <i>- none -</i> 563 <% 564 } 565 %> 566 </tbl:cell> 567 <% 568 } 569 else 570 { 571 Object value = item.getObject(i++); 572 %> 573 <tbl:cell column="<%=columnId%>"><%=value%></tbl:cell> 574 <% 575 } 443 576 } 444 577 %>
Note: See TracChangeset
for help on using the changeset viewer.