Changeset 2242


Ignore:
Timestamp:
Feb 21, 2014, 10:38:55 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #577: Flag histology items in HE glass/scoring wizard

The "Register HE glass" wizard has been updated to allow '0' as flag that indicates that no good stain could be created for a sample.

The wizard can also be used later to unflag the sample by manually selecting the same paraffin block and enter a non-zero value for good stain.

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  
    3737var existingNumberOfHEGlass = 0;
    3838var stainDateIsValid = false;
    39 var numHEGlassIsValid = false;
     39var numHEGlassIsValid = true;
    4040
    4141function init()
     
    246246       
    247247        // Try to find the current "GoodStain" annotation on a child biomaterial
     248        var goodStain = 0;
    248249        for (var j = 0; j < heGlass.length; j++)
    249250        {
     
    251252          if (heWell.bioMaterial && heWell.bioMaterial.GoodStain)
    252253          {
    253             var field = 'idx.'+well.row + '.' + well.column;
    254             frm[field].value = j+1;
    255             checkIndexValue(field);
     254            goodStain = j+1;
    256255            break;
    257256          }
    258257        }
     258        var field = 'idx.'+well.row + '.' + well.column;
     259        frm[field].value = goodStain;
     260        checkIndexValue(field);
    259261      }
    260 
    261262      numWells++;
    262263    }
    263  
    264264  }
    265265 
     
    345345    var field = frm[wells[i]];
    346346    var indexValue = parseInt(field.value, 10);
    347     if (!indexValue || indexValue <= 0 || indexValue > numHEGlass)
     347    if (isNaN(indexValue) || indexValue < 0 || indexValue > numHEGlass)
    348348    {
    349349      setInputStatus(field.name, null, 'invalid');
     
    351351      allValid = false;
    352352    }
    353     else
     353    else if (indexValue > 0)
    354354    {
    355355      setInputStatus(field.name, null, 'valid');
     
    359359  if (!allValid)
    360360  {
    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');
    362362    return false;
    363363  }
     
    379379  var indexValue = parseInt(frm[field].value, 10);
    380380
    381   if (!indexValue || indexValue <= 0 || indexValue > numHEGlass)
     381  if (isNaN(indexValue) || indexValue < 0 || indexValue > numHEGlass)
    382382  {
    383383    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)', '');
    385385    return;
    386386  }
    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
    389397  setInputStatus('index', '', '');
    390398}
     
    881889          <td class="help"><span id="index.message" class="message" style="display: none;"></span>
    882890            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
    884893            with names HE<i>nnnnn</i>.1, HE<i>nnnnn</i>.2, etc. where <i>nnnnn</i>
    885894            is the number from the paraffin block name.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2228 r2242  
    519519  */
    520520  public static final Annotationtype FLAG =
    521     new Annotationtype("Flag", Type.STRING, Item.EXTRACT);
     521    new Annotationtype("Flag", Type.STRING, Item.SAMPLE, Item.EXTRACT);
    522522
    523523  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/BiomaterialList.java

    r2077 r2242  
    4646      + "created from libraries or RNA.");
    4747
     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");
    4858
    4959  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Histology.java

    r2190 r2242  
    3838  public static final String WORK_LIST_COMPLETE_ID = "net.sf.basedb.reggie.histology.work-list-complete";
    3939
     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";
    4046
    4147  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/HistologyServlet.java

    r2199 r2242  
    4444import net.sf.basedb.reggie.Reggie;
    4545import net.sf.basedb.reggie.dao.Annotationtype;
     46import net.sf.basedb.reggie.dao.BiomaterialList;
    4647import net.sf.basedb.reggie.dao.BioplateType;
    4748import net.sf.basedb.reggie.dao.HeGlass;
     
    661662
    662663        // Load the paraffin block, the histology items on it
    663         // and find the max "goodStain" value
     664        // and check if some items should be flagged
    664665        BioPlate pb = BioPlate.getById(dc, plateId.intValue());
    665666        pb.setDescription(Values.getStringOrNull((String)jsonPlate.get("comment")));
    666667        int numHeGlass = jsonHeGlass.size();
     668        int numFlagged = 0;
     669        int numUnflagged = 0;
     670        BioMaterialList flaggedHistology = BiomaterialList.FLAGGED_HISTOLOGY.load(dc);
    667671        for (int i = 0; i < jsonWells.size(); ++i)
    668672        {
    669673          JSONObject jsonWell = (JSONObject)jsonWells.get(i);
     674          Number goodStain = (Number)jsonWell.get("GoodStain");
    670675         
    671676          Number wellId = (Number)jsonWell.get("id");
     
    675680          {
    676681            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            }
    677700          }
    678701        }
     
    780803            jsonMessages.add("Updated '" + heGlass.getName() + "' with " +  numGoodStains + " good stains.");
    781804          }
     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.");         
    782813        }
    783814        if (numNewHEGlass > 0)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2238 r2242  
    5959import net.sf.basedb.reggie.dao.BioplateType;
    6060import net.sf.basedb.reggie.dao.Geometry;
     61import net.sf.basedb.reggie.dao.Histology;
    6162import net.sf.basedb.reggie.dao.Mimetype;
    6263import net.sf.basedb.reggie.dao.PooledLibrary;
     
    283284        jsonChecks.add(checkAnnotationType(dc, Annotationtype.FLAG, 1,
    284285            new ValueOptions(
     286              Histology.FLAG_NO_GOOD_STAIN,
    285287              Rna.FLAG_NOT_ENOUGH_REMAINING_QUANTITY, Rna.FLAG_LOW_QUALITY_SCORE, Rna.FLAG_MANUAL,
    286288              Rna.FLAG_MRNA_PLATE_FAILED, Rna.FLAG_CDNA_PLATE_FAILED, Rna.FLAG_LIB_PLATE_FAILED,
     
    376378            ));
    377379       
     380        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.HISTOLOGY, createIfMissing,
     381            Annotationtype.FLAG));
     382       
    378383        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.STAINED, createIfMissing,
    379384            Annotationtype.GOOD_STAIN, Annotationtype.SCORE_COMPLETE, Annotationtype.SCORE_INVASIVE_CANCER,
     
    459464        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_RNA, effectivePermissionsWrite, createIfMissing));
    460465        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_POOL, effectivePermissionsWrite, createIfMissing));
     466        jsonChecks.add(checkBioMaterialList(dc, BiomaterialList.FLAGGED_HISTOLOGY, effectivePermissionsWrite, createIfMissing));
    461467       
    462468        // MIME types
Note: See TracChangeset for help on using the changeset viewer.