Changeset 2134
- Timestamp:
- Nov 11, 2013, 2:07:37 PM (10 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 20 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk
- Property svn:mergeinfo changed
/extensions/net.sf.basedb.reggie/branches/ticket-489 (added) merged: 2115,2117,2123-2125,2128-2131
- Property svn:mergeinfo changed
-
extensions/net.sf.basedb.reggie/trunk/META-INF/extensions.xml
r2133 r2134 151 151 <ref index="1">net.sf.basedb.clients.web.listcolumn.sample</ref> 152 152 <ref index="1">net.sf.basedb.clients.web.listcolumn.extract</ref> 153 <ref index="1">net.sf.basedb.clients.web.listcolumn.bioplate</ref> 153 154 </extends> 154 155 <index>2</index> … … 156 157 <name>Reggie column</name> 157 158 <description> 158 Add a column to the list page of samples and extract for159 including some reggie-specific links.159 Add a column to the list page of samples, extract and bioplates 160 for including some reggie-specific links. 160 161 </description> 161 162 </about> … … 194 195 </extension> 195 196 197 <extension 198 id="net.sf.basedb.reggie.toolbar.histology-score" 199 extends="net.sf.basedb.clients.web.toolbar.item.bioplate" 200 > 201 <about> 202 <name>Histology score</name> 203 <description> 204 Adds a button to the toolbar of paraffin blocks and 205 HE stain bioplates that start the 'histology scoring wizard'. 206 </description> 207 </about> 208 <action-factory> 209 <factory-class> 210 net.sf.basedb.reggie.extensions.HistologyScoreButtonFactory 211 </factory-class> 212 </action-factory> 213 </extension> 196 214 197 215 </extensions> -
extensions/net.sf.basedb.reggie/trunk/resources/index.jsp
r2063 r2134 104 104 url = 'Histology.servlet?ID=<%=ID%>&cmd=CountParaffinBlocksWithoutHeGlass'; 105 105 } 106 else if (what == 'unscored-heglass') 107 { 108 url = 'Histology.servlet?ID=<%=ID%>&cmd=CountUnscoredHeGlass'; 109 } 106 110 else if (what == 'lysate') 107 111 { … … 206 210 var count = error ? -1 : response.count; 207 211 setCount('count.paraffin-blocks-without-heglass', count, 'paraffin blocks', msg); 212 startCounting('unscored-heglass'); 213 } 214 else if (currentCount == 'unscored-heglass') 215 { 216 var msg = error || 'Number of unscored HE glass'; 217 var count = error ? -1 : response.count; 218 setCount('count.unscored-heglass', count, 'HE glass', msg); 208 219 startCounting('lysate'); 209 220 } … … 429 440 <li><a href="sampleproc/histology_protocol.jsp?ID=<%=ID%>">Lab tracking protocol for FFPE/HE</a> <span class="counter" id="count.histology-lists" title="Counting..."><img src="images/loading-small.gif"></span> 430 441 <li><a href="sampleproc/histology_block.jsp?ID=<%=ID%>">Register paraffin blocks</a> <span class="counter" id="count.paraffin-blocks" title="Counting..."><img src="images/loading-small.gif"></span> 431 <li><a href="sampleproc/histology_glass.jsp?ID=<%=ID%>">Register histology HE glass information</a> <span class="counter" id="count.paraffin-blocks-without-heglass" title="Counting..."><img src="images/loading-small.gif"></span> 442 <li><a href="sampleproc/histology_glass.jsp?ID=<%=ID%>">Register HE glass</a> <span class="counter" id="count.paraffin-blocks-without-heglass" title="Counting..."><img src="images/loading-small.gif"></span> 443 <li><a href="sampleproc/histology_score.jsp?ID=<%=ID%>">Score HE glass</a> <span class="counter" id="count.unscored-heglass" title="Counting..."><img src="images/loading-small.gif"></span> 432 444 </ul> 433 445 </dd> -
extensions/net.sf.basedb.reggie/trunk/resources/reports/case_summary.jsp
r2106 r2134 281 281 } 282 282 283 function asPercent(value) 284 { 285 var result = ''; 286 if (value != null) 287 { 288 result = value + '%'; 289 } 290 return result; 291 } 292 283 293 function init() 284 294 { … … 463 473 464 474 var stained = h.stainDate ? true : false; 475 var bestStain = stained ? h.bestStain : null; 476 var scored = bestStain && bestStain.ScoreComplete != null ? true : false; 477 465 478 addColumn('histology.stained', stained ? formatDate(h.stainDate) : 'No'); 466 479 addColumn('histology.nofSlides', stained ? h.numStains : null); 467 addColumn('histology.heGlass', stained ? asBioPlateLocation( h.bestStain) : null);480 addColumn('histology.heGlass', stained ? asBioPlateLocation(bestStain.bioWell) : null); 468 481 addColumn('histology.stainProtocol', stained ? makeLink('PROTOCOL', h.stainProtocol, truncateAt) : null); 482 483 addColumn('histology.scored', scored ? (bestStain.ScoreComplete ? 'Complete' : 'In progress') : 'No'); 484 addColumn('histology.scoreInvasiveCancer', scored ? asPercent(bestStain.ScoreInvasiveCancer) : null); 485 addColumn('histology.scoreInsituCancer', scored ? asPercent(bestStain.ScoreInsituCancer) : null); 486 addColumn('histology.scoreLymphocytes', scored ? asPercent(bestStain.ScoreLymphocytes) : null); 487 addColumn('histology.scoreNormal', scored ? asPercent(bestStain.ScoreNormal) : null); 488 addColumn('histology.scoreStroma', scored ? asPercent(bestStain.ScoreStroma) : null); 489 addColumn('histology.scoreFat', scored ? asPercent(bestStain.ScoreFat) : null); 490 addColumn('histology.scoreComments', scored ? truncate(bestStain.comments, truncateAt) : null); 469 491 } 470 492 } … … 1123 1145 <th>Protocol</th> 1124 1146 </tr> 1147 <tr id="histology.scored" class="subtitle"> 1148 <th>Scored</th> 1149 </tr> 1150 <tr id="histology.scoreInvasiveCancer" class="dynamic-column"> 1151 <th>Invasive cancer</th> 1152 </tr> 1153 <tr id="histology.scoreInsituCancer" class="dynamic-column"> 1154 <th>Insitu cancer</th> 1155 </tr> 1156 <tr id="histology.scoreLymphocytes" class="dynamic-column"> 1157 <th>Lymphocytes</th> 1158 </tr> 1159 <tr id="histology.scoreNormal" class="dynamic-column"> 1160 <th>Normal</th> 1161 </tr> 1162 <tr id="histology.scoreStroma" class="dynamic-column"> 1163 <th>Stroma</th> 1164 </tr> 1165 <tr id="histology.scoreFat" class="dynamic-column"> 1166 <th>Fat</th> 1167 </tr> 1168 <tr id="histology.scoreComments" class="comment dynamic-column"> 1169 <th>Comments</th> 1170 </tr> 1125 1171 </tbody> 1126 1172 </table> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/JsonUtil.java
r1940 r2134 60 60 61 61 @SuppressWarnings("unchecked") 62 public static JSONObject getBioWellAsJSON(BioWell well )62 public static JSONObject getBioWellAsJSON(BioWell well, boolean includePlateInfo) 63 63 { 64 64 if (well == null) return null; … … 71 71 json.put("canAdd", well.canAddBioMaterial()); 72 72 json.put("canRemove", well.canClearBioMaterial()); 73 74 if (includePlateInfo) 75 { 76 BioPlate plate = well.getPlate(); 77 JSONObject jsonPlate = new JSONObject(); 78 jsonPlate.put("id", plate.getId()); 79 jsonPlate.put("name", plate.getName()); 80 jsonPlate.put("barcode", plate.getBarcode()); 81 jsonPlate.put("editable", plate.hasPermission(Permission.WRITE)); 73 82 74 BioPlate plate = well.getPlate(); 75 JSONObject jsonPlate = new JSONObject(); 76 jsonPlate.put("id", plate.getId()); 77 jsonPlate.put("name", plate.getName()); 78 jsonPlate.put("barcode", plate.getBarcode()); 79 jsonPlate.put("editable", plate.hasPermission(Permission.WRITE)); 80 81 Hardware storage = plate.getFreezer(); 82 if (storage != null || plate.getSection() != null || plate.getTray() != null || plate.getPosition() != null) 83 { 84 JSONObject jsonStorage = new JSONObject(); 85 if (storage != null) 83 Hardware storage = plate.getFreezer(); 84 if (storage != null || plate.getSection() != null || plate.getTray() != null || plate.getPosition() != null) 86 85 { 87 jsonStorage.put("id", storage.getId()); 88 jsonStorage.put("name", storage.getName()); 86 JSONObject jsonStorage = new JSONObject(); 87 if (storage != null) 88 { 89 jsonStorage.put("id", storage.getId()); 90 jsonStorage.put("name", storage.getName()); 91 } 92 jsonStorage.put("section", plate.getSection()); 93 jsonStorage.put("tray", plate.getTray()); 94 jsonStorage.put("position", plate.getPosition()); 95 jsonPlate.put("storage", jsonStorage); 89 96 } 90 jsonStorage.put("section", plate.getSection()); 91 jsonStorage.put("tray", plate.getTray()); 92 jsonStorage.put("position", plate.getPosition()); 93 jsonPlate.put("storage", jsonStorage); 97 98 json.put("bioPlate", jsonPlate); 94 99 } 95 96 json.put("bioPlate", jsonPlate);97 100 return json; 98 101 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java
r2102 r2134 242 242 public static final Annotationtype GOOD_STAIN = 243 243 new Annotationtype("GoodStain", Type.BOOLEAN, Item.SAMPLE); 244 245 246 /** 247 The "ScoreComplete" annotation type, used for histology samples 248 (Stained) and bioplates (HE glass). It is a boolean annotation type. 249 @since 2.14 250 */ 251 public static final Annotationtype SCORE_COMPLETE = 252 new Annotationtype("ScoreComplete", Type.BOOLEAN, Item.SAMPLE, Item.BIOPLATE); 253 254 255 /** 256 The "ScoreInvasiveCancer" annotation type, used for histology samples 257 (Stained). It is an integer annotation type. 258 @since 2.14 259 */ 260 public static final Annotationtype SCORE_INVASIVE_CANCER = 261 new Annotationtype("ScoreInvasiveCancer", Type.INT, Item.SAMPLE); 262 263 /** 264 The "ScoreInsituCancer" annotation type, used for histology samples 265 (Stained). It is an integer annotation type. 266 @since 2.14 267 */ 268 public static final Annotationtype SCORE_INSITU_CANCER = 269 new Annotationtype("ScoreInsituCancer", Type.INT, Item.SAMPLE); 270 271 /** 272 The "ScoreLymphocytes" annotation type, used for histology samples 273 (Stained). It is an integer annotation type. 274 @since 2.14 275 */ 276 public static final Annotationtype SCORE_LYMPHOCYTES = 277 new Annotationtype("ScoreLymphocytes", Type.INT, Item.SAMPLE); 278 279 /** 280 The "ScoreNormal" annotation type, used for histology samples 281 (Stained). It is an integer annotation type. 282 @since 2.14 283 */ 284 public static final Annotationtype SCORE_NORMAL = 285 new Annotationtype("ScoreNormal", Type.INT, Item.SAMPLE); 286 287 /** 288 The "ScoreStroma" annotation type, used for histology samples 289 (Stained). It is an integer annotation type. 290 @since 2.14 291 */ 292 public static final Annotationtype SCORE_STROMA = 293 new Annotationtype("ScoreStroma", Type.INT, Item.SAMPLE); 294 295 /** 296 The "ScoreFat" annotation type, used for histology samples 297 (Stained). It is an integer annotation type. 298 @since 2.14 299 */ 300 public static final Annotationtype SCORE_FAT = 301 new Annotationtype("ScoreFat", Type.INT, Item.SAMPLE); 244 302 245 303 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/CDna.java
r2082 r2134 102 102 if (jsonWell == null) 103 103 { 104 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );104 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 105 105 } 106 106 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Dna.java
r2098 r2134 107 107 if (jsonWell == null) 108 108 { 109 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );109 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 110 110 } 111 111 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/FlowThrough.java
r2098 r2134 107 107 if (jsonWell == null) 108 108 { 109 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );109 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 110 110 } 111 111 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Histology.java
r1831 r2134 157 157 if (jsonWell == null) 158 158 { 159 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );159 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 160 160 } 161 161 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Library.java
r2050 r2134 141 141 if (well != null) 142 142 { 143 jsonWell = JsonUtil.getBioWellAsJSON(well );143 jsonWell = JsonUtil.getBioWellAsJSON(well, true); 144 144 } 145 145 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Lysate.java
r1831 r2134 130 130 if (jsonWell == null) 131 131 { 132 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );132 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 133 133 } 134 134 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/MRna.java
r2050 r2134 113 113 if (jsonWell == null) 114 114 { 115 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );115 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 116 116 } 117 117 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Rna.java
r2020 r2134 367 367 if (jsonWell == null) 368 368 { 369 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );369 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 370 370 } 371 371 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/SpecimenTube.java
r1826 r2134 213 213 if (jsonWell == null) 214 214 { 215 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell() );215 jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true); 216 216 } 217 217 return jsonWell; -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/extensions/ReggieListColumnsFactory.java
r1915 r2134 6 6 import net.sf.basedb.clients.web.extensions.list.ListColumnAction; 7 7 import net.sf.basedb.core.BioMaterial; 8 import net.sf.basedb.core.BioPlate; 8 9 import net.sf.basedb.core.DbControl; 10 import net.sf.basedb.core.Item; 9 11 import net.sf.basedb.reggie.Reggie; 10 12 import net.sf.basedb.util.extensions.InvokationContext; 11 13 12 14 /** 13 Factory that add a "Reggie" column to the sample and extract list pages.14 In this column, we can add reggie-specific information, such as a link15 to the "Case summary" function for all items that15 Factory that add a "Reggie" column to the sample, extract and bioplate 16 list pages. In this column, we can add reggie-specific information, such as a 17 link to the "Case summary" function for all items that 16 18 can be matched to a case name, eg. it starts with 7 digits, optionally 17 19 followed by a dot. 20 21 In 2.14: Added link to Histology scoring wizard for PB and HE plates. 18 22 19 23 @author Nicklas … … 34 38 String ID = jspContext.getSessionControl().getId(); 35 39 String reggieHome = jspContext.getHome(context.getExtension()); 36 ColumnAction action = new ColumnAction(ID, reggieHome); 40 Item guiItem = jspContext.getGuiContext().getItem(); 41 ListColumnAction action = null; 42 if (guiItem == Item.BIOPLATE) 43 { 44 action = new BioPlateColumnAction(ID, reggieHome); 45 } 46 else if (guiItem == Item.SAMPLE || guiItem == Item.EXTRACT) 47 { 48 action = new BioMaterialColumnAction(ID, reggieHome); 49 } 37 50 return new ListColumnAction[] { action }; 38 51 } 39 52 40 static class ColumnAction53 static class BioMaterialColumnAction 41 54 extends AbstractListColumnBean<BioMaterial, String> 42 55 { … … 44 57 private final String reggieHome; 45 58 46 ColumnAction(String ID, String reggieHome)59 BioMaterialColumnAction(String ID, String reggieHome) 47 60 { 48 61 this.ID = ID; … … 70 83 } 71 84 } 85 86 static class BioPlateColumnAction 87 extends AbstractListColumnBean<BioPlate, String> 88 { 89 private final String ID; 90 private final String reggieHome; 91 92 BioPlateColumnAction(String ID, String reggieHome) 93 { 94 this.ID = ID; 95 this.reggieHome = reggieHome; 96 setId("reggie"); 97 setTitle("Reggie"); 98 } 99 100 @Override 101 public String getValue(DbControl dc, BioPlate plate) 102 { 103 String value = null; 104 String name = plate.getName(); 105 if (name != null && HistologyScoreButtonFactory.HE_PLATE_PATTERN.matcher(name).matches()) 106 { 107 String heName = "HE" + name.substring(2, 7); 108 StringBuilder sb = new StringBuilder(); 109 sb.append("<a href=\"" + reggieHome + "/sampleproc/histology_score.jsp?ID="+ID+"&name="+heName+"\""); 110 sb.append(" title=\"Goto HE glass scoring wizard\""); 111 sb.append("><img src=\""+reggieHome+"/images/microscope.png\">"); 112 sb.append("</a>"); 113 value = sb.toString(); 114 } 115 return value; 116 } 117 } 118 72 119 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/CaseSummaryServlet.java
r2103 r2134 430 430 } 431 431 432 @SuppressWarnings("unchecked") 432 433 private void loadHistologyInfo(DbControl dc, Histology his) 433 434 { … … 472 473 if (goodIsGood) 473 474 { 474 his.setAnnotation("bestStain", JsonUtil.getBioWellAsJSON(good.getBioWell())); 475 JSONObject jsonGood = new JSONObject(); 476 jsonGood.put("id", good.getId()); 477 jsonGood.put("name", good.getName()); 478 jsonGood.put("bioWell", JsonUtil.getBioWellAsJSON(good.getBioWell(), true)); 479 jsonGood.put("comments", good.getDescription()); 480 481 jsonGood.put("ScoreComplete", Annotationtype.SCORE_COMPLETE.getAnnotationValue(dc, good)); 482 jsonGood.put("ScoreInvasiveCancer", Annotationtype.SCORE_INVASIVE_CANCER.getAnnotationValue(dc, good)); 483 jsonGood.put("ScoreInsituCancer", Annotationtype.SCORE_INSITU_CANCER.getAnnotationValue(dc, good)); 484 jsonGood.put("ScoreLymphocytes", Annotationtype.SCORE_LYMPHOCYTES.getAnnotationValue(dc, good)); 485 jsonGood.put("ScoreNormal", Annotationtype.SCORE_NORMAL.getAnnotationValue(dc, good)); 486 jsonGood.put("ScoreStroma", Annotationtype.SCORE_STROMA.getAnnotationValue(dc, good)); 487 jsonGood.put("ScoreFat", Annotationtype.SCORE_FAT.getAnnotationValue(dc, good)); 488 489 his.setAnnotation("bestStain", jsonGood); 475 490 } 476 491 } … … 564 579 rna.setAnnotation("nofQc", rnaqc.size()); 565 580 rna.setAnnotation("qcProtocol", JsonUtil.getProtocolAsJSON(lastQc.getProtocol())); 566 rna.setAnnotation("qcPlate", JsonUtil.getBioWellAsJSON(lastQc.getBioWell() ));581 rna.setAnnotation("qcPlate", JsonUtil.getBioWellAsJSON(lastQc.getBioWell(), true)); 567 582 rna.setAnnotation("qcComment", lastQc.getDescription()); 568 583 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/HistologyServlet.java
r1983 r2134 37 37 import net.sf.basedb.core.SessionControl; 38 38 import net.sf.basedb.core.data.PlateCoordinate; 39 import net.sf.basedb.core.query.Annotations; 39 40 import net.sf.basedb.core.query.Expressions; 40 41 import net.sf.basedb.core.query.Hql; … … 44 45 import net.sf.basedb.reggie.dao.Annotationtype; 45 46 import net.sf.basedb.reggie.dao.BioplateType; 47 import net.sf.basedb.reggie.dao.HeGlass; 46 48 import net.sf.basedb.reggie.dao.Histology; 47 49 import net.sf.basedb.reggie.dao.ReactionPlate; … … 344 346 345 347 } 348 else if ("CountUnscoredHeGlass".equals(cmd)) 349 { 350 dc = sc.newDbControl(); 351 ItemQuery<BioPlate> query = BioPlate.getQuery(); 352 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 353 BioplateType.HE_GLASS.addFilter(dc, query, true); 354 355 // Missing of 'false' for SCORE_COMPLETE annotation 356 query.join(Annotations.leftJoin(null, Annotationtype.SCORE_COMPLETE.load(dc), "sc")); 357 query.restrict( 358 Restrictions.or( 359 Restrictions.eq(Hql.alias("sc"), null), 360 Restrictions.eq(Hql.alias("sc"), Expressions.bool(false)) 361 )); 362 363 long count = query.count(dc); 364 json.put("count", count); 365 } 366 else if ("GetHeGlassToScore".equals(cmd)) 367 { 368 dc = sc.newDbControl(); 369 370 String name = Values.getStringOrNull(req.getParameter("name")); 371 372 JSONArray jsonHeGlasses = new JSONArray(); 373 if (name == null) 374 { 375 // No name specified... 376 // ... find the name of first unscored glass that is not destroyed 377 ItemQuery<BioPlate> tmpQuery = BioPlate.getQuery(); 378 tmpQuery.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 379 BioplateType.HE_GLASS.addFilter(dc, tmpQuery, true); 380 tmpQuery.join(Annotations.leftJoin(null, Annotationtype.SCORE_COMPLETE.load(dc), "sc")); 381 tmpQuery.restrict(Restrictions.eq(Hql.alias("sc"), null)); 382 tmpQuery.order(Orders.asc(Hql.property("name"))); 383 tmpQuery.setMaxResults(1); 384 List<BioPlate> result = tmpQuery.list(dc); 385 if (result.size() > 0) 386 { 387 name = result.get(0).getName(); 388 } 389 } 390 391 if (name != null) 392 { 393 // Now, find all HE glass that are related to the original 394 int dotIndex = name.indexOf('.'); 395 String prefix = dotIndex > 0 ? name.substring(0, dotIndex) : name; 396 ItemQuery<BioPlate> query = BioPlate.getQuery(); 397 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 398 BioplateType.HE_GLASS.addFilter(dc, query, false); 399 query.restrict(Restrictions.rlike(Hql.property("name"), Expressions.string("^" + prefix + "\\.[0-9]+$"))); 400 query.order(Orders.asc(Hql.property("name"))); 401 402 List<HeGlass> plates = HeGlass.toList(query.list(dc)); 403 for (HeGlass heGlass : plates) 404 { 405 heGlass.loadSampleScores(dc); 406 heGlass.loadAnnotations(dc, "ScoreComplete", Annotationtype.SCORE_COMPLETE, null); 407 408 jsonHeGlasses.add(heGlass.asJSONObject()); 409 } 410 } 411 json.put("name", name); 412 json.put("heGlasses", jsonHeGlasses); 413 } 414 else if ("GetUncompletedHeGlass".equals(cmd)) 415 { 416 dc = sc.newDbControl(); 417 JSONArray jsonHeGlasses = new JSONArray(); 418 419 ItemQuery<BioPlate> query = BioPlate.getQuery(); 420 query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); 421 BioplateType.HE_GLASS.addFilter(dc, query, false); 422 query.join(Annotations.leftJoin(null, Annotationtype.SCORE_COMPLETE.load(dc), "sc")); 423 query.restrict(Restrictions.eq(Hql.alias("sc"), Expressions.bool(false))); 424 query.order(Orders.asc(Hql.property("name"))); 425 426 List<HeGlass> plates = HeGlass.toList(query.list(dc)); 427 for (HeGlass heGlass : plates) 428 { 429 heGlass.setAnnotation("numUncompleteSamples", heGlass.countUncompletedSamples(dc)); 430 jsonHeGlasses.add(heGlass.asJSONObject()); 431 } 432 433 json.put("heGlasses", jsonHeGlasses); 434 } 435 346 436 } 347 437 catch (Throwable t) … … 680 770 { 681 771 dc.saveItem(stainEvent); 772 } 773 774 dc.commit(); 775 } 776 else if ("SaveHeScore".equals(cmd)) 777 { 778 JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader()); 779 JSONArray jsonSamples = (JSONArray)jsonReq.get("samples"); 780 JSONArray jsonHeGlass = (JSONArray)jsonReq.get("heGlass"); 781 dc = sc.newDbControl(); 782 783 // Update scores on samples 784 for (int sampleNo = 0; sampleNo < jsonSamples.size(); ++sampleNo) 785 { 786 JSONObject jsonSample = (JSONObject)jsonSamples.get(sampleNo); 787 Number sampleId = (Number)jsonSample.get("id"); 788 Boolean goodStain = (Boolean)jsonSample.get("GoodStain"); 789 Boolean scoreComplete = (Boolean)jsonSample.get("ScoreComplete"); 790 791 Sample he = Sample.getById(dc, sampleId.intValue()); 792 793 Annotationtype.GOOD_STAIN.setAnnotationValue(dc, he, goodStain); 794 Annotationtype.SCORE_INVASIVE_CANCER.setAnnotationValue(dc, he, jsonSample.get("ScoreInvasiveCancer")); 795 Annotationtype.SCORE_INSITU_CANCER.setAnnotationValue(dc, he, jsonSample.get("ScoreInsituCancer")); 796 Annotationtype.SCORE_LYMPHOCYTES.setAnnotationValue(dc, he, jsonSample.get("ScoreLymphocytes")); 797 Annotationtype.SCORE_NORMAL.setAnnotationValue(dc, he, jsonSample.get("ScoreNormal")); 798 Annotationtype.SCORE_STROMA.setAnnotationValue(dc, he, jsonSample.get("ScoreStroma")); 799 Annotationtype.SCORE_FAT.setAnnotationValue(dc, he, jsonSample.get("ScoreFat")); 800 Annotationtype.SCORE_COMPLETE.setAnnotationValue(dc, he, scoreComplete); 801 he.setDescription(Values.getStringOrNull((String)jsonSample.get("comments"))); 802 803 if (Boolean.TRUE.equals(scoreComplete)) 804 { 805 jsonMessages.add("Scoring complete for sample: " + he.getName() + (Boolean.TRUE.equals(goodStain) ? " (GoodStain)" : "")); 806 } 807 else if (Boolean.FALSE.equals(scoreComplete)) 808 { 809 jsonMessages.add("Score updated for sample: " + he.getName() + " (Not complete)"); 810 } 811 else 812 { 813 jsonMessages.add("Scores removed from sample: " + he.getName()); 814 } 815 } 816 817 // ScoreComplete on HE glass 818 for (int glassNo = 0; glassNo < jsonHeGlass.size(); ++glassNo) 819 { 820 JSONObject jsonGlass = (JSONObject)jsonHeGlass.get(glassNo); 821 Number glassId = (Number)jsonGlass.get("id"); 822 Boolean scoreComplete = (Boolean)jsonGlass.get("ScoreComplete"); 823 824 BioPlate heGlass = BioPlate.getById(dc, glassId.intValue()); 825 826 Annotationtype.SCORE_COMPLETE.setAnnotationValue(dc, heGlass, scoreComplete); 827 828 if (Boolean.TRUE.equals(scoreComplete)) 829 { 830 jsonMessages.add("Scoring complete for HE glass: " + heGlass.getName()); 831 } 832 else 833 { 834 jsonMessages.add("Score updated for HE glass: " + heGlass.getName() + " (Not complete)"); 835 836 } 682 837 } 683 838 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r2116 r2134 230 230 231 231 jsonChecks.add(checkAnnotationType(dc, Annotationtype.GOOD_STAIN, 1, null, effectiveOptions, createIfMissing)); 232 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_COMPLETE, 1, null, effectiveOptions, createIfMissing)); 233 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_INVASIVE_CANCER, 1, null, effectiveOptions, createIfMissing)); 234 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_INSITU_CANCER, 1, null, effectiveOptions, createIfMissing)); 235 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_LYMPHOCYTES, 1, null, effectiveOptions, createIfMissing)); 236 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_NORMAL, 1, null, effectiveOptions, createIfMissing)); 237 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_STROMA, 1, null, effectiveOptions, createIfMissing)); 238 jsonChecks.add(checkAnnotationType(dc, Annotationtype.SCORE_FAT, 1, null, effectiveOptions, createIfMissing)); 232 239 233 240 jsonChecks.add(checkAnnotationType(dc, Annotationtype.QIACUBE_DATE, 1, null, effectiveOptions, createIfMissing)); … … 330 337 331 338 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.STAINED, createIfMissing, 332 Annotationtype.GOOD_STAIN)); 339 Annotationtype.GOOD_STAIN, Annotationtype.SCORE_COMPLETE, Annotationtype.SCORE_INVASIVE_CANCER, 340 Annotationtype.SCORE_INSITU_CANCER, Annotationtype.SCORE_LYMPHOCYTES, Annotationtype.SCORE_NORMAL, 341 Annotationtype.SCORE_STROMA, Annotationtype.SCORE_FAT)); 333 342 334 343 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.LYSATE, createIfMissing, -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SpecimenTubeServlet.java
r2082 r2134 144 144 while (free != null) 145 145 { 146 jsonWells.add(JsonUtil.getBioWellAsJSON(free ));146 jsonWells.add(JsonUtil.getBioWellAsJSON(free, true)); 147 147 if (jsonWells.size() == nofTubes) break; 148 148 free = getNextFreeWell(free);
Note: See TracChangeset
for help on using the changeset viewer.