Changeset 2031


Ignore:
Timestamp:
Oct 1, 2013, 2:07:24 PM (8 years ago)
Author:
Nicklas Nordborg
Message:

References #481: Register prepared flow cells

Added fields for "FlowCellID", "ReadString?" and sequence start date/operator when registering flow cells. But so far, only some of the information is saved in the database.

Not sure if we should introduce a DERIVEDBIOASSAY to represent the sequencing already at this point. If so, it would make sense to register the start date and operator on this item instead of on the flow cells.

Failure to cluster a flow cell is also not handled vere well at the moment.

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

Legend:

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

    r2028 r2031  
    311311  if (readString) frm.readString.value = readString;
    312312 
    313   readStringIsValud = false;
     313  readStringIsValid = false;
    314314  setInputStatus('readString', '', '');
    315315 
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/flowcell_registration.jsp

    r2020 r2031  
    3434
    3535var dateIsValid = [];
     36var flowCellIsValid = [];
    3637var commentsIsValid = false;
    3738
     
    4950      var flowCell = flowCells[i];
    5051      var option = new Option(flowCell.name, flowCell.id, i < 2);
    51       option.comments = flowCell.comments;
     52      option.flowCell = flowCell;
    5253      frm.flowcells.options[frm.flowcells.length] = option;
    5354    }
    54     flowCellIsValid = true;
    5555    setInputStatus('flowcells', '', 'valid');
    5656    outcomeOnChange();
     
    114114function gotoStep2()
    115115{
    116   var frm = document.forms['reggie'];
     116  var frm = document.forms['reggie'];
     117 
     118  var selectedFlowCells = [];
     119  for (var i = 0; i < frm.flowcells.length; i++)
     120  {
     121    if (frm.flowcells[i].selected)
     122    {
     123      selectedFlowCells[selectedFlowCells.length] = frm.flowcells[i].flowCell;
     124    }
     125  }
     126 
     127  if (selectedFlowCells.length == 0)
     128  {
     129    setInputStatus('flowcells', 'Select at least 1 flow cell', 'invalid');
     130    return;
     131  }
     132
     133 
    117134  frm.flowcells.disabled = true;
    118135  frm.outcome[0].disabled = true;
    119136  frm.outcome[1].disabled = true;
    120137
    121  
    122138  currentStep = 2;
    123139  Main.show('step.2.section');
     
    127143  Main.show('goregister');
    128144 
     145  var html = '<tr valign="top">';
     146  html += '<td class="prompt">Flow cell</td>';
     147  html += '<td style="width: 11em;"><b>ID</b></td>';
     148  html += '<td><b>ReadString</b></td>';
     149  html += '<td class="status"></td>';
     150  html += '<td class="help" rowspan="' + (selectedFlowCells.length+1) +'">';
     151  html += 'ID and ReadString is required for registration. ';
     152  html += 'ReadString must be a sequence of letters <b>Y</b>, <b>N</b>, <b>I</b>, <b>J</b> followed by digits.';
     153  html += '</td>';
     154  html += '</tr>';
     155 
     156  for (var i = 0; i < selectedFlowCells.length; i++)
     157  {
     158    var fc = selectedFlowCells[i];
     159    var prefix = 'fc.'+fc.id;
     160    html += '<tr>';
     161    html += '<td class="subprompt">'+fc.name+'</td>';
     162    html += '<td><input type="text" class="required" name="'+prefix+'.id" onblur="flowCellIdOnBlur('+fc.id+')"></td>';
     163    html += '<td><input type="text" class="required" name="'+prefix+'.readString" onblur="readStringOnBlur('+fc.id+')" value="'+fc.ReadString+'"></td>';
     164    html += '<td class="status" id="'+prefix+'.status">';
     165    html += '</tr>';
     166  }
     167 
     168  setInnerHTML('fc-data', html);
     169 
    129170  // Load mRNA protocols
    130171  var clusterProtocols = getProtocols('CLUSTER_PROTOCOL');
     
    140181  }
    141182
    142   frm.clusterDate.focus();
     183  frm['fc.'+selectedFlowCells[0].id+'.id'].focus();
    143184}
    144185
     
    228269}
    229270
     271function flowCellIdOnBlur(flowCellId)
     272{
     273  checkFlowCellData(flowCellId);
     274}
     275
     276function readStringOnBlur(flowCellId)
     277{
     278  checkFlowCellData(flowCellId);
     279}
     280
     281function checkFlowCellData(flowCellId)
     282{
     283  var frm = document.forms['reggie'];
     284   
     285  var prefix = 'fc.'+flowCellId;
     286  setInputStatus(prefix, '', '');
     287 
     288  flowCellIsValid[prefix+'.id'] = false;
     289  flowCellIsValid[prefix+'.readString'] = false;
     290 
     291  var id = frm[prefix+'.id'].value;
     292  if (id == '')
     293  {
     294    setInputStatus(prefix, 'ID is a required value', 'invalid');
     295    return;
     296  }
     297 
     298  flowCellIsValid[prefix+'.id'] = true;
     299 
     300  var readString = frm[prefix+'.readString'].value;
     301  if (readString == '')
     302  {
     303    setInputStatus(prefix, 'ReadString is a required value', 'invalid');
     304    return;
     305  }
     306
     307  if (!readString.match(/^([YNIJ]\d+)+$/))
     308  {
     309    setInputStatus(prefix, 'Not a valid ReadString value', 'invalid');
     310    return;
     311  }
     312 
     313  flowCellIsValid[prefix+'.readString'] = true;
     314  setInputStatus(prefix, '', 'valid');
     315}
     316
    230317function step2IsValid()
    231318{
     
    233320 
    234321  if (dateIsValid['clusterDate'] == false) return false;
     322  if (dateIsValid['sequenceStartDate'] == false) return false;
     323 
     324  var frm = document.forms['reggie'];
     325  for (var i = 0; i < frm.flowcells.length; i++)
     326  {
     327    if (frm.flowcells[i].selected)
     328    {
     329      var fc = frm.flowcells[i].flowCell;
     330      Main.debug(fc.name + ':'+ fc.id + ':' + flowCellIsValid['fc.'+fc.id+'.id'] + ':' + flowCellIsValid['fc.'+fc.id+'.readString']);
     331      if (flowCellIsValid['fc.'+fc.id+'.id'] != true) return false;
     332      if (flowCellIsValid['fc.'+fc.id+'.readString'] != true) return false;
     333    }
     334  }
    235335 
    236336  return true;
     
    240340{
    241341  if (!step2IsValid()) return;
    242 
    243342  var frm = document.forms['reggie'];
    244343 
     
    249348  frm.clusterDate.disabled = true;
    250349  frm.clusterOperator.disabled = true;
     350  frm.sequenceStartDate.disabled = true;
     351  frm.sequenceOperator.disabled = true;
    251352  frm.clusterProtocol.disabled = true;
    252353  frm.comments.disabled = true;
     
    256357  for (var i = 0; i < frm.flowcells.length; i++)
    257358  {
    258     if (frm.flowcells[i].selected) submitInfo.flowCells[submitInfo.flowCells.length] = parseInt(frm.flowcells[i].value);
     359    if (frm.flowcells[i].selected)
     360    {
     361      var fc = frm.flowcells[i].flowCell;
     362      fc.externalId = frm['fc.'+fc.id+'.id'].value;
     363      fc.ReadString = frm['fc.'+fc.id+'.readString'].value;
     364      submitInfo.flowCells[submitInfo.flowCells.length] = fc;
     365    }
    259366  }
    260367 
     
    263370  submitInfo.clusterDate = frm.clusterDate.value;
    264371  submitInfo.clusterOperator = frm.clusterOperator.value;
     372  submitInfo.sequenceStartDate = frm.sequenceStartDate.value;
     373  submitInfo.sequenceOperator = frm.sequenceOperator.value;
    265374  submitInfo.comments = frm.comments.value;
    266375 
     
    390499    <td class="stepfields">
    391500      <table>
     501      <tbody id="fc-data"></tbody>
    392502      <tr valign="top">
    393503        <td class="prompt">Step</td>
     
    395505        <td><b>Operator</b></td>
    396506        <td class="status"></td>
    397         <td class="help" rowspan="2">
    398           <span id="mrnaDate.message" class="message" style="display: none;"></span>
    399           Enter date and operator for each step in the clustering.
     507        <td class="help" rowspan="3">
     508          Enter date and operator for each step in the clustering and sequencing startup.
    400509          (YYYYMMDD or MMDD)
    401510        </td>
     
    415524        <td>
    416525          <input type="text" name="clusterOperator" value="<%=HTML.encodeTags(user.getName()) %>"
     526            style="width: 95%;" maxlength="255" onkeypress="focusOnEnter(event, 'sequenceStartDate')">
     527        </td>
     528        <td class="status" id="clusterDate.status"></td>
     529      </tr>
     530      <tr>
     531        <td class="subprompt">Sequence start</td>
     532        <td>
     533          <input type="text" name="sequenceStartDate" maxlength="10" style="width: 8em;"
     534            onblur="dateOnChange('sequenceStartDate')" onkeypress="focusOnEnter(event, 'sequenceOperator')">
     535            <base:icon
     536              onclick="Dates.selectDate('Sequence start date', 'reggie', 'sequenceStartDate', 'setDate', 'yyyyMMdd')"
     537              image="calendar.png"
     538              tooltip="Select a date from a calendar"
     539              tabindex="-1"
     540            />
     541        </td>
     542        <td>
     543          <input type="text" name="sequenceOperator" value="<%=HTML.encodeTags(user.getName()) %>"
    417544            style="width: 95%;" maxlength="255" onkeypress="focusOnEnter(event, 'clusterProtocol')">
    418545        </td>
    419         <td class="status" id="clusterDate.status"></td>
     546        <td class="status" id="sequenceStartDate.status"></td>
    420547      </tr>
    421548      <tr valign="top">
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2029 r2031  
    2626import net.sf.basedb.core.Protocol;
    2727import net.sf.basedb.core.SessionControl;
     28import net.sf.basedb.core.query.Annotations;
    2829import net.sf.basedb.core.query.Hql;
     30import net.sf.basedb.core.query.Orders;
    2931import net.sf.basedb.core.query.Restrictions;
    3032import net.sf.basedb.reggie.Reggie;
     
    111113        query.join(Hql.innerJoin("creationEvent", "ce"));
    112114        query.restrict(Restrictions.eq(Hql.property("ce", "eventDate"), null));
     115        // Must NOT have a PLATE_PROCESS_RESULT annotation
     116        query.join(Annotations.leftJoin(null, Annotationtype.PLATE_PROCESS_RESULT.load(dc), "ppr"));
     117        query.restrict(Restrictions.eq(Hql.alias("ppr"), null));
    113118        long count = query.count(dc);
    114119        json.put("count", count);
     
    122127        query.join(Hql.innerJoin("creationEvent", "ce"));
    123128        query.restrict(Restrictions.eq(Hql.property("ce", "eventDate"), null));
     129        // Must NOT have a PLATE_PROCESS_RESULT annotation
     130        query.join(Annotations.leftJoin(null, Annotationtype.PLATE_PROCESS_RESULT.load(dc), "ppr"));
     131        query.restrict(Restrictions.eq(Hql.alias("ppr"), null));
     132        query.order(Orders.asc(Hql.property("name")));
    124133       
    125134        JSONArray jsonFlowCells = new JSONArray();
     
    127136        for (FlowCell fc : flowCells)
    128137        {
     138          fc.loadAnnotations(dc, "ReadString", Annotationtype.READ_STRING, null);
    129139          jsonFlowCells.add(fc.asJSONObject());
    130140        }
     
    268278        for (int fcNo = 0; fcNo < jsonFlowCells.size(); ++fcNo)
    269279        {
    270           Number fcId = (Number)jsonFlowCells.get(fcNo);
     280          JSONObject jsonFlowCell = (JSONObject)jsonFlowCells.get(fcNo);
     281          Number fcId = (Number)jsonFlowCell.get("id");
    271282         
    272283          PhysicalBioAssay flowCell = PhysicalBioAssay.getById(dc, fcId.intValue());
     
    279290          flowCell.setDescription(comment);
    280291          Annotationtype.OPERATOR.setAnnotationValue(dc, flowCell, operator);
     292          Annotationtype.READ_STRING.setAnnotationValue(dc, flowCell, jsonFlowCell.get("ReadString"));
     293          Annotationtype.FLOWCELL_ID.setAnnotationValue(dc, flowCell, jsonFlowCell.get("externalId"));
    281294         
    282295          if (failed)
     
    286299            // since there is plenty of material left in the pool
    287300            Annotationtype.PLATE_PROCESS_RESULT.setAnnotationValue(dc, flowCell, ReactionPlate.PROCESS_FAILED);
    288            
    289301            jsonMessages.add("Flow cell '" + flowCell.getName() + "' registered with status: " + (ReactionPlate.PROCESS_FAILED));
    290302          }
    291303          else
    292304          {
    293             Annotationtype.PLATE_PROCESS_RESULT.setAnnotationValue(dc, flowCell, ReactionPlate.PROCESS_SUCCESSFUL);           
     305            Annotationtype.PLATE_PROCESS_RESULT.setAnnotationValue(dc, flowCell, ReactionPlate.PROCESS_SUCCESSFUL);
    294306            jsonMessages.add("Flow cell '" + flowCell.getName() + "' registered as completed.");
     307           
     308            // TODO - Create DerivedBioAssay SequenceRun000N and add selected flow cells to it??
     309            // Should the SEQUENCE_START_DATE be added to this instead of the flow cells??
     310           
    295311          }
    296312         
Note: See TracChangeset for help on using the changeset viewer.