Changeset 2028


Ignore:
Timestamp:
Sep 30, 2013, 1:59:10 PM (8 years ago)
Author:
Nicklas Nordborg
Message:

References #502: Design flow cells

Added "ReadString?" field and cleaned up code somewhat. The default volume to use from the pool when clustering should now be easier to find (as a javascript constant defined near the top of the page).

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

Legend:

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

    r2020 r2028  
    3333var currentStep = 1;
    3434
     35var DEFAULT_READ_STRING = 'Y54N1I6J1Y53N1';
     36var VOLUME_TO_USE_FROM_POOL = 10.0; // µl
     37
    3538var poolsAreValid = false;
    3639var flowCellsAreValid = false;
     40var readStringisValid = false;
    3741
    3842var flowCells = [];
     
    171175    subtypePooledLibrary = response.subtype;
    172176  }
    173 
     177 
    174178  var url = getRoot() + 'biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple&callback=setPoolCallback';
    175179  url += '&tmpfilter:INT:itemSubtype='+subtypePooledLibrary.id;
     
    254258  for (var fcNo = 0; fcNo < numFlowCells; fcNo++)
    255259  {
    256     var pools = [];
    257     pools.length = numLanes;
    258     flowCells[fcNo].pools = pools;
     260    var flowCell = flowCells[fcNo];
     261    flowCell.lanes = [];
     262    for (var laneNo = 0; laneNo < numLanes; laneNo++)
     263    {
     264      flowCell.lanes[laneNo] = {};
     265    }
    259266  }
    260267 
     
    266273    {
    267274      var pool = selectedPools[poolNo];
    268       flowCells[0].pools[poolNo] = pool;
    269       flowCells[0].pools[poolNo+4] = pool;
    270       flowCells[1].pools[3-poolNo] = pool;
    271       flowCells[1].pools[7-poolNo] = pool;
     275      flowCells[0].lanes[poolNo] = {'pool': pool, 'defaultPool': pool};
     276      flowCells[0].lanes[poolNo+4] = {'pool': pool, 'defaultPool': pool};
     277      flowCells[1].lanes[3-poolNo] = {'pool': pool, 'defaultPool': pool};
     278      flowCells[1].lanes[7-poolNo] = {'pool': pool, 'defaultPool': pool};
    272279    }
    273280  }
     
    281288      for (var laneNo = 0; laneNo < numLanes; laneNo++)
    282289      {
    283         flowCells[fcNo].pools[laneNo] = pool;
     290        flowCells[fcNo].lanes[laneNo] = {'pool': pool, 'defaultPool': pool};
    284291      }
    285292    }
    286293  }
    287294 
    288   // Set the name on all lanes
    289   for (var fcNo = 0; fcNo < numFlowCells; fcNo++)
    290   {
    291     for (var laneNo = 0; laneNo < numLanes; laneNo++)
    292     {
    293       var pool = flowCells[fcNo].pools[laneNo];
    294       setInnerHTML('lane.'+laneNo+'.'+fcNo, pool ? pool.name : '');
    295     }
    296   }
    297295  checkFlowCells();
    298 
     296  readStringOnChange(DEFAULT_READ_STRING);
    299297 
    300298  currentStep = 2;
     
    304302  Main.show('gocancel');
    305303  Main.show('goregister');
     304  frm.readString.focus();
     305
     306}
     307
     308function readStringOnChange(readString)
     309{
     310  var frm = document.forms['reggie'];
     311  if (readString) frm.readString.value = readString;
     312 
     313  readStringIsValud = false;
     314  setInputStatus('readString', '', '');
     315 
     316  var readString = frm.readString.value;
     317  if (readString == '')
     318  {
     319    setInputStatus('readString', 'Missing', 'invalid');
     320    return;
     321  }
     322
     323  if (!readString.match(/^([YNIJ]\d+)+$/))
     324  {
     325    setInputStatus('readString', 'Invalid format', 'invalid');
     326    return;
     327  }
     328 
     329  setInputStatus('readString', '', 'valid');
     330  readStringIsValid = true;
     331
    306332}
    307333
     
    313339  for (var fcNo = 0; fcNo < flowCells.length; fcNo++)
    314340  {
    315     for (var laneNo = 0; laneNo < flowCells[fcNo].pools.length; laneNo++)
    316     {
    317       var pool = flowCells[fcNo].pools[laneNo];
     341    for (var laneNo = 0; laneNo < flowCells[fcNo].lanes.length; laneNo++)
     342    {
     343      var lane = flowCells[fcNo].lanes[laneNo];
     344      var pool = lane.pool;
     345     
     346      var name = pool ? pool.name : '';
     347      if (lane.defaultPool && pool != lane.defaultPool)
     348      {
     349        name += ' *';
     350      }
     351     
     352      setInnerHTML('lane.'+laneNo+'.'+fcNo, name);
     353     
    318354      if (!pool)
    319355      {
     
    323359    }
    324360  }
     361 
     362 
    325363  setInputStatus('flowCells', '', 'valid');
    326364  flowCellsAreValid = true;
     
    329367function goRegister()
    330368{
    331   if (!flowCellsAreValid) return;
     369  if (!flowCellsAreValid || !readStringIsValid) return;
    332370 
    333371  var frm = document.forms['reggie'];
    334  
     372  frm.readString.disabled = true;
    335373  Main.hide('goregister');
    336374  Main.hide('gocancel');
    337   Main.addClass(document.getElementById('step.1.section'), 'disabled');
     375  Main.addClass(document.getElementById('step.2.section'), 'disabled');
    338376
    339377  var submitInfo = {};
     378  submitInfo.readString = frm.readString.value;
    340379  submitInfo.flowCells = flowCells;
    341380 
     
    343382  for (var fcNo = 0; fcNo < flowCells.length; fcNo++)
    344383  {
    345     for (var laneNo = 0; laneNo < flowCells[fcNo].pools.length; laneNo++)
    346     {
    347       var pool = flowCells[fcNo].pools[laneNo];
     384    for (var laneNo = 0; laneNo < flowCells[fcNo].lanes.length; laneNo++)
     385    {
     386      var lane = flowCells[fcNo].lanes[laneNo];
     387      lane.defaultPool = null; // Do not need to submit this information
     388      var pool = lane.pool;
    348389      pool.count = pool.count ? pool.count+1 : 1;
    349390    }
     
    353394  {
    354395    var pool = selectedPools[poolNo];
    355     pool.usedVolume = 10 / pool.count;
     396    pool.usedVolume = VOLUME_TO_USE_FROM_POOL / pool.count;
    356397  }
    357398 
     
    420461  {
    421462    Main.removeClass(selectAll.childNodes[i], 'current');
     463    Main.removeClass(selectAll.childNodes[i], 'default');
    422464  }
    423465  menu.style.display = 'block';
    424466 
    425   var currentPool = flowCells[fcNo].pools[laneNo];
    426   if (currentPool) Main.addClass(document.getElementById('pool-'+currentPool.id), 'current');
    427 
    428   var x = event.clientX-90;
     467  var currentPool = flowCells[fcNo].lanes[laneNo].pool;
     468  var defaultPool = flowCells[fcNo].lanes[laneNo].defaultPool;
     469  if (currentPool)
     470  {
     471    Main.addClass(document.getElementById('pool-'+currentPool.id), 'current');
     472  }
     473  if (defaultPool && defaultPool != currentPool)
     474  {
     475    Main.addClass(document.getElementById('pool-'+defaultPool.id), 'default');
     476  }
     477 
     478
     479  var x = event.clientX;
    429480  var halfHeight = Math.floor(selectAll.offsetHeight/2)
    430481  var y = event.clientY+2; //-halfHeight;
     
    443494  var index = event.target.getAttribute('data-index');
    444495  var pool = selectedPools[index];
    445   flowCells[currentFcNo].pools[currentLaneNo] = pool;
     496  flowCells[currentFcNo].lanes[currentLaneNo].pool = pool;
    446497  setInnerHTML('lane.'+currentLaneNo+'.'+currentFcNo, pool ? pool.name : '');
    447498  checkFlowCells();
     
    455506  margin-top: 0.25em;
    456507  margin-left: 1em;
     508}
     509
     510.plate .header
     511{
     512  height: 3em;
     513}
     514
     515.plate .header th.col-0, .plate .header th.col-1
     516{
     517  border-bottom: 1px solid #A0A0A0;
     518}
     519
     520.plate .header th.lane
     521{
     522  padding: 0.5em;
    457523}
    458524
     
    470536}
    471537
     538.plate tbody .lane
     539{
     540  border-right: 1px solid #A0A0A0;
     541}
     542
     543.well.col-1
     544{
     545  border-left-style: solid;
     546}
     547
    472548.hide-fc-1 .col-1
    473549{
     
    492568  background-position: 2px 50%;
    493569  background-repeat: no-repeat;
     570}
     571
     572#select-pool div.default:after
     573{
     574  content: ' (default)';
    494575}
    495576
     
    585666  <tr>
    586667    <td rowspan="3" class="stepno">2</td>
    587     <td class="steptitle">Flow cell layout</td>
     668    <td class="steptitle">Flow cell information</td>
    588669  </tr>
    589670  <tr>
     
    592673      <table>
    593674      <tr valign="top">
    594         <td class="prompt"></td>
     675        <td class="prompt">Read string</td>
     676        <td class="input">
     677          <input type="text" class="required" name="readString" value="" size="20"
     678            onblur="readStringOnChange()">
     679        </td>
     680        <td class="status" id="readString.status"></td>
     681        <td class="help"><span id="readString.message" class="message" style="display: none;"></span>
     682          Read string used in the HiSeq. Letters <b>Y</b>, <b>N</b>, <b>I</b>, <b>J</b>
     683          followed by digits.
     684        </td>
     685      </tr>
     686      <tr valign="top">
     687        <td class="prompt">Flow cell layout</td>
    595688        <td class="input">
    596689          <table class="plate" id="plate" style="margin: 1em 0 1em 0;">
     690          <thead>
    597691          <tr class="header">
    598             <th>Lane</th>
     692            <th class="lane">Lane</th>
    599693            <%
    600694            for (int fcNo = 0; fcNo < 2; fcNo++)
     
    606700            %>
    607701          </tr>
     702          </thead>
    608703          <tbody>
    609704          <%
     
    612707            %>
    613708            <tr class="row-<%=laneNo%>" id="lane.<%=laneNo%>">
    614               <th><%=laneNo+1%></th>
     709              <th class="lane"><%=laneNo+1%></th>
    615710              <%
    616711              for (int fcNo = 0; fcNo < 2; fcNo++)
     
    632727        <td class="status" id="flowCells.status"></td>
    633728        <td class="help"><span id="flowCells.message" class="message" style="display: none;"></span>
    634           Assign a pool to each flow cell lane.
     729          Assign a pool to each flow cell lane. Click on each lane to select a different pool.
    635730        </td>
    636731      </tr>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2027 r2028  
    545545    new Annotationtype("FlowCellID", Type.STRING, Item.PHYSICALBIOASSAY);
    546546
    547  
     547  /**
     548    The "ReadString" annotation, used for physical bioassays (FlowCell).
     549    @since 2.13
     550  */
     551  public static final Annotationtype READ_STRING =
     552    new Annotationtype("ReadString", Type.STRING, Item.PHYSICALBIOASSAY);
     553   
    548554  /**
    549555    Get the annotation type by name of the static constant defined in this class.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2020 r2028  
    174174        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());
    175175        JSONArray jsonFlowCells = (JSONArray)jsonReq.get("flowCells");
     176        String readString = (String)jsonReq.get("readString");
    176177       
    177178        dc = sc.newDbControl();
     
    184185          JSONObject jsonFlowCell = (JSONObject)jsonFlowCells.get(fcNo);
    185186         
    186           JSONArray jsonPools = (JSONArray)jsonFlowCell.get("pools");
     187          JSONArray jsonLanes = (JSONArray)jsonFlowCell.get("lanes");
    187188          PhysicalBioAssay flowCell = PhysicalBioAssay.getNew(dc);
    188189         
    189190          flowCell.setItemSubtype(flowCellType);
    190191          flowCell.setName((String)jsonFlowCell.get("name"));
    191           flowCell.setSize(jsonPools.size());
     192          flowCell.setSize(jsonLanes.size());
    192193          dc.saveItem(flowCell);
     194          Annotationtype.READ_STRING.setAnnotationValue(dc, flowCell, readString);
    193195         
    194196          Map<Number, Extract> poolCache = new HashMap<Number, Extract>();
    195197          BioMaterialEvent clusterEvent = flowCell.getCreationEvent();
    196198          int emptyLanes = 0;
    197           for (int poolNo = 0; poolNo < jsonPools.size(); poolNo++)
     199          for (int laneNo = 0; laneNo < jsonLanes.size(); laneNo++)
    198200          {
    199             JSONObject jsonPool = (JSONObject)jsonPools.get(poolNo);
    200             if (jsonPool == null)
     201            JSONObject jsonLane = (JSONObject)jsonLanes.get(laneNo);
     202            if (jsonLane == null)
    201203            {
    202204              emptyLanes++;
     
    204206            }
    205207           
     208            JSONObject jsonPool = (JSONObject)jsonLane.get("pool");
    206209            Number poolId = (Number)jsonPool.get("id");
    207210            float usedVolume = ((Number)jsonPool.get("usedVolume")).floatValue();
     
    237240            // Add the aliquot to the flow cell on the correct lane
    238241            BioMaterialEventSource src = clusterEvent.addSource(poolA);
    239             src.setPosition(poolNo+1);
     242            src.setPosition(laneNo+1);
    240243            src.setUsedQuantity(usedQuantity);
    241244          }
     
    247250        }
    248251       
    249         dc.commit();
     252        //dc.commit();
    250253      }
    251254      else if ("RegisterFlowCells".equals(cmd))
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2027 r2028  
    278278
    279279        jsonChecks.add(checkAnnotationType(dc, Annotationtype.FLOWCELL_ID, 1, null, effectiveOptions, createIfMissing));
     280        jsonChecks.add(checkAnnotationType(dc, Annotationtype.READ_STRING, 1, null, effectiveOptions, createIfMissing));
    280281       
    281282        // Annotation type categories
     
    354355
    355356        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.FLOW_CELL, createIfMissing,
    356             Annotationtype.FLOWCELL_ID, Annotationtype.OPERATOR, Annotationtype.PLATE_PROCESS_RESULT));
     357            Annotationtype.FLOWCELL_ID, Annotationtype.READ_STRING, Annotationtype.OPERATOR,
     358            Annotationtype.PLATE_PROCESS_RESULT));
    357359       
    358360        // Plugin definitions and configurations
Note: See TracChangeset for help on using the changeset viewer.