Changeset 1553


Ignore:
Timestamp:
Mar 8, 2012, 1:02:31 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #364: Put RNA aliquots on bioplate to be used by the Caliper machine

More error handling and usability improvements. Should be working ok now, without any major issues.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/rnaqc_aliquot.jsp

    r1552 r1553  
    3535  <script language="JavaScript" src="reggie.js" type="text/javascript" charset="UTF-8"></script>
    3636 
     37<style>
     38.ndconc
     39{
     40  font-size: 0.85em;
     41  color: #777777;
     42}
     43</style>
    3744 
    3845<script language="JavaScript">
    39 var debug = true;
    40 var HiSense_Limit = 50;
     46var debug = false;
     47var HiSense_Limit = 25;
    4148var currentStep = 1;
    4249var rnaQcBioPlates = null;
    4350var rnaQcProtocols = null;
    4451var selectedRnaExtracts = null;
    45 var selectedPlate = null;
    46 
     52var selectedBioPlate = null;
    4753
    4854var bioPlateNameIsValid = false;
     
    338344  var frm = document.forms['reggie'];
    339345  var bioPlateId = frm.bioPlates[frm.bioPlates.selectedIndex].value;
    340   alert(bioPlateNameIsValid);
    341346  if (bioPlateId == 0)
    342347  {
     
    388393  {
    389394    var rna = selectedRnaExtracts[i];
     395    rna.isValid = false;
    390396    var specimen = null;
    391397    var boxValue = '';
     
    408414    }
    409415
    410     html += i == 0 ? '<tr>' :  '<tr style="xborder-top: 1px dotted #A0A0A0;">';
     416    html += i == 0 ? '<tr>' :  '<tr style="border-top: 1px solid #cccccc;">';
    411417    html += '<td class="prompt">'+rna.nextRnaQcName+'</td>';
    412418    html += '</tr>';
    413419    html += '<tr><td class="subprompt">Row</td>'
    414     html += '<td style="width:600px;"><input style="text-transform:uppercase;" type="text"  onkeypress="focusOnEnter(event, \''+column+'\')" name='+row+' value="' + rowValue + '" size="3" maxlength="2" ';
     420    html += '<td style="width:600px;"><input style="text-transform:uppercase;" type="text" onkeypress="focusOnEnter(event, \''+column+'\')" name='+row+' value="' + rowValue + '" size="3" maxlength="2" ';
     421    html += ' onfocus="wellOnFocus('+i+')" onBlur="wellOnChange('+i+')">';
     422    html += '&nbsp;Column<input type="text" onkeypress="focusOnEnter(event, \'row'+(i+1)+'\')" name='+column+' value="'+ columnValue + '" size="3" maxlength="3" ';
    415423    html += ' onBlur="wellOnChange('+i+')">';
    416     html += '&nbsp;Column<input type="text" onkeypress="focusOnEnter(event, \''+i+'\')" name='+column+' value="'+ columnValue + '" size="3" maxlength="3" ';
    417     html += ' onBlur="wellOnChange('+i+')">';
    418     html += '&nbsp;<a href="javascript:suggestWellOnClick('+i+')">Suggest</a>&nbsp;&nbsp;';
     424    html += '&nbsp;<span class="link" onclick="suggestWellOnClick('+i+')">Suggest</span>&nbsp;&nbsp;';
    419425    html += '<input type="checkbox" name="'+hiSense+'" id="' + hiSense + '" value="1" ' + hiSenseChecked + '>';
    420426    html += '<label for="'+hiSense+'">HiSense</label>';
    421     if (ndConc) html += ' (' + ndConc + ' ng/μl)';
     427    if (ndConc) html += ' <span class="ndconc">(' + ndConc + ' ng/μl)</span>';
    422428    html += '</td>';
    423429    html += '<td class="status" id="well'+i+'.status" rowspan="2"></td>';
     
    431437  currentStep = 3;
    432438  Main.show('rnaQcSection'); 
    433   Main.hide('gonext'); 
    434 
     439  Main.hide('gonext');
    435440  Main.show('gocreate'); 
     441 
     442  frm['row'+0].focus();
    436443}
    437444
     
    469476}
    470477
    471 function wellOnChange(index)
    472 {
    473   var frm = document.forms['reggie'];
    474 
     478function wellOnFocus(index)
     479{
     480  var frm = document.forms['reggie'];
    475481  var row = frm['row'+index].value;
    476482  var column = frm['column'+index].value;
     483
     484  if (row == '' && column == '') suggestWellOnClick(index);
     485}
     486
     487function wellOnChange(index)
     488{
     489  var frm = document.forms['reggie'];
     490  var row = frm['row'+index].value;
     491  var column = frm['column'+index].value;
     492 
     493  selectedRnaExtracts[index].isValid = false;
    477494 
    478495  if (row == '' && column == '')
     
    481498    return;
    482499  }
    483   else if (row == '')
     500 
     501  // Validate row
     502  if (row == '')
    484503  {
    485504    setInputStatus('well'+index, 'Missing row value', 'invalid');
    486505    return;
    487506  }
    488   else if (column == '')
     507 
     508  var rowC = WELL_ALPHA.indexOf(row.toUpperCase());
     509  if (rowC < 0 || rowC >= selectedBioPlate.geometry.rows)
     510  {
     511    setInputStatus('well'+index, 'Row must be between A-' + WELL_ALPHA[selectedBioPlate.geometry.rows-1], 'invalid');
     512    return;
     513  }
     514 
     515  // Validate column
     516  if (column == '')
    489517  {
    490518    setInputStatus('well'+index, 'Missing column value', 'invalid');
     
    492520  }
    493521 
    494  
    495   setInputStatus('well'+index, ' ', 'valid')
    496  
     522  var colC = parseInt(column);
     523  if (isNaN(colC) || colC <= 0 || colC > selectedBioPlate.geometry.columns)
     524  {
     525    setInputStatus('well'+index, 'Column must be between 1-' + selectedBioPlate.geometry.columns, 'invalid');
     526    return;
     527  }
     528 
     529  // Find the selected well
     530  var well = getWellByCoordinate(selectedBioPlate, rowC, colC);
     531 
     532  // Check that it is not already used
     533  if (!well.canAdd)
     534  {
     535    setInputStatus('well'+index, 'The selected well is already used', 'invalid');
     536    return;
     537  }
     538 
     539  // Seems to be ok
     540  setInputStatus('well'+index, ' ', 'valid');
     541  selectedRnaExtracts[index].isValid = true;
     542}
     543
     544//  Get a well from a plate given a coordinate.
     545function getWellByCoordinate(bioPlate, row, col)
     546{
     547  for (var i = 0; i < bioPlate.bioWells.length; i++)
     548  {
     549    var w = bioPlate.bioWells[i];
     550    if (w.row == row && w.column == col)
     551    {
     552      return w;
     553    }
     554  }
     555  return null;
     556}
     557
     558
     559function step3IsValid()
     560{
     561  var frm = document.forms['reggie'];
     562  setInnerHTML('gonext.message', '');
     563
     564  // Check that no wells have an error or is used for two
     565  var used = new Array();
     566  for (var i = 0; i < selectedRnaExtracts.length; i++)
     567  {
     568    var rna = selectedRnaExtracts[i];
     569    if (!rna.isValid)
     570    {
     571      setInnerHTML('gonext.message', rna.nextRnaQcName + ' has missing or invalid information.');
     572      frm['row'+i].focus();
     573      return false;
     574    }
     575   
     576    var row = frm['row'+i].value.toUpperCase();
     577    var column = frm['column'+i].value;
     578    var key = row+column;
     579    if (used[key])
     580    {
     581      setInputStatus('well'+i, rna.nextRnaQcName + ' is using the same well as ' + used[key].nextRnaQcName, 'invalid');
     582      setInnerHTML('gonext.message', 'Found duplicate RNA in the same well');
     583      frm['row'+i].focus();
     584      return false;
     585    }
     586    used[key] = rna;
     587  }
     588 
     589  return true;
    497590}
    498591
    499592function goCreate()
    500593{
    501 //  if (!step3IsValid()) return;
     594  if (!step3IsValid()) return;
    502595
    503596  Main.hide('gocancel');
     
    531624
    532625  if (debug) Main.debug(JSON.stringify(submitInfo));
    533 
     626 
    534627  var request = Ajax.getXmlHttpRequest();
    535628  var url = 'RnaQc.servlet?ID=<%=ID%>&cmd=PlaceRnaQcAliquots';
     
    632725          <td class="status" id="bioplates.status"></td>
    633726          <td class="help"><span id="bioplates.message" class="message" style="display: none;"></span>
    634             Select the bioplate to use in the quality control. The list contain
    635             RNAQC bioplates without quality score data (determined by absence of
    636             QCRunDate annotation) with at least enough free wells to place the selected RNA extracts.
     727            The list contain RNAQC bioplates without quality score data (determined by absence of
     728            QCRunDate annotation) with enough free wells to place the selected RNA extracts.
    637729            Select the <b>create new</b> option to create a new plate.
    638730          </td>
     
    651743          <tr valign="top">
    652744            <td class="subprompt">Name</td>
    653             <td class="input"><input type="text" class="required" name="bioPlateName" onblur="bioPlateNameOnChange()"></td>
     745            <td class="input"><input type="text" class="text required" name="bioPlateName" onblur="bioPlateNameOnChange()"></td>
    654746            <td class="status" id="bioplatename.status"></td>
    655747            <td class="help">
    656748              <span id="bioplatename.message" class="message" style="display: none;"></span>
    657               The name of the bioplate should match <i>CaliperPlateNNNN</i> or <i>BAPlateNNNN</i>.
    658               Using a different name pattern may cause other wizards to fail.
     749              <i>CaliperPlateNNNN</i> or <i>BAPlateNNNN</i>. Using a different name
     750              pattern may cause other wizards to fail.
    659751            </td>
    660752          </tr>
    661753          <tr valign="top">
    662754            <td class="subprompt">Barcode</td>
    663             <td class="input"><input type="text"name="bioPlateBarcode"></td>
     755            <td class="input"><input type="text" class="text" name="bioPlateBarcode"></td>
    664756            <td class="status" id="bioplatebarcode.status"></td>
    665757            <td class="help">
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/ReactionPlate.java

    r1552 r1553  
    2020import net.sf.basedb.core.query.Expressions;
    2121import net.sf.basedb.core.query.Hql;
     22import net.sf.basedb.core.query.Orders;
    2223import net.sf.basedb.core.query.Restrictions;
    2324import net.sf.basedb.reggie.Reggie;
     
    6869      query.restrict(new HasAnnotationRestriction(null, at, false, false));
    6970    }
     71    query.order(Orders.asc(Hql.property("name")));
    7072   
    7173    List<BioPlate> tmp = query.list(dc);
Note: See TracChangeset for help on using the changeset viewer.