Changeset 2504


Ignore:
Timestamp:
Jun 13, 2014, 8:12:34 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #604: New wizard "RNA dilution registration"

The lab protocol wizard now display dilution date and operator if it exists.

The mRNA registration wizard now only list plates that has a dilution date set and the dilution date/operator has been removed from that wizard.

Added link to the new wizard on the index page. The counters have been updated to count only plates with/without dilution date.

Location:
extensions/net.sf.basedb.reggie/branches/2.15-stable
Files:
5 edited

Legend:

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

    r2322 r2504  
    6767  var debug = false;
    6868  var myPermissions = {};
     69  var allCounts = {};
    6970 
    7071  function init()
     
    187188      url = 'MRna.servlet?ID=<%=ID%>&cmd=CountRnaWithoutMRna';
    188189    }
    189     else if (what == 'mrna-plates')
    190     {
    191       url = 'MRna.servlet?ID=<%=ID%>&cmd=CountUnprocessedPlates&plateType=MRNA';
     190    else if (what == 'undiluted-mrna-plates')
     191    {
     192      url = 'MRna.servlet?ID=<%=ID%>&cmd=CountUndilutedMRNAPlates';
     193    }
     194    else if (what == 'diluted-mrna-plates')
     195    {
     196      url = 'MRna.servlet?ID=<%=ID%>&cmd=CountDilutedMRNAPlates';
    192197    }
    193198    else if (what == 'cdna-plates')
     
    322327      var count = error ? -1 : response.count;
    323328      setCount('count.rna-without-mrna', count, 'RNA', msg);
    324       startCounting('mrna-plates');
    325     }
    326     else if (currentCount == 'mrna-plates')
     329      startCounting('undiluted-mrna-plates');
     330    }
     331    else if (currentCount == 'undiluted-mrna-plates')
     332    {
     333      var msg = error || 'Number of mRNA plates waiting for dilution';
     334      var count = error ? -1 : response.count;
     335      setCount('count.undiluted-mrna-plates', count, 'mRNA plates', msg);
     336      startCounting('diluted-mrna-plates');
     337    }
     338    else if (currentCount == 'diluted-mrna-plates')
    327339    {
    328340      var msg = error || 'Number of mRNA plates waiting for registration';
    329341      var count = error ? -1 : response.count;
    330       setCount('count.mrna-plates.1', count, 'mRNA plates', msg);
    331       setCount('count.mrna-plates.2', count, 'mRNA plates', msg);
     342      setCount('count.diluted-mrna-plates', count, 'mRNA plates', msg);
     343      setCount('count.mrna-plates', count + allCounts['count.undiluted-mrna-plates'], 'mRNA plates', 'Number of mRNA plates waiting for processing');
    332344      startCounting('cdna-plates');
    333345    }
     
    410422  function setCount(id, count, unit, msg)
    411423  {
     424    allCounts[id] = count;
    412425    var div = document.getElementById(id);
    413426    div.title = msg;
     
    618631         
    619632          <li><span class="require-permission" data-role="LibraryPrep" data-link="libprep/mrna_protocol.jsp?ID=<%=ID%>"
    620             >Lab protocols for mRNA and cDNA preparation</span> <span class="counter" id="count.mrna-plates.1" title="Counting..."><img src="images/loading-small.gif"></span>
    621          
     633            >Lab protocols for mRNA and cDNA preparation</span> <span class="counter" id="count.mrna-plates" title="Counting..."><img src="images/loading-small.gif"></span>
     634         
     635          <li><span class="require-permission" data-role="LibraryPrep" data-link="libprep/rna_dilution_registration.jsp?ID=<%=ID%>"
     636            >RNA dilution registration</span> <span class="counter" id="count.undiluted-mrna-plates" title="Counting..."><img src="images/loading-small.gif"></span>
     637
    622638          <li><span class="require-permission" data-role="LibraryPrep" data-link="libprep/mrna_registration.jsp?ID=<%=ID%>"
    623             >mRNA registration and quality control results</span> <span class="counter" id="count.mrna-plates.2" title="Counting..."><img src="images/loading-small.gif"></span>
     639            >mRNA registration and quality control results</span> <span class="counter" id="count.diluted-mrna-plates" title="Counting..."><img src="images/loading-small.gif"></span>
    624640         
    625641          <li><span class="require-permission" data-role="LibraryPrep" data-link="libprep/cdna_registration.jsp?ID=<%=ID%>"
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/resources/libprep/mrna_protocol.jsp

    r1927 r2504  
    4242    {
    4343      var bioplate = bioplates[i];
    44       var option = new Option(bioplate.name, bioplate.id);
     44      var name = bioplate.name;
     45      if (bioplate.DilutionDate)
     46      {
     47        name += ' (diluted ' + formatDate(bioplate.DilutionDate) + ')';
     48      }
     49      var option = new Option(name, bioplate.id);
    4550      option.bioplate = bioplate;
    4651      plates.options[plates.length] = option;
     
    5661    setFatalError(msg);
    5762  }
     63}
     64
     65function formatDate(value)
     66{
     67  if (!value) return '';
     68  if (value.length == 8)
     69  {
     70    // YYYYMMDD
     71    value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2);
     72  }
     73  else if (value.length == 13)
     74  {
     75    // YYYYMMDD HHMM
     76    value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2) + ' ' + value.substr(9, 2) + ':' + value.substr(11, 2);
     77  }
     78  return value;
    5879}
    5980
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/resources/libprep/mrna_protocol2.jsp

    r2216 r2504  
    9191    }
    9292   
     93    var plate = response.plate;
     94    if (plate.DilutionDate)
     95    {
     96      setInnerHTML('dilution-date', formatDate(plate.DilutionDate));
     97      setInnerHTML('dilution-operator', plate.DilutionOperator);
     98    }
     99   
    93100    var list = response.mrna;
    94101    // Find QUANTITY_REGULAR = lowest used value
     
    115122    }
    116123    %>
     124    Main.show('protocol');
     125  }
     126 
     127  function formatDate(value)
     128  {
     129    if (!value) return '';
     130    if (value.length == 8)
     131    {
     132      // YYYYMMDD
     133      value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2);
     134    }
     135    else if (value.length == 13)
     136    {
     137      // YYYYMMDD HHMM
     138      value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2) + ' ' + value.substr(9, 2) + ':' + value.substr(11, 2);
     139    }
     140    return value;
    117141  }
    118142 
     
    534558  <h1>Lab protocol for mRNA and cDNA preparation <span class="reggie">Reggie <%=reggie.getAbout().getVersion() %></span></h1>
    535559
     560  <div class="loading" id="loading" style="display: none;"><table><tr><td><img src="../images/loading.gif"></td><td id="loading.msg">Please wait...</td></tr></table></div>
     561  <div class="messagecontainer error" id="errorMessage" style="display: none;"></div>
     562
     563  <div id="protocol" style="display: none;">
    536564  <table style="width: 100%;" class="protocolheader">
    537565  <tr style="border-bottom: 1px solid #000000;">
     
    545573    <td rowspan="5" colspan="2" style="width: 50%; border-right: 1px solid #000000;"><%=HTML.niceFormat(plate.getDescription()) %></td>
    546574    <td style="border-right: 1px solid #000000;">Dilution</td>
    547     <td style="border-right: 1px solid #000000;"></td>
    548     <td></td>
     575    <td style="border-right: 1px solid #000000;" id="dilution-date"></td>
     576    <td id="dilution-operator"></td>
    549577  </tr>
    550578  <tr style="border-top: 1px solid #CCCCCC;">
     
    570598  </table>
    571599
    572   <div class="loading" id="loading" style="display: none;"><table><tr><td><img src="../images/loading.gif"></td><td id="loading.msg">Please wait...</td></tr></table></div>
    573   <div class="messagecontainer error" id="errorMessage" style="display: none;"></div>
    574600  <%
    575601  if (view.equals("list"))
     
    690716  <i>Low quantity = The remaining quantity is too low for the RNA to be re-processed one more time</i>
    691717  </div>
     718  </div>
    692719</body>
    693720</html>
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/resources/libprep/mrna_registration.jsp

    r2073 r2504  
    100100  {
    101101    showLoadingAnimation('Loading histology work lists...');
    102     var url = '../MRna.servlet?ID=<%=ID%>&cmd=GetUnprocessedPlates&plateType=MRNA';   
     102    var url = '../MRna.servlet?ID=<%=ID%>&cmd=GetUnprocessedPlates&plateType=MRNA&onlyDiluted=1';   
    103103    request.open("GET", url, false); 
    104104    request.send(null);
     
    153153  }
    154154 
    155   frm.dilutionDate.focus();
     155  frm.purificationDate.focus();
    156156}
    157157
     
    308308  if (!pdfIsValid || !commentsIsValid) return false;
    309309 
    310   if (dateIsValid['dilutionDate'] == false) return false;
    311310  if (dateIsValid['purificationDate'] == false) return false;
    312311  if (dateIsValid['fragmentationDate'] == false) return false;
     
    339338  frm['pdf.path'].disabled = true;
    340339  Main.addClass(document.getElementById('btnPdf'), 'disabled');
    341   frm.dilutionDate.disabled = true;
    342   frm.dilutionOperator.disabled = true;
    343340  frm.purificationDate.disabled = true;
    344341  frm.purificationOperator.disabled = true;
     
    355352  submitInfo.failed = document.getElementById('outcomeSuccess').checked ? false : true;
    356353  submitInfo.pdf = pdfId;
    357   submitInfo.dilutionDate = frm.dilutionDate.value;
    358   submitInfo.dilutionOperator = frm.dilutionOperator.value;
    359354  submitInfo.purificationDate = frm.purificationDate.value;
    360355  submitInfo.purificationOperator = frm.purificationOperator.value;
     
    457452        <td class="help"><span id="bioplate.message" class="message" style="display: none;"></span>
    458453          Select an existing mRNA bioplate. The list contain all mRNA bioplates that
    459           has not yet been processed (determined by the absence of a 'creation' date).
     454          has been diluted, but not yet registered as completed (determined by the absence of a
     455          'creation' date).
    460456        </td>
    461457      </tr>
     
    495491        <td><b>Operator</b></td>
    496492        <td class="status"></td>
    497         <td class="help" rowspan="5">
     493        <td class="help" rowspan="4">
    498494          <span id="mrnaDate.message" class="message" style="display: none;"></span>
    499495          Enter date and operator for each step in the mRNA preparation.
    500496          (YYYYMMDD or MMDD)
    501497        </td>
    502       </tr>
    503       <tr>
    504         <td class="subprompt">Dilution</td>
    505         <td>
    506           <input type="text" name="dilutionDate" maxlength="10" style="width: 8em;"
    507             onblur="dateOnChange('dilutionDate')" onkeypress="focusOnEnter(event, 'dilutionOperator')">
    508             <base:icon
    509               onclick="Dates.selectDate('Dilution date', 'reggie', 'dilutionDate', 'setDate', 'yyyyMMdd')"
    510               image="calendar.png"
    511               tooltip="Select a date from a calendar"
    512               tabindex="-1"
    513             />
    514         </td>
    515         <td>
    516           <input type="text" name="dilutionOperator" value="<%=HTML.encodeTags(user.getName()) %>"
    517             style="width: 95%;" maxlength="255" onkeypress="focusOnEnter(event, 'purificationDate')">
    518         </td>
    519         <td class="status" id="dilutionDate.status"></td>
    520498      </tr>
    521499      <tr>
  • extensions/net.sf.basedb.reggie/branches/2.15-stable/src/net/sf/basedb/reggie/servlet/MRnaServlet.java

    r2161 r2504  
    123123        json.put("count", count);
    124124      }
     125      else if ("CountUndilutedMRNAPlates".equals(cmd))
     126      {
     127        dc = sc.newDbControl();
     128        BioplateType plateType = BioplateType.MRNA;
     129       
     130        // Find plates of the given 'plate type' without 'dilution date' and no 'destroyed' flag set
     131        ItemQuery<BioPlate> query = BioPlate.getQuery();
     132        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     133        // Must not have a DILUTION_DATE annotation
     134        query.join(Annotations.leftJoin(null, Annotationtype.DILUTION_DATE.load(dc), "dd"));
     135        query.restrict(Restrictions.eq(Hql.alias("dd"), null));
     136        plateType.addFilter(dc, query, true);
     137        query.setCacheResult(true);
     138        long count = query.count(dc);
     139        json.put("count", count);
     140      }
     141      else if ("CountDilutedMRNAPlates".equals(cmd))
     142      {
     143        dc = sc.newDbControl();
     144        BioplateType plateType = BioplateType.MRNA;
     145       
     146        // Find plates of the given 'plate type' with 'dilution date', but no 'create date' and no 'destroyed' flag set
     147        ItemQuery<BioPlate> query = BioPlate.getQuery();
     148        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     149        // Must have a DILUTION_DATE annotation
     150        query.join(Annotations.leftJoin(null, Annotationtype.DILUTION_DATE.load(dc), "dd"));
     151        query.restrict(Restrictions.neq(Hql.alias("dd"), null));
     152        query.restrict(Restrictions.eq(Hql.property("eventDate"), null));
     153        plateType.addFilter(dc, query, true);
     154        query.setCacheResult(true);
     155        long count = query.count(dc);
     156        json.put("count", count);
     157      }
    125158      else if ("GetUnprocessedPlates".equals(cmd))
    126159      {
     
    133166        query.restrict(Restrictions.eq(Hql.property("eventDate"), null));
    134167        plateType.addFilter(dc, query, true);
     168       
     169        if (req.getParameter("onlyDiluted") != null)
     170        {
     171          // Must have a DILUTION_DATE annotation
     172          query.join(Annotations.leftJoin(null, Annotationtype.DILUTION_DATE.load(dc), "dd"));
     173          query.restrict(Restrictions.neq(Hql.alias("dd"), null));
     174        }
     175       
    135176        query.order(Orders.desc(Hql.property("id")));
    136177       
     
    143184          jsonPlate.put("name", plate.getName());
    144185          jsonPlate.put("comments", plate.getDescription());
     186          if (plateType == BioplateType.MRNA)
     187          {
     188            jsonPlate.put("DilutionDate", Reggie.CONVERTER_DATE_TO_STRING.convert((Date)Annotationtype.DILUTION_DATE.getAnnotationValue(dc, plate)));
     189            jsonPlate.put("DilutionOperator", Annotationtype.DILUTION_OPERATOR.getAnnotationValue(dc, plate));
     190          }
    145191          jsonPlate.put("poolSchema", Annotationtype.POOL_SCHEMA.getAnnotationValue(dc, plate));
    146192          jsonPlates.add(jsonPlate);
     
    199245        BioPlate mRnaPlate = BioPlate.getById(dc, mRnaPlateId);
    200246
     247        JSONObject jsonPlate = new JSONObject();
     248        jsonPlate.put("id", mRnaPlate.getId());
     249        jsonPlate.put("name", mRnaPlate.getName());
     250        jsonPlate.put("comments", mRnaPlate.getDescription());
     251        jsonPlate.put("DilutionDate", Reggie.CONVERTER_DATE_TO_STRING.convert((Date)Annotationtype.DILUTION_DATE.getAnnotationValue(dc, mRnaPlate)));
     252        jsonPlate.put("DilutionOperator", Annotationtype.DILUTION_OPERATOR.getAnnotationValue(dc, mRnaPlate));
     253        jsonPlate.put("poolSchema", Annotationtype.POOL_SCHEMA.getAnnotationValue(dc, mRnaPlate));
     254       
    201255        ItemQuery<Extract> query = Extract.getQuery();
    202256        query.join(Hql.innerJoin(null, "bioWell", "bw", true));
     
    241295               
    242296        json.put("mrna", jsonMRna);
     297        json.put("plate", jsonPlate);
    243298      }
    244299
     
    606661       
    607662        // Dates and operators
    608         Annotationtype.DILUTION_DATE.setAnnotationValue(dc, mrnaPlate, Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("dilutionDate")));
    609         Annotationtype.DILUTION_OPERATOR.setAnnotationValue(dc, mrnaPlate, Values.getStringOrNull((String)jsonReq.get("dilutionOperator")));
    610663        Annotationtype.PURIFICATION_DATE.setAnnotationValue(dc, mrnaPlate, Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonReq.get("purificationDate")));
    611664        Annotationtype.PURIFICATION_OPERATOR.setAnnotationValue(dc, mrnaPlate, Values.getStringOrNull((String)jsonReq.get("purificationOperator")));
Note: See TracChangeset for help on using the changeset viewer.