Changeset 2242
- Timestamp:
- Feb 21, 2014, 10:38:55 AM (9 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/sampleproc/histology_glass.jsp
r2172 r2242 37 37 var existingNumberOfHEGlass = 0; 38 38 var stainDateIsValid = false; 39 var numHEGlassIsValid = false;39 var numHEGlassIsValid = true; 40 40 41 41 function init() … … 246 246 247 247 // Try to find the current "GoodStain" annotation on a child biomaterial 248 var goodStain = 0; 248 249 for (var j = 0; j < heGlass.length; j++) 249 250 { … … 251 252 if (heWell.bioMaterial && heWell.bioMaterial.GoodStain) 252 253 { 253 var field = 'idx.'+well.row + '.' + well.column; 254 frm[field].value = j+1; 255 checkIndexValue(field); 254 goodStain = j+1; 256 255 break; 257 256 } 258 257 } 258 var field = 'idx.'+well.row + '.' + well.column; 259 frm[field].value = goodStain; 260 checkIndexValue(field); 259 261 } 260 261 262 numWells++; 262 263 } 263 264 264 } 265 265 … … 345 345 var field = frm[wells[i]]; 346 346 var indexValue = parseInt(field.value, 10); 347 if ( !indexValue || indexValue <=0 || indexValue > numHEGlass)347 if (isNaN(indexValue) || indexValue < 0 || indexValue > numHEGlass) 348 348 { 349 349 setInputStatus(field.name, null, 'invalid'); … … 351 351 allValid = false; 352 352 } 353 else 353 else if (indexValue > 0) 354 354 { 355 355 setInputStatus(field.name, null, 'valid'); … … 359 359 if (!allValid) 360 360 { 361 setInputStatus('index', 'Value must be between 1–' + numHEGlass , 'invalid');361 setInputStatus('index', 'Value must be between 1–' + numHEGlass + ' (or 0 if good stain)', 'invalid'); 362 362 return false; 363 363 } … … 379 379 var indexValue = parseInt(frm[field].value, 10); 380 380 381 if ( !indexValue || indexValue <=0 || indexValue > numHEGlass)381 if (isNaN(indexValue) || indexValue < 0 || indexValue > numHEGlass) 382 382 { 383 383 setInputStatus(field, null, 'invalid'); 384 setInputStatus('index', 'Must be between 1–'+numHEGlass , '');384 setInputStatus('index', 'Must be between 1–'+numHEGlass + ' (or 0 if good stain)', ''); 385 385 return; 386 386 } 387 388 setInputStatus(field, null, 'valid'); 387 388 if (indexValue == 0) 389 { 390 setInputStatus(field, 'No good stain! Sample will be flagged and saved to Flagged Histology list.', 'warning'); 391 } 392 else 393 { 394 setInputStatus(field, null, 'valid'); 395 } 396 389 397 setInputStatus('index', '', ''); 390 398 } … … 881 889 <td class="help"><span id="index.message" class="message" style="display: none;"></span> 882 890 Enter the index number (starting at 1) of the HE glass that 883 contains the best stain for each sample. HE glass plates are created 891 contains the best stain for each sample. Use <b>0</b> if there is no 892 good stain at all for a sample. HE glass plates are created 884 893 with names HE<i>nnnnn</i>.1, HE<i>nnnnn</i>.2, etc. where <i>nnnnn</i> 885 894 is the number from the paraffin block name. -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java
r2228 r2242 519 519 */ 520 520 public static final Annotationtype FLAG = 521 new Annotationtype("Flag", Type.STRING, Item. EXTRACT);521 new Annotationtype("Flag", Type.STRING, Item.SAMPLE, Item.EXTRACT); 522 522 523 523 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/BiomaterialList.java
r2077 r2242 46 46 + "created from libraries or RNA."); 47 47 48 /** 49 The definition of the biomaterial list used for storing Histology items that have been 50 flagged due to failure to create a stained sample. 51 @since 2.15 52 */ 53 public static final BiomaterialList FLAGGED_HISTOLOGY = 54 new BiomaterialList("Flagged Histology", "net.sf.basedb.reggie.histology.flagged", Item.SAMPLE, 55 "This list contains Histology items that have failed to be stained. If possible a new " 56 + "HE glass may be created from the block, otherwise a new histology piece may be needed from " 57 + "the frozen backup"); 48 58 49 59 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Histology.java
r2190 r2242 38 38 public static final String WORK_LIST_COMPLETE_ID = "net.sf.basedb.reggie.histology.work-list-complete"; 39 39 40 /** 41 Flag value for the {@link Annotationtype#FLAG} annotation when a Histology item has failed 42 to get a GoodStain. 43 @since 2.15 44 */ 45 public static final String FLAG_NO_GOOD_STAIN = "NoGoodStain"; 40 46 41 47 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/HistologyServlet.java
r2199 r2242 44 44 import net.sf.basedb.reggie.Reggie; 45 45 import net.sf.basedb.reggie.dao.Annotationtype; 46 import net.sf.basedb.reggie.dao.BiomaterialList; 46 47 import net.sf.basedb.reggie.dao.BioplateType; 47 48 import net.sf.basedb.reggie.dao.HeGlass; … … 661 662 662 663 // Load the paraffin block, the histology items on it 663 // and find the max "goodStain" value664 // and check if some items should be flagged 664 665 BioPlate pb = BioPlate.getById(dc, plateId.intValue()); 665 666 pb.setDescription(Values.getStringOrNull((String)jsonPlate.get("comment"))); 666 667 int numHeGlass = jsonHeGlass.size(); 668 int numFlagged = 0; 669 int numUnflagged = 0; 670 BioMaterialList flaggedHistology = BiomaterialList.FLAGGED_HISTOLOGY.load(dc); 667 671 for (int i = 0; i < jsonWells.size(); ++i) 668 672 { 669 673 JSONObject jsonWell = (JSONObject)jsonWells.get(i); 674 Number goodStain = (Number)jsonWell.get("GoodStain"); 670 675 671 676 Number wellId = (Number)jsonWell.get("id"); … … 675 680 { 676 681 jsonWell.put("histology", histology); 682 String flag = (String)Annotationtype.FLAG.getAnnotationValue(dc, histology); 683 if (goodStain.intValue() == 0) 684 { 685 if (flag == null) 686 { 687 // Flag the histology if it is not already flagged 688 numFlagged++; 689 Annotationtype.FLAG.setAnnotationValue(dc, histology, Histology.FLAG_NO_GOOD_STAIN); 690 flaggedHistology.add(histology); 691 } 692 } 693 else if (flag != null) 694 { 695 // Remove the flag 696 numUnflagged++; 697 Annotationtype.FLAG.setAnnotationValue(dc, histology, null); 698 flaggedHistology.remove(histology); 699 } 677 700 } 678 701 } … … 780 803 jsonMessages.add("Updated '" + heGlass.getName() + "' with " + numGoodStains + " good stains."); 781 804 } 805 } 806 if (numFlagged > 0) 807 { 808 jsonMessages.add(numFlagged + " items added to Flagged histology list."); 809 } 810 if (numUnflagged > 0) 811 { 812 jsonMessages.add(numUnflagged + " items removed from Flagged histology list."); 782 813 } 783 814 if (numNewHEGlass > 0) -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r2238 r2242 59 59 import net.sf.basedb.reggie.dao.BioplateType; 60 60 import net.sf.basedb.reggie.dao.Geometry; 61 import net.sf.basedb.reggie.dao.Histology; 61 62 import net.sf.basedb.reggie.dao.Mimetype; 62 63 import net.sf.basedb.reggie.dao.PooledLibrary; … … 283 284 jsonChecks.add(checkAnnotationType(dc, Annotationtype.FLAG, 1, 284 285 new ValueOptions( 286 Histology.FLAG_NO_GOOD_STAIN, 285 287 Rna.FLAG_NOT_ENOUGH_REMAINING_QUANTITY, Rna.FLAG_LOW_QUALITY_SCORE, Rna.FLAG_MANUAL, 286 288 Rna.FLAG_MRNA_PLATE_FAILED, Rna.FLAG_CDNA_PLATE_FAILED, Rna.FLAG_LIB_PLATE_FAILED, … … 376 378 )); 377 379 380 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.HISTOLOGY, createIfMissing, 381 Annotationtype.FLAG)); 382 378 383 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.STAINED, createIfMissing, 379 384 Annotationtype.GOOD_STAIN, Annotationtype.SCORE_COMPLETE, Annotationtype.SCORE_INVASIVE_CANCER, … … 459 464 jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_RNA, effectivePermissionsWrite, createIfMissing)); 460 465 jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_POOL, effectivePermissionsWrite, createIfMissing)); 466 jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_HISTOLOGY, effectivePermissionsWrite, createIfMissing)); 461 467 462 468 // MIME types
Note: See TracChangeset
for help on using the changeset viewer.