Changeset 2117


Ignore:
Timestamp:
Nov 4, 2013, 2:46:34 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #489: Histology scoring wizard

  • Added 7 new annotations for keeping the scores.
  • Added entry point for the scoring wizard on the Reggie start page.
  • Implemented counting of unscored HE glass
  • Started with method for loading the information that is needed to be able to score a set of HE glass.
Location:
extensions/net.sf.basedb.reggie/branches/ticket-489
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/ticket-489/resources/index.jsp

    r2063 r2117  
    104104      url = 'Histology.servlet?ID=<%=ID%>&cmd=CountParaffinBlocksWithoutHeGlass';
    105105    }
     106    else if (what == 'unscored-heglass')
     107    {
     108      url = 'Histology.servlet?ID=<%=ID%>&cmd=CountUnscoredHeGlass';
     109    }
    106110    else if (what == 'lysate')
    107111    {
     
    206210      var count = error ? -1 : response.count;
    207211      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);
    208219      startCounting('lysate');
    209220    }
     
    429440            <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>
    430441            <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>
    432444            </ul>
    433445          </dd>
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/JsonUtil.java

    r1940 r2117  
    6060
    6161  @SuppressWarnings("unchecked")
    62   public static JSONObject getBioWellAsJSON(BioWell well)
     62  public static JSONObject getBioWellAsJSON(BioWell well, boolean includePlateInfo)
    6363  {
    6464    if (well == null) return null;
     
    7171    json.put("canAdd", well.canAddBioMaterial());
    7272    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));
    7382     
    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)
    8685      {
    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);
    8996      }
    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);
    9499    }
    95    
    96     json.put("bioPlate", jsonPlate);
    97100    return json;
    98101  }
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2102 r2117  
    242242  public static final Annotationtype GOOD_STAIN =
    243243    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);
    244302 
    245303  /**
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/CDna.java

    r2082 r2117  
    102102    if (jsonWell == null)
    103103    {
    104       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     104      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    105105    }
    106106    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Dna.java

    r2098 r2117  
    107107    if (jsonWell == null)
    108108    {
    109       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     109      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    110110    }
    111111    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/FlowThrough.java

    r2098 r2117  
    107107    if (jsonWell == null)
    108108    {
    109       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     109      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    110110    }
    111111    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Histology.java

    r1831 r2117  
    157157    if (jsonWell == null)
    158158    {
    159       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     159      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    160160    }
    161161    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Library.java

    r2050 r2117  
    141141    if (well != null)
    142142    {
    143       jsonWell = JsonUtil.getBioWellAsJSON(well);
     143      jsonWell = JsonUtil.getBioWellAsJSON(well, true);
    144144    }
    145145
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Lysate.java

    r1831 r2117  
    130130    if (jsonWell == null)
    131131    {
    132       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     132      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    133133    }
    134134    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/MRna.java

    r2050 r2117  
    113113    if (jsonWell == null)
    114114    {
    115       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     115      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    116116    }
    117117    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/Rna.java

    r2020 r2117  
    367367    if (jsonWell == null)
    368368    {
    369       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     369      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    370370    }
    371371    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/dao/SpecimenTube.java

    r1826 r2117  
    213213    if (jsonWell == null)
    214214    {
    215       jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell());
     215      jsonWell = JsonUtil.getBioWellAsJSON(getItem().getBioWell(), true);
    216216    }
    217217    return jsonWell;
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/servlet/CaseSummaryServlet.java

    r2103 r2117  
    472472      if (goodIsGood)
    473473      {
    474         his.setAnnotation("bestStain", JsonUtil.getBioWellAsJSON(good.getBioWell()));
     474        his.setAnnotation("bestStain", JsonUtil.getBioWellAsJSON(good.getBioWell(), true));
    475475      }
    476476    }
     
    564564      rna.setAnnotation("nofQc", rnaqc.size());
    565565      rna.setAnnotation("qcProtocol", JsonUtil.getProtocolAsJSON(lastQc.getProtocol()));
    566       rna.setAnnotation("qcPlate", JsonUtil.getBioWellAsJSON(lastQc.getBioWell()));
     566      rna.setAnnotation("qcPlate", JsonUtil.getBioWellAsJSON(lastQc.getBioWell(), true));
    567567      rna.setAnnotation("qcComment", lastQc.getDescription());
    568568
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/servlet/HistologyServlet.java

    r1983 r2117  
    3737import net.sf.basedb.core.SessionControl;
    3838import net.sf.basedb.core.data.PlateCoordinate;
     39import net.sf.basedb.core.query.Annotations;
    3940import net.sf.basedb.core.query.Expressions;
    4041import net.sf.basedb.core.query.Hql;
     
    4445import net.sf.basedb.reggie.dao.Annotationtype;
    4546import net.sf.basedb.reggie.dao.BioplateType;
     47import net.sf.basedb.reggie.dao.HeGlass;
    4648import net.sf.basedb.reggie.dao.Histology;
    4749import net.sf.basedb.reggie.dao.ReactionPlate;
     
    343345        out.close();
    344346       
     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          String prefix = name.substring(0, name.indexOf('.'));
     395          ItemQuery<BioPlate> query = BioPlate.getQuery();
     396          query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     397          BioplateType.HE_GLASS.addFilter(dc, query, false);
     398          query.restrict(Restrictions.rlike(Hql.property("name"), Expressions.string("^" + prefix + "\\.[0-9]+$")));
     399          query.order(Orders.asc(Hql.property("name")));
     400         
     401          List<HeGlass> plates = HeGlass.toList(query.list(dc));
     402          for (HeGlass heGlass : plates)
     403          {
     404            heGlass.loadSampleScores(dc);
     405            heGlass.loadAnnotations(dc, "ScoreComplete", Annotationtype.SCORE_COMPLETE, null);
     406           
     407            jsonHeGlasses.add(heGlass.asJSONObject());
     408          }
     409        }
     410        json.put("name", name);
     411        json.put("heGlasses", jsonHeGlasses);
    345412      }
    346413    }
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2109 r2117  
    230230
    231231        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));
    232239       
    233240        jsonChecks.add(checkAnnotationType(dc, Annotationtype.QIACUBE_DATE, 1, null, effectiveOptions, createIfMissing));
     
    330337       
    331338        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));
    333342       
    334343        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.LYSATE, createIfMissing,
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/servlet/SpecimenTubeServlet.java

    r2082 r2117  
    144144          while (free != null)
    145145          {
    146             jsonWells.add(JsonUtil.getBioWellAsJSON(free));
     146            jsonWells.add(JsonUtil.getBioWellAsJSON(free, true));
    147147            if (jsonWells.size() == nofTubes) break;
    148148            free = getNextFreeWell(free);
Note: See TracChangeset for help on using the changeset viewer.